Guest

You are exploring as a guest. Schemas save in this browser. Sign up free for API keys and to parse your own documents.

API Docs

REST and MCP for doc2json. Sign up to create an API key, then replace bk_live_... in the samples with your secret.

Authentication

Create a key on API Keys. The full secret is shown once. Later, the console shows the prefix. Send it on every REST and MCP call. These samples use bk_live_... where that secret goes. The key acts as the workspace it belongs to. A call that authenticates is listed in Activity and refreshes the key's last used time.
Authorization
Authorization: Bearer bk_live_...

REST

The base URL is https://doc2json.manoonlabs.com. POST and PATCH bodies are JSON objects with Content-Type: application/json. An unknown field returns 400, Unexpected field. A missing required field returns 400, Missing field. Invalid JSON returns 400, Request body must be JSON. GET routes read their input from the path. Delete a schema on Schemas. Create and revoke keys on API Keys. The Playground runs the same parse and returns the same JSON.
GET/api/v1/whoami

Identity

Return the workspace and token for this bearer key, and the credits left this month.

  • There is no request body.
  • credits_remaining is the credits left this month. It does not change the balance.
  • Use this to confirm a key before you parse.
GET /api/v1/whoami
curl -X GET https://doc2json.manoonlabs.com/api/v1/whoami \
  -H "Authorization: Bearer bk_live_..."
POST/api/v1/parse

Parse a document

Extract fields from a base64 PDF, PNG, or JPEG. The bytes are discarded after the request.

Request body (JSON)

KeyTypeRequiredDescription
documentstringYesStandard base64 of a PDF, PNG, or JPEG. Free workspaces allow 10 MB after decoding; paid workspaces allow 25 MB.
schemastring | objectNoThe name of a saved schema, or a schema definition used for this call only.
  • schema is optional. A string must be a schema saved in this workspace. An object is used for this call only. An unknown name, or an object that fails the schema rules, is rejected before it spends credits.
  • document is standard base64 of a PDF, PNG, or JPEG. Free workspaces allow 10 MB after decoding; paid workspaces allow 25 MB. The type is read from the file bytes. A missing or rejected document is turned away before it spends credits.
  • A configured model returns status "ok" and values, plus credits_used and credits_remaining. Dates inside values are yyyy-mm-dd. A value the model cannot find is null.
  • The workspace's plan sets a monthly credit allotment, shared by the API, MCP, and the Playground. One credit is one page: an image is 1 page and a PDF costs its page count. Each plan's allotment and pages per document are on the pricing page. A document over the pages per document limit returns 400 with pages and max_pages, and spends nothing. A 402 does not spend. A failed parse returns status "error", message, credits_used, and credits_remaining, and the 402 also includes credits_required and upgrade.
  • Each workspace may parse once per second. A second parse inside that second is 429, does not spend credits, and does not call the model. The 429 body includes retry_after. REST also sends Retry-After.
POST /api/v1/parse
curl -X POST https://doc2json.manoonlabs.com/api/v1/parse \
  -H "Authorization: Bearer bk_live_..." \
  -H "Content-Type: application/json" \
  -d '{
  "schema": "invoice",
  "document": "<base64 PDF, PNG, or JPEG>"
}'
GET/api/v1/schemas

List schemas

List the extraction schemas saved in this workspace.

  • There is no request body.
  • Each item has id, name, keyCount, createdAt, and updatedAt.
  • Read one schema when you need its definition.
  • schemas is an empty array when the workspace has none.
GET /api/v1/schemas
curl -X GET https://doc2json.manoonlabs.com/api/v1/schemas \
  -H "Authorization: Bearer bk_live_..."
GET/api/v1/schemas/{name}

Read a schema

Read one saved extraction schema by name.

  • The name is one path segment. URL-encode it. "invoice" is /api/v1/schemas/invoice.
  • The body adds schema, the definition, to the list fields.
  • A missing name returns 404 with status "error" and message "That schema was not found.".
GET /api/v1/schemas/invoice
curl -X GET https://doc2json.manoonlabs.com/api/v1/schemas/invoice \
  -H "Authorization: Bearer bk_live_..."
POST/api/v1/schemas

Create a schema

Save a named extraction schema in this workspace.

Request body (JSON)

KeyTypeRequiredDescription
namestringYesLowercase letters, digits, underscores, and hyphens, up to 80 characters.
schemaobjectYesThe schema definition. See Schema for the field types and limits.
  • Names use lowercase letters, digits, underscores, and hyphens, up to 80 characters. Spaces are not allowed.
  • 201 returns the saved schema, including its definition.
  • A duplicate name returns 409 with status "error" and message "A schema with that name already exists in this workspace.".
  • A Free workspace can save 3 saved schemas. A paid workspace can save 100. Past that, the status is 409.
