Recoup

Get started with Recoup.

API REFERENCE

Process private data

On this page
POST/api/ingestion

Submit a versioned import, read private artifacts, browse organization datasets, or explicitly deliver one ready output. Standard authenticated MCP uses the same operations. Delegated OAuth excludes this tool.

Authentication

x-api-key in header

bearerAuth bearer

Request

cURL
curl --request POST \
  --url 'https://api.recoupable.dev/api/ingestion' \
  --header 'x-api-key: YOUR_API_KEY' \
  --header 'Content-Type: application/json' \
  --data '{
  "action": "create",
  "idempotency_key": "inventory-2026-12-v1",
  "source": {
    "kind": "inline",
    "format": "csv",
    "filename": "inventory.csv",
    "content_base64": "U0tVLFF0eQowMDEsMgowMDIsMwo="
  },
  "contract": {
    "version": "inventory-1",
    "fields": [
      {
        "name": "sku",
        "source": "SKU",
        "type": "string"
      },
      {
        "name": "quantity",
        "source": "Qty",
        "type": "integer"
      }
    ],
    "business_keys": [
      "sku"
    ],
    "controls": [
      {
        "field": "quantity",
        "expected": "5"
      }
    ]
  }
}'

Try it

Fill in the fields, send the request from your browser, and read the live response. The curl below updates as you type.

Kept in this browser tab only and cleared when it closes.

cURL for this request
curl --request POST \
  --url 'https://api.recoupable.dev/api/ingestion' \
  --header 'Content-Type: application/json' \
  --data '{
  "action": "create",
  "idempotency_key": "inventory-2026-12-v1",
  "source": {
    "kind": "inline",
    "format": "csv",
    "filename": "inventory.csv",
    "content_base64": "U0tVLFF0eQowMDEsMgowMDIsMwo="
  },
  "contract": {
    "version": "inventory-1",
    "fields": [
      {
        "name": "sku",
        "source": "SKU",
        "type": "string"
      },
      {
        "name": "quantity",
        "source": "Qty",
        "type": "integer"
      }
    ],
    "business_keys": [
      "sku"
    ],
    "controls": [
      {
        "field": "quantity",
        "expected": "5"
      }
    ]
  }
}'

Request body required

application/json

oneOf · Create 1

Describes an admitted job. The worker checks source compatibility after submission. Workbook mode requires an XLSX source and the PDF reader requires text_table. An incompatible source can receive a job ID and then a rejected result.

actionstring · constrequired

Fixed value: "create"

organization_idstring

format: uuid

dataset_idstring

format: uuid

idempotency_keystringrequired

minLength: 1 · maxLength: 128 · pattern: ^[A-Za-z0-9._:-]+$

sourceone ofrequired
Properties for source
oneOf · object 1
kindstring · constrequired

Fixed value: "inline"

filenamestringrequired

minLength: 1 · maxLength: 200

formatstring · enumrequired

Values: "csv", "tsv", "json", "jsonl", "xlsx", "pdf"

content_base64stringrequired

minLength: 4 · maxLength: 2796204

oneOf · object 2
kindstring · constrequired

Fixed value: "connector"

connector_idstringrequired

minLength: 1 · maxLength: 128 · pattern: ^[A-Za-z0-9._:-]+$

contractobjectrequired

Versioned mapping contract. Keys, filters, and sums reference declared output fields. Preserve IDs as strings and exact amounts as decimal strings.

Properties for contract
versionstringrequired

minLength: 1 · maxLength: 100

fieldsarray<Field>required

minItems: 1 · maxItems: 100

Item properties for fields
namestringrequired

pattern: ^[a-z][a-z0-9_]{0,62}$

typestring · enumrequired

Values: "string", "integer", "decimal", "date", "boolean"

sourcestring

minLength: 1 · maxLength: 200

constantstring

maxLength: 2000

nullableboolean
trimboolean
decimal_separatorstring · enum

Values: ".", ","

thousands_separatorstring · enum

Values: "", ",", ".", " "

oneOf · any 1

Required: source

oneOf · any 2

Required: constant

allOf · any 1

any

allOf · any 2

any

business_keysarray<string>

maxItems: 20

Item properties for business_keys

string

ignored_columnsarray<string>

maxItems: 100

Item properties for ignored_columns

string

controlsarray<TotalCheck>

maxItems: 100

Item properties for controls
fieldstringrequired

pattern: ^[a-z][a-z0-9_]{0,62}$

expectedstringrequired

maxLength: 100 · pattern: ^[+-]?\d+(?:\.\d+)?$

whereobject
tolerancestring

