MainBook Developer API

The developer API from MainBook — 7 operation(s) for developer.

GitHub OpenAPI

Operations 9

GET /api/v1/developer/balance Get credit balance #
GET /api/v1/developer/jobs List jobs #
POST /api/v1/developer/jobs Create an upload job #
GET /api/v1/developer/jobs/{job_id} Get job status #
DELETE /api/v1/developer/jobs/{job_id} Delete a terminal job #
GET /api/v1/developer/jobs/{job_id}/result Download a completed result #
POST /api/v1/developer/jobs/{job_id}/result-ticket Create a one-use result download ticket #
POST /api/v1/developer/jobs/{job_id}/start Validate the upload and start processing #
GET /api/v1/developer/results/{ticket} Redeem a one-use result download ticket #

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/mainbook-ai:mainbook-ai-developer-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. By signing up you are subscribing to the APIs.io and API Evangelist newsletters — you can unsubscribe from any issue. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

mainbook-ai-developer-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: MainBook Developer API
  version: 1.0.0
  description: 'Public API for creating MainBook conversion jobs, uploading statements, polling status, and downloading structured results.


    **Call this API from your server, not from a browser.** Requests from web pages are refused: the allowed-origin list does not include third-party sites, so a browser call fails as an opaque network error while the same call from a server succeeds. That is deliberate — an API key placed in browser JavaScript is readable by every visitor of your site. Keep the key on your backend and have it talk to us.


    The presigned upload URL returned by `POST /jobs` is the one exception in spirit: it carries its own signature and no MainBook key. Send the returned `upload.headers` back verbatim — the signature covers them.'
