Documentation

Everything you need to integrate Moresq.

Installation

npm install @moresq/sdk

Or use the REST API directly — no SDK needed.

Authentication

All API calls require an API key. Pass it via the Authorization header or X-API-Key header.

# Option 1: Authorization header
curl -H "Authorization: Bearer qr_your_key" ...

# Option 2: X-API-Key header
curl -H "X-API-Key: qr_your_key" ...

POST /v1/resolve

Resolve a single field from multiple source observations.

Request body

FieldTypeRequiredDescription
fieldstringYesField name being resolved
observationsarrayYesArray of source observations
strategystringNomajority | weighted | recency | bayesian
field_typestringNonumeric | categorical | text | boolean | date
tolerancenumberNoCustom tolerance (0-1). Default: 0.05 for numeric

Observation object

FieldTypeDescription
sourcestringSource identifier
valueanyThe observed value
observed_atstring?ISO 8601 date
reliabilitynumber?Pre-assigned reliability (0-1)

Example

const result = await fetch('https://api.moresq.com/v1/resolve', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer qr_your_key',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    field: 'length_overall',
    strategy: 'weighted',
    observations: [
      { source: 'api_a', value: 45.2, observed_at: '2026-03-15', reliability: 0.9 },
      { source: 'api_b', value: 45.0, observed_at: '2026-03-10', reliability: 0.7 },
      { source: 'api_c', value: 45.2, observed_at: '2026-02-28', reliability: 0.8 },
      { source: 'api_d', value: 46.1, observed_at: '2025-12-01', reliability: 0.3 },
    ]
  })
})

POST /v1/resolve/batch

Resolve multiple fields for an entity in one call. Each field counts as one resolution.

{
  "entity_id": "yacht_123",
  "fields": [
    {
      "field": "loa",
      "observations": [
        { "source": "a", "value": 45.2 },
        { "source": "b", "value": 45.0 }
      ]
    },
    {
      "field": "builder",
      "field_type": "categorical",
      "observations": [
        { "source": "a", "value": "Feadship" },
        { "source": "b", "value": "Feadship" }
      ]
    }
  ]
}

Strategies

majority

Most common value wins. Groups observations by agreement (respecting tolerance), picks the largest group.

Best for: Static data where source count matters more than recency.

weighteddefault

Sources weighted by reliability and recency. The value backed by the highest total weight wins. Default strategy.

Best for: Most use cases. Balances reliability, recency, and agreement.

recency

Most recent observation wins, unless it contradicts the majority (safety check).

Best for: Rapidly changing data (prices, positions, status).

bayesian

Full probabilistic inference. Computes posterior probability for each value group. Calibrated confidence — never overconfident.

Best for: When you have strong priors or need precise confidence intervals. Pro engine.

ensemble

Runs all 4 strategies simultaneously, then meta-consensus on the results. If all agree → highest confidence. If they disagree → flags uncertainty.

Best for: Maximum accuracy. When getting it right matters more than speed. Pro engine.

catd

CATD (Confidence-Aware Truth Discovery). Academic algorithm from VLDB 2015. Uses EM convergence to auto-discover source reliability from scratch.

Best for: When you don't know which sources to trust. Moresq figures it out. Pro engine.

Specialized endpoints (Pro)

POST /v1/resolve/geo

Geospatial consensus. Send GPS coordinates from multiple sources — get the geometric median + outlier detection. Uses Weiszfeld algorithm + DBSCAN clustering.

POST /v1/resolve/prices

Multi-currency price consensus. Send prices in $, €, £ — auto-converts to base currency then reconciles. Handles "$15M", "€14.2M", "£12.5 million".

POST /v1/resolve/dates

Date granularity-aware consensus. "2015" and "2015-03-22" are compatible — picks the most precise date consistent with the majority.

Batch jobs

For large datasets, upload a CSV or connect your database. Moresq processes in the background.

POST /v1/jobs/csv

Upload CSV with columns: entity_id, field, source, value. Returns a job_id. Poll status at GET /v1/jobs/:id. Download results at GET /v1/jobs/:id/csv.

POST /v1/jobs/db

Connect your Supabase or PostgreSQL. Specify table, entity column, source column, and fields. Moresq reads, reconciles, and optionally writes results back to a new table.

// Connect Supabase
curl -X POST api.moresq.com/v1/jobs/db \
  -H "X-API-Key: qr_..." \
  -d '{
    "connection_string": "postgresql://...@db.xxx.supabase.co:5432/postgres",
    "table": "my_scraped_data",
    "entity_column": "product_id",
    "source_column": "scraper_name",
    "fields": ["price", "name", "year"],
    "engine": "pro",
    "write_back": true,
    "output_table": "my_clean_data"
  }'

Pricing

Pay for what you use. Balance headers X-Moresq-Balance andX-Moresq-Cost are included in every response.

EngineCost per resolutionStrategies
Core€0.002majority, recency
Pro€0.005+ weighted, bayesian, ensemble, catd, huber

Free: €5 credit at signup. Pro subscription: €19/month (5,000 Pro resolutions). Wallet: top up anytime.

Self-hosting

The core engine is open-source (MIT). Run it yourself with zero dependencies.

# Use the engine directly (no API server)
npm install @moresq/engine

# Or run the full API server in Docker
docker run -p 4400:4400 -v moresq-data:/app/data moresq/api