maxLength: 100 · pattern: ^\+?\d+(?:\.\d+)?$

aggregateobject
Properties for aggregate
group_byarray<string>required

maxItems: 20

Item properties for group_by

string

sumsarray<string>required

minItems: 1 · maxItems: 20

Item properties for sums

string

header_rowinteger

minimum: 1 · maximum: 1000

sheetstring

minLength: 1 · maxLength: 200

workbookobject

Workbook package mode for XLSX. Assign each actual sheet an explicit role, with at least one data sheet. Use either this option or sheet.

Properties for workbook
sheetsarray<WorkbookSheet>required

The engine checks unique sheet names and enforces a combined maximum of 100 inline and cell-based checks across the contract.

minItems: 1 · maxItems: 100

Item properties for sheets
oneOf · object 1

Map physical headings on this sheet to the common input headings used by the fields.

namestringrequired

minLength: 1 · maxLength: 200

rolestring · constrequired

Fixed value: "data"

header_rowinteger

minimum: 1 · maximum: 1000

columnsobject
oneOf · object 2
namestringrequired

minLength: 1 · maxLength: 200

rolestring · constrequired

Fixed value: "control"

checksarray<CellCheck>required

minItems: 1 · maxItems: 100

Item properties for checks
cellstringrequired

A literal workbook cell address within the first 100 columns (A through CV) and rows 1 through 1048576.

pattern: ^(?:[A-Z]|[AB][A-Z]|C[A-V])(?:[1-9][0-9]{0,5}|10(?:[0-3][0-9]{4}|4(?:[0-7][0-9]{3}|8(?:[0-4][0-9]{2}|5(?:[0-6][0-9]|7[0-6])))))$

fieldstringrequired

pattern: ^[a-z][a-z0-9_]{0,62}$

whereobject
tolerancestring

maxLength: 100 · pattern: ^\+?\d+(?:\.\d+)?$

oneOf · object 3
namestringrequired

minLength: 1 · maxLength: 200

rolestring · constrequired

Fixed value: "ignore"

reasonstringrequired

minLength: 1 · maxLength: 200

records_patharray<string>

maxItems: 10

Item properties for records_path

string

delimiterstring · enum

Values: ",", ";", "\t", "|"

text_tableobject
Properties for text_table
review_refstringrequired

minLength: 1 · maxLength: 200

separatorstringrequired

minLength: 1 · maxLength: 10

allOf · any 1

any

oneOf · Read 2
actionstring · constrequired

Fixed value: "read"

organization_idstring

format: uuid

job_idstringrequired

pattern: ^[a-f0-9]{64}$

oneOf · Artifact 3
actionstring · constrequired

Fixed value: "artifact"

organization_idstring

format: uuid

job_idstringrequired

pattern: ^[a-f0-9]{64}$

stagestring · enumrequired

Values: "bronze", "silver", "gold"

oneOf · Deliver 4
actionstring · constrequired

Fixed value: "deliver"

organization_idstring

format: uuid

job_idstringrequired

pattern: ^[a-f0-9]{64}$

destination_idstringrequired

minLength: 1 · maxLength: 128 · pattern: ^[A-Za-z0-9._:-]+$

gold_sha256stringrequired

pattern: ^[a-f0-9]{64}$

oneOf · Datasets 5
actionstring · constrequired

Fixed value: "datasets"

organization_idstringrequired

format: uuid

limitinteger

minimum: 1 · maximum: 50

afterstring

format: uuid

oneOf · Imports 6
actionstring · constrequired

Fixed value: "imports"

organization_idstringrequired

format: uuid

dataset_idstringrequired

format: uuid

limitinteger

minimum: 1 · maximum: 50

afterstring

pattern: ^[a-f0-9]{64}$

oneOf · Records 7
actionstring · constrequired

Fixed value: "records"

organization_idstringrequired

format: uuid

dataset_idstringrequired

format: uuid

job_idstringrequired

pattern: ^[a-f0-9]{64}$

limitinteger

minimum: 1 · maximum: 100

after_rowinteger

minimum: 0 · maximum: 10000

Request example
{
  "action": "create",
  "idempotency_key": "inventory-2026-12-v1",
  "source": {
    "kind": "inline",
    "format": "csv",
    "filename": "inventory.csv",
    "content_base64": "U0tVLFF0eQowMDEsMgowMDIsMwo="
  },
  "contract": {
    "version": "inventory-1",
    "fields": [
      {
        "name": "sku",
        "source": "SKU",
        "type": "string"
      },
      {
        "name": "quantity",
        "source": "Qty",
        "type": "integer"
      }
    ],
    "business_keys": [
      "sku"
    ],
    "controls": [
      {
        "field": "quantity",
        "expected": "5"
      }
    ]
  }
}