servers:
- url: https://api.mainbook.ai
tags:
- name: developer
paths:
  /api/v1/developer/balance:
    get:
      operationId: developer_balance_retrieve
      description: Return total, currently reserved, and spendable page credits.
      summary: Get credit balance
      tags:
      - developer
      security:
      - ApiKeyAuth: []
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DeveloperBalance'
          description: ''
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DeveloperAuthError'
          description: ''
        '403':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DeveloperError'
          description: '`api_terms_not_accepted` or an account permission failure.'
        '429':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DeveloperError'
          description: '`rate_limited`; retry after the `Retry-After` delay.'
  /api/v1/developer/jobs:
    get:
      operationId: developer_jobs_list
      description: List all statement jobs visible to the account, including jobs created in the web app. Uses cursor pagination; poll every 3–5 seconds.
      summary: List jobs
      tags:
      - developer
      security:
      - ApiKeyAuth: []
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DeveloperJobsPage'
          description: ''
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DeveloperAuthError'
          description: ''
        '403':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DeveloperError'
          description: '`api_terms_not_accepted` or an account permission failure.'
        '429':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DeveloperError'
          description: '`rate_limited`; retry after the `Retry-After` delay.'
    post:
      operationId: developer_jobs_create
      description: Reserve page credits and obtain presigned PUT instructions. Send every returned upload header verbatim. The upload and hold expire after about 15 minutes; idempotency keys have no TTL in v1.
      summary: Create an upload job
      parameters:
      - in: header
        name: Idempotency-Key
        schema:
          type: string
        description: Optional per-principal replay key (maximum 255 characters). Reusing it with a different body returns `idempotency_conflict`.
      tags:
      - developer
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateJobRequest'
        required: true
      security:
      - ApiKeyAuth: []
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DeveloperCreateJobResponse'
          description: Idempotent replay of the original job.
        '201':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DeveloperCreateJobResponse'
          description: Job created, credits reserved, and upload instructions issued.
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DeveloperError'
          description: '`invalid_request`: malformed metadata or public limit exceeded.'
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DeveloperAuthError'
          description: ''
        '402':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DeveloperError'
          description: '`insufficient_credits` or `account_suspended`.'
        '403':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DeveloperError'
          description: '`api_terms_not_accepted` or an account permission failure.'
        '409':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DeveloperError'
          description: '`idempotency_conflict`: the key belongs to another request body.'
        '429':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DeveloperError'
          description: '`rate_limited`; retry after the `Retry-After` delay.'
        '503':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DeveloperError'
          description: '`engine_paused` while the global processing backstop is active.'
  /api/v1/developer/jobs/{job_id}:
    get:
      operationId: developer_job_retrieve
      description: Return the stable public state machine. Terminal success states include the math-validation block. Poll every 3–5 seconds.
      summary: Get job status
      parameters:
      - in: path
        name: job_id
        schema:
          type: string
        required: true
      tags:
      - developer
      security:
      - ApiKeyAuth: []
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DeveloperJob'
          description: ''
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DeveloperAuthError'
          description: ''
        '403':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DeveloperError'
          description: '`api_terms_not_accepted` or an account permission failure.'
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DeveloperError'
          description: '`not_found`: unknown, foreign, or deleted job.'
        '429':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DeveloperError'
          description: '`rate_limited`; retry after the `Retry-After` delay.'
    delete:
      operationId: developer_job_delete
      description: Soft-delete a terminal job and remove it from future list/detail access. In-flight jobs cannot be cancelled in v1.
      summary: Delete a terminal job
      parameters:
      - in: path
        name: job_id
        schema:
          type: string
        required: true
      tags:
      - developer
      security:
      - ApiKeyAuth: []
      responses:
        '204':
          description: Terminal job deleted; no response body.
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DeveloperAuthError'
          description: ''
        '403':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DeveloperError'
          description: '`api_terms_not_accepted` or an account permission failure.'
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DeveloperError'
          description: '`not_found`: unknown, foreign, or already deleted job.'
        '409':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DeveloperError'
          description: '`job_not_terminal`: wait for a terminal state before deleting.'
  /api/v1/developer/jobs/{job_id}/result:
    get:
      operationId: developer_job_result
      description: JSON is returned inline. XLSX and CSV are binary file attachments. The query parameter is named `type`; do not use DRF's reserved `format` name.
      summary: Download a completed result
      parameters:
      - in: path
        name: job_id
        schema:
          type: string
        required: true
      - in: query
        name: type
        schema:
          type: string
          enum:
          - csv
          - json
          - xlsx
        description: 'Result representation: `xlsx`, `csv`, or `json`.'
        required: true
      tags:
      - developer
      security:
      - ApiKeyAuth: []
      responses:
        '200':
          content:
            application/json:
              schema:
                type: object
                additionalProperties: {}
            application/vnd.openxmlformats-officedocument.spreadsheetml.sheet:
              schema:
                type: string
                format: binary
            text/csv:
              schema:
                type: string
                format: binary
          description: Structured conversion data returned inline.
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DeveloperError'
          description: '`invalid_request`: unsupported or missing `type`.'
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DeveloperAuthError'
          description: ''
        '403':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DeveloperError'
          description: '`api_terms_not_accepted` or an account permission failure.'
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DeveloperError'
          description: '`not_found`: unknown, foreign, or deleted job.'
        '409':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DeveloperError'
          description: '`job_not_terminal`: result is not available yet.'
        '429':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DeveloperError'
          description: '`rate_limited`; retry after the `Retry-After` delay.'
  /api/v1/developer/jobs/{job_id}/result-ticket:
    post:
      operationId: developer_result_ticket_issue
      description: POST a ten-minute ticket for one completed XLSX/CSV result.
      summary: Create a one-use result download ticket
      parameters:
      - in: path
        name: job_id
        schema:
          type: string
        required: true
      tags:
      - developer
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DeveloperResultTicketRequestRequest'
        required: true
      security:
      - ApiKeyAuth: []
      responses:
        '201':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DeveloperResultTicketResponse'
          description: ''
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DeveloperError'
          description: ''
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DeveloperAuthError'
          description: ''
        '403':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DeveloperError'
          description: '`api_terms_not_accepted` or an account permission failure.'
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DeveloperError'
          description: ''
        '409':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DeveloperError'
          description: ''
  /api/v1/developer/jobs/{job_id}/start:
    post:
      operationId: developer_job_start
      description: 'Call after the presigned PUT completes. Safe to retry after a timeout: an already-started job returns its current public resource without enqueueing twice.'
      summary: Validate the upload and start processing
      parameters:
      - in: path
        name: job_id
        schema:
          type: string
        required: true
      tags:
      - developer
      security:
      - ApiKeyAuth: []
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DeveloperJob'
          description: ''
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DeveloperError'
          description: '`invalid_request`: invalid body or uploaded file.'
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DeveloperAuthError'
          description: ''
        '402':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DeveloperError'
          description: '`insufficient_credits` or `account_suspended`.'
        '403':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DeveloperError'
          description: '`api_terms_not_accepted` or an account permission failure.'
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DeveloperError'
          description: '`not_found`: unknown, foreign, or deleted job.'
        '409':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DeveloperError'
          description: '`job_expired`: create a new upload job; `job_not_terminal`: the insufficient-credit recovery cannot be started in its current state.'
        '429':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DeveloperError'
          description: '`concurrency_limit`: wait for an active job to finish; response includes `Retry-After`.'
        '503':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DeveloperError'
          description: '`engine_paused` or `storage_unavailable`.'
  /api/v1/developer/results/{ticket}:
    get:
      operationId: developer_result_ticket_redeem
      description: GET one file without headers; the ticket grants no other authority.
      summary: Redeem a one-use result download ticket
      parameters:
      - in: path
        name: ticket
        schema:
          type: string
        required: true
      tags:
      - developer
      responses:
        '200':
          content:
            application/vnd.openxmlformats-officedocument.spreadsheetml.sheet:
              schema:
                type: string
                format: binary
            text/csv:
              schema:
                type: string
                format: binary
          description: XLSX attachment.
        '404':
          description: Opaque invalid-ticket failure.
        '429':
          description: Client-IP rate limit exceeded.