POST /api/v1/schemas
curl -X POST https://doc2json.manoonlabs.com/api/v1/schemas \
  -H "Authorization: Bearer bk_live_..." \
  -H "Content-Type: application/json" \
  -d '{
  "name": "invoice",
  "schema": {
    "type": "object",
    "properties": {
      "vendor": {
        "type": "string"
      },
      "invoiceNumber": {
        "type": "string"
      },
      "issued": {
        "type": "date"
      },
      "total": {
        "type": "number"
      },
      "lineItems": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "description": {
              "type": "string"
            },
            "amount": {
              "type": "number"
            }
          },
          "required": [
            "description",
            "amount"
          ]
        }
      }
    },
    "required": [
      "vendor",
      "invoiceNumber",
      "total"
    ]
  }
}'
PATCH/api/v1/schemas/{name}

Update a schema

Rename a saved schema, replace its definition, or both.

Request body (JSON)

KeyTypeRequiredDescription
newNamestringOne ofThe new name, with the same rules as create. At most 80 characters.
schemaobjectOne ofThe new schema definition. It replaces the old one.
  • The path is the current name, URL-encoded as one segment.
  • Send newName, schema, or both. Sending neither returns 400.
  • 200 returns the schema after the change.
  • A new name that is already taken returns 409. A missing schema returns 404.
PATCH /api/v1/schemas/invoice
curl -X PATCH https://doc2json.manoonlabs.com/api/v1/schemas/invoice \
  -H "Authorization: Bearer bk_live_..." \
  -H "Content-Type: application/json" \
  -d '{
  "newName": "Invoice",
  "schema": {
    "type": "object",
    "properties": {
      "total": {
        "type": "number"
      }
    }
  }
}'

MCP

MCP is JSON-RPC 2.0 at POST https://doc2json.manoonlabs.com/mcp. It uses the same bearer token and the same operations as REST. Protocol 2025-06-18. The server name is doc2json. Tool arguments are the REST fields. Where REST reads {name} from the path, the argument is name.
initializepingtools/listtools/call

Argument checks fail as a JSON-RPC error, code -32602, on HTTP 200. That covers an unknown tool, an unexpected field, or a missing field. Once the operation runs, the HTTP status stays 200. isError is true when the operation fails, and result.content[0].text is the same JSON a REST call would return. A missing token is HTTP 401. Any method other than POST is HTTP 405. A notification with no id, such as notifications/initialized, returns HTTP 202 and an empty body.

tools/call
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "parse_document",
    "arguments": {
      "schema": "invoice",
      "document": "<base64 PDF, PNG, or JPEG>"
    }
  }
}

Connect a client

Point the client at the MCP URL and send the bearer token on every request.

  1. 1Create a key on API Keys and copy the secret.
  2. 2Add the config below. Cursor reads .cursor/mcp.json. Claude Code registers the HTTP server from a terminal.
  3. 3Call whoami to confirm the workspace, then parse_document with a document.
.cursor/mcp.json
{
  "mcpServers": {
    "doc2json": {
      "url": "https://doc2json.manoonlabs.com/mcp",
      "headers": {
        "Authorization": "Bearer bk_live_..."
      }
    }
  }
}

Schema format

A schema is an object with type: object and properties. Each property is a node with one of these types, plus an optional description the model reads with that field. array adds items, one node. object adds properties and may add required, the keys that must be present. A date is a string in yyyy-mm-dd. Keys start with a letter or underscore, then letters, digits, underscores, or hyphens.
anynullbooleanstringnumberdatearrayobject
  • Rootobject
  • Dateyyyy-mm-dd
  • Depth4 levels below the root
  • Keys100
  • Size16,384 bytes
  • Key length64 characters
  • Description400 characters, optional
  • Name length80 characters
  • Saved schemas3 on Free, 100 on paid plans
schema.json
{
  "type": "object",
  "properties": {
    "vendor": {
      "type": "string"
    },
    "invoiceNumber": {
      "type": "string"
    },
    "issued": {
      "type": "date"
    },
    "total": {
      "type": "number"
    },
    "lineItems": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "description": {
            "type": "string"
          },
          "amount": {
            "type": "number"
          }
        },
        "required": [
          "description",
          "amount"
        ]
      }
    }
  },
  "required": [
    "vendor",
    "invoiceNumber",
    "total"
  ]
}

Status codes

REST uses these statuses. The samples below are the error bodies you will see most often.
  • 200The call succeeded.
  • 201A schema was created.
  • 400A failed parse returns status "error", message, credits_used, and credits_remaining. Schema routes and whoami return status "error" and message naming the field or rule that failed, with no credit fields because they never spend credits. Their success bodies start with status "ok".
  • 401The bearer token is missing, unknown, revoked, or expired. The response body is empty, and the call is omitted from Activity.
  • 402The workspace does not have enough credits for this document. The body includes credits_required, credits_used, credits_remaining, and upgrade. A 402 does not spend. Allotments per plan are on the pricing page.
  • 403Parsing is paused for this workspace.
  • 404That schema was not found.
  • 405The HTTP method does not match the route. The response body is empty.
  • 409The schema name already exists, or the workspace is at its schema limit.
  • 429This workspace already parsed in the last second. Limit is 1 parse per second per workspace. The body includes retry_after. REST also sends Retry-After. A 429 does not spend credits.
  • 502The model could not extract the document. The body has status "error", message, credits_used 0 (the charge is refunded), and credits_remaining.
400 response.json
{
  "status": "error",
  "message": "Unknown schema: invoice",
  "credits_used": 0,
  "credits_remaining": 59
}