Responses

200The selected read, catalog query or delivery completed.

application/json

oneOf · Job 1
job_idstringrequired

pattern: ^[a-f0-9]{64}$

dataset_idstring

format: uuid

statusstring · enumrequired

Values: "queued", "held", "ready", "rejected"

engine_versionstring
source_sha256string

pattern: ^[a-f0-9]{64}$

contract_sha256string

SHA-256 of the validated, canonical contract including defaults. Version 2 workbook completion receipts include this field.

pattern: ^[a-f0-9]{64}$

silver_sha256string

pattern: ^[a-f0-9]{64}$

gold_sha256string | null

pattern: ^[a-f0-9]{64}$

issue_countinteger
issues_truncatedinteger
issuesarray<object>
Item properties for issues
codestringrequired
rowinteger
fieldstring
source_sheetstring
controlsarray<object>
Item properties for controls
fieldstringrequired
expectedstringrequired
actualstringrequired
passedbooleanrequired
source_sheetstring
source_cellstring
rows_readinteger
rows_outputinteger
allOf · any 1

any

oneOf · ArtifactResult 2
job_idstringrequired

pattern: ^[a-f0-9]{64}$

stagestring · enumrequired

Values: "bronze", "silver", "gold"

artifactobjectrequired

Bronze contains filename, format, source_sha256, and content_base64. Silver contains source-grain records. Gold contains the ready records and field types.

oneOf · CatalogPage 3
oneOf · object 1
datasetsarray<object>required
Item properties for datasets

object

next_afterstring | nullrequired
oneOf · object 2
importsarray<object>required
Item properties for imports

object

next_afterstring | nullrequired
oneOf · object 3
recordsarray<object>required
Item properties for records

object

next_afterinteger | nullrequired
oneOf · DeliveryResult 4
job_idstringrequired

pattern: ^[a-f0-9]{64}$

delivery_idstringrequired

pattern: ^[a-f0-9]{64}$

receiptobjectrequired
Properties for receipt
committedboolean · constrequired

Fixed value: true

rowsintegerrequired
202Create accepted. An identical replay can return an already completed result.

application/json

job_idstringrequired

pattern: ^[a-f0-9]{64}$

dataset_idstring

format: uuid

statusstring · enumrequired

Values: "queued", "held", "ready", "rejected"

engine_versionstring
source_sha256string

pattern: ^[a-f0-9]{64}$

contract_sha256string

SHA-256 of the validated, canonical contract including defaults. Version 2 workbook completion receipts include this field.

pattern: ^[a-f0-9]{64}$

silver_sha256string

pattern: ^[a-f0-9]{64}$

gold_sha256string | null

pattern: ^[a-f0-9]{64}$

issue_countinteger
issues_truncatedinteger
issuesarray<object>
Item properties for issues
codestringrequired
rowinteger
fieldstring
source_sheetstring
controlsarray<object>
Item properties for controls
fieldstringrequired
expectedstringrequired
actualstringrequired
passedbooleanrequired
source_sheetstring
source_cellstring
rows_readinteger
rows_outputinteger
allOf · any 1

any

400Invalid input, query, or source encoding.

application/json

errorstringrequired
401A valid credential is required.

application/json

errorstringrequired
403Access to the selected scope was denied.

application/json

errorstringrequired
404The scoped job or artifact could not be found.

application/json

errorstringrequired
409The selected version, idempotency key, or artifact conflicts with stored state.

application/json

errorstringrequired
413The request, source, or record exceeds its size limit.

application/json

errorstringrequired
429The caller reached the operation rate limit.

application/json

errorstringrequired
503The operation or its configured infrastructure is unavailable.

application/json

errorstringrequired

Full specification

Download the OpenAPI file for complete schemas, constraints, and examples.