components:
  schemas:
    DeveloperResultTicketRequestRequest:
      type: object
      description: Contract 4 issue body; JSON is deliberately not a supported ticket format.
      properties:
        format:
          $ref: '#/components/schemas/FormatEnum'
      required:
      - format
    SourceEnum:
      enum:
      - web
      - api
      type: string
      description: '* `web` - web

        * `api` - api'
    FileFormatEnum:
      enum:
      - pdf
      type: string
      description: '* `pdf` - pdf'
    MethodEnum:
      enum:
      - PUT
      type: string
      description: '* `PUT` - PUT'
    DeveloperBalance:
      type: object
      description: Shared-wallet credit balance in pages.
      properties:
        balance:
          type: integer
        reserved:
          type: integer
          minimum: 0
        available:
          type: integer
      required:
      - available
      - balance
      - reserved
    DeveloperJobsPage:
      type: object
      description: Cursor page returned by GET /developer/jobs.
      properties:
        results:
          type: array
          items:
            $ref: '#/components/schemas/DeveloperJob'
        next:
          type:
          - string
          - 'null'
          format: uri
        previous:
          type:
          - string
          - 'null'
          format: uri
      required:
      - next
      - previous
      - results
    FormatEnum:
      enum:
      - xlsx
      - csv
      type: string
      description: '* `xlsx` - xlsx

        * `csv` - csv'
    CreateJobRequest:
      type: object
      description: Public v1 create body; every field is required by FileMeta.
      properties:
        filename:
          type: string
          minLength: 1
          maxLength: 255
        file_format:
          type: string
          minLength: 1
          maxLength: 8
        size_bytes:
          type: integer
          minimum: 1
        page_count:
          type: integer
          minimum: 1
      required:
      - file_format
      - filename
      - page_count
      - size_bytes
    DeveloperCreateJobResponse:
      type: object
      description: Create/replay response; upload is null after the upload window closes.
      properties:
        job_id:
          type: string
          format: uuid
        upload:
          allOf:
          - $ref: '#/components/schemas/DeveloperUpload'
        credits_reserved:
          type: integer
          minimum: 0
      required:
      - credits_reserved
      - job_id
      - upload
    DeveloperError:
      type: object
      description: Shared machine-readable error envelope from spec §5.6.
      properties:
        reason:
          type: string
          description: Stable machine-readable reason code; branch on this field.
        detail:
          type: string
        available:
          type: integer
        requested:
          type: integer
        hint:
          type: string
        state:
          $ref: '#/components/schemas/StateEnum'
        supported:
          type: array
          items:
            type: string
        errors: {}
        size_bytes:
          type: integer
        limit:
          type: integer
      required:
      - reason
    DeveloperUpload:
      type: object
      description: Presigned PUT instructions returned by job creation.
      properties:
        url:
          type: string
          format: uri
        method:
          $ref: '#/components/schemas/MethodEnum'
        headers:
          type: object
          additionalProperties:
            type: string
        expires_at:
          type: string
          format: date-time
      required:
      - expires_at
      - headers
      - method
      - url
    StateEnum:
      enum:
      - awaiting_upload
      - queued
      - processing
      - succeeded
      - succeeded_with_warnings
      - insufficient_credits
      - failed
      - expired
      type: string
      description: '* `awaiting_upload` - awaiting_upload

        * `queued` - queued

        * `processing` - processing

        * `succeeded` - succeeded

        * `succeeded_with_warnings` - succeeded_with_warnings

        * `insufficient_credits` - insufficient_credits

        * `failed` - failed

        * `expired` - expired'
    DeveloperJobError:
      type: object
      description: Persisted processing failure details for a failed job.
      properties:
        category:
          type:
          - string
          - 'null'
        reason:
          type:
          - string
          - 'null'
      required:
      - category
      - reason
    DeveloperResultTicketResponse:
      type: object
      description: Cleartext ticket is returned exactly once with its browser-ready URL.
      properties:
        ticket:
          type: string
        url:
          type: string
          format: uri
        expires_at:
          type: string
          format: date-time
      required:
      - expires_at
      - ticket
      - url
    DeveloperAuthError:
      type: object
      description: Intentional DRF 401 duality retained by spec §5.6.
      properties:
        detail:
          type: string
          description: Always `invalid_key` for API-key failures.
      required:
      - detail
    DeveloperJob:
      type: object
      description: Stable public polling resource from spec §5.4.
      properties:
        job_id:
          type: string
          format: uuid
        state:
          $ref: '#/components/schemas/StateEnum'
        filename:
          type: string
        file_format:
          $ref: '#/components/schemas/FileFormatEnum'
        pages:
          type: integer
          minimum: 1
        credits_reserved:
          type:
          - integer
          - 'null'
          minimum: 1
        source:
          $ref: '#/components/schemas/SourceEnum'
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
        validation:
          allOf:
          - $ref: '#/components/schemas/DeveloperJobValidation'
        error:
          allOf:
          - $ref: '#/components/schemas/DeveloperJobError'
      required:
      - created_at
      - credits_reserved
      - error
      - file_format
      - filename
      - job_id
      - pages
      - source
      - state
      - updated_at
      - validation
    DeveloperJobValidation:
      type: object
      description: 'Math-validation signal present on terminal success jobs (spec §5.4).


        The three fields answer three different questions and are routinely confused,

        so each one says so in the public schema rather than leaving a caller to guess

        from a bare boolean.'
      properties:
        reconcilable:
          type:
          - boolean
          - 'null'
          description: Whether this statement carried the anchors a balance check needs — both debit and credit sides, and an opening and closing figure. `false` means the document itself gave us nothing to check against, not that a check failed. `null` means no verdict was produced. Checking, savings and credit-card statements are all eligible; whether an individual document qualifies depends on what it prints.
        passed:
          type: boolean
          description: 'Whether the conversion finished without warnings. Read it together with `reconcilable`: passing while `reconcilable` is false means nothing was off, not that the arithmetic was confirmed.'
        mismatched_rows:
          type: integer
          minimum: 0
          description: Rows whose own arithmetic did not line up and that a human should look at.
      required:
      - mismatched_rows
      - passed
      - reconcilable
  securitySchemes:
    ApiKeyAuth:
      type: http
      scheme: bearer
      description: 'API key `mb_live_…` in the Authorization header: `Authorization: Bearer mb_live_…`. Created in Settings → API.'