Back to website Open portal

Available

JSON requests

One endpoint and one envelope for every request whose input is JSON rather than a document, with typeId selecting the type.

Updated 2026-10-14

POST https://app.docparser.dev/api/v1/json

Some requests have no document to read. Their input is JSON your system already holds, such as invoice lines to map onto your item master. Every type like this goes through one endpoint with one envelope, and typeId says which type it is. The envelope carries the fields every request shares, and payload carries the fields that belong to the type.

Integrate the envelope once and each new JSON type is a new typeId and a new payload. The URL, authentication, webhook delivery, retrieval and error format don’t change.

Endpoints

MethodPathAnswers
POST/api/v1/jsonAsync. 202 { jobId, consumerRefId, typeId, status }, then the result is POSTed to your webhook.
POST/api/v1/json/syncSync. 200 with the result in the body, no webhook. 502 with the error body when processing fails.
GET/api/v1/json/:typeId/:consumerRefIdThe latest job for that type and reference, in the same shape as the webhook body.

Authentication is the same as every other endpoint: the API key’s x-client-id and x-client-secret headers. See Authentication.

Use sync where a person is waiting on the screen and the payload is small. Requests are cut at 100 seconds, so use async for large payloads and batch work.

Supported types

typeIdTypepayload reference
101Item mapping: map supplier invoice lines onto your item master, with unit-of-measure conversionMap invoice items

A typeId not in this table is rejected with 400, and the message lists the supported types.

The envelope

Field Type Required Description
consumerRefId non-empty string Yes Your correlation reference, scoped to your organization. Sending the same value again for the same type replaces that job.
webhookUrl string No; defaults to "" Relative path joined to the API key’s registered base URL. Absolute URLs are rejected. Not used by /sync.
tags object No Up to 20 attribution labels such as the business the request is for, echoed on the result. See Tag requests.
typeId integer Yes Which JSON type this is. A numeric string such as "101" is accepted.
payload object Yes The type’s own fields, as documented on its reference page.
json
{
"consumerRefId": "run-8812-1791895778488",
"webhookUrl": "/webhook/docparser/<token>/json",
"tags": { "business": "acme-foods" },
"typeId": 101,
"payload": {
  "…": "the type's own fields"
}
}
json
{
"jobId": "2e68c6ae-d2d0-43d9-917c-12271653b3f6",
"consumerRefId": "run-8812-1791895778488",
"typeId": 101,
"status": "initiated"
}

Rules

Each of these is checked before any work starts, and breaking one is a 400:

  1. The envelope has exactly five keys: consumerRefId, webhookUrl, tags, typeId and payload. Any other top-level key is rejected, so a body whose type fields were never nested into payload fails with a clear error instead of half-working.
  2. Shared fields live at the top level only. consumerRefId, webhookUrl or tags inside payload is rejected with a message naming it, for example payload.tags: tags belongs at the top level of the request, not inside payload.
  3. payload is a JSON object and is validated against the type’s own schema.
  4. typeId is a supported type (see the table above).

Results and delivery

The result of a JSON type is the same whichever way you collect it: the webhook body, the sync response and the GET answer are identical. Every result carries status (processed or error), jobId, consumerRefId and typeId, plus tags when you sent some. The rest of the body is specific to the type and documented on its reference page.

An error result is { "status": "error", "jobId", "consumerRefId", "typeId", "error", "errorCode" }, plus the type’s own identifying fields.

Webhook delivery works as it does for documents: the result is POSTed to the API key’s registered base URL plus webhookUrl, and failed deliveries are retried. See Webhooks.

Dedicated routes

A type may also have its own URL that takes the same fields flat at the top level, for example /api/v1/item-mapping for type 101. Both URLs run the same processing and return identical results. For new integrations, use /api/v1/json, so that adding the next type needs no new client code.