Download ingestion.json
View operation source
json
{
  "summary": "Process private data",
  "operationId": "operateIngestion",
  "description": "Submit a versioned import, read private artifacts, browse organization datasets, or explicitly deliver one ready output. Standard authenticated MCP uses the same operations. Delegated OAuth excludes this tool.",
  "security": [
    {
      "apiKeyAuth": []
    },
    {
      "bearerAuth": []
    }
  ],
  "requestBody": {
    "required": true,
    "content": {
      "application/json": {
        "schema": {
          "oneOf": [
            {
              "$ref": "#/components/schemas/Create"
            },
            {
              "$ref": "#/components/schemas/Read"
            },
            {
              "$ref": "#/components/schemas/Artifact"
            },
            {
              "$ref": "#/components/schemas/Deliver"
            },
            {
              "$ref": "#/components/schemas/Datasets"
            },
            {
              "$ref": "#/components/schemas/Imports"
            },
            {
              "$ref": "#/components/schemas/Records"
            }
          ]
        },
        "example": {
          "action": "create",
          "idempotency_key": "inventory-2026-12-v1",
          "source": {
            "kind": "inline",
            "format": "csv",
            "filename": "inventory.csv",
            "content_base64": "U0tVLFF0eQowMDEsMgowMDIsMwo="
          },
          "contract": {
            "version": "inventory-1",
            "fields": [
              {
                "name": "sku",
                "source": "SKU",
                "type": "string"
              },
              {
                "name": "quantity",
                "source": "Qty",
                "type": "integer"
              }
            ],
            "business_keys": [
              "sku"
            ],
            "controls": [
              {
                "field": "quantity",
                "expected": "5"
              }
            ]
          }
        }
      }
    }
  },
  "responses": {
    "200": {
      "description": "The selected read, catalog query or delivery completed.",
      "content": {
        "application/json": {
          "schema": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/Job"
              },
              {
                "$ref": "#/components/schemas/ArtifactResult"
              },
              {
                "$ref": "#/components/schemas/CatalogPage"
              },
              {
                "$ref": "#/components/schemas/DeliveryResult"
              }
            ]
          }
        }
      }
    },
    "202": {
      "description": "Create accepted. An identical replay can return an already completed result.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Job"
          }
        }
      }
    },
    "400": {
      "description": "Invalid input, query, or source encoding.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "401": {
      "description": "A valid credential is required.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "403": {
      "description": "Access to the selected scope was denied.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "404": {
      "description": "The scoped job or artifact could not be found.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "409": {
      "description": "The selected version, idempotency key, or artifact conflicts with stored state.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "413": {
      "description": "The request, source, or record exceeds its size limit.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "429": {
      "description": "The caller reached the operation rate limit.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "503": {
      "description": "The operation or its configured infrastructure is unavailable.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    }
  }
}

Submit an import

Supply original bytes as base64 or name a source connector configured for your scope. Give the transformation contract a version. Declare the fields to map, types, business keys and any independent checks. The request example imports two inventory rows. It preserves SKU 001 as text and checks that the two quantities sum to five.

Create returns HTTP 202 with a job ID. Repeating the same request with the same idempotency key recovers its existing job. Use a new key for different bytes or mapping rules. Private source bytes are limited to 2 MiB, JSON request bodies to 3 MiB, and data to 10,000 rows and 100 columns.

CSV, TSV, JSON and JSONL accept explicit mappings. XLSX supports sheet selection. Native-text PDFs need a reviewed text layout and its literal separator. Read the resulting issues to identify files that need a different layout or exceed a reader’s limits.

Account for a whole workbook

The workbook option assigns every sheet its own role. Data sheets may rename headings into the common field vocabulary. Control sheets supply independently reported totals. Document the reason for ignoring an instructions sheet. This example checks a workbook whose East and West warehouses both contribute to the quantity in Summary cell B2.

json
{
  "version": "warehouse-inventory-1",
  "fields": [
    { "name": "sku", "source": "SKU", "type": "string" },
    { "name": "quantity", "source": "Qty", "type": "integer" }
  ],
  "workbook": {
    "sheets": [
      { "name": "East", "role": "data", "columns": { "Units shipped": "Qty" } },
      { "name": "West", "role": "data" },
      { "name": "Summary", "role": "control", "checks": [{ "cell": "B2", "field": "quantity" }] },
      { "name": "Instructions", "role": "ignore", "reason": "Operator instructions only" }
    ]
  }
}

Use workbook mode with an XLSX source. A single-sheet contract can continue selecting one worksheet by name. Use a literal numeric total for each control. A formula cell requires review. If a control filters by a unit or currency, it checks only the rows that match. Declare a check for every population whose total you need to verify. An import with an unresolved control difference has no deliverable output.

Review and deliver

The read action returns the job state. ready means the declared checks passed. Choose controls appropriate to the business decision. A correct sum alone cannot verify the account or the underlying metric. Download large artifacts over authenticated HTTP.

Deliver a ready job by passing the configured destination_id, job_id and the exact gold_sha256 you reviewed. A destination write and its receipt commit together. For organization jobs pass the same organization_id on every action. Authorized members can browse the organization’s versioned datasets and records through read an ingestion result.