PDF2MD v2 Jobs API
v2 (EP-023): jobs for agents/integrations (API key or session)
v2 (EP-023): jobs for agents/integrations (API key or session)
Every API here is available over the APIs.io API and to AI agents over MCP.
One button, every client — Claude, Cursor, VS Code and the rest.
https://apis.io/mcp
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.curl "https://apis.io/api/v1/apis/pdf2md-dev:pdf2md-dev-v2-jobs-api"
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.
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: 3.2.0
info:
title: PDF to Markdown API Facade v2 Jobs API
version: 2.1.1
description: 'API facade for the PDF → Markdown Chrome extension. Core logic for the queue and result delivery,
device identification via a WebCrypto keypair + device_token, signed requests (see docs/security.md).
v2.0.0 (EP-023): additively introduced `/api/v2/*` endpoints for accounts, API keys, hosted MCP, and
paid tiers. Authentication for `/api/v2/*` — `Authorization: Bearer p2m_...` (API key, over TLS, without
an ES256 signature) OR an OAuth session (extension/web). See docs/v2.0.0-roadmap.md §6-7, docs/security.md.
BACKWARD COMPATIBILITY (hard invariant): all v1 paths (`/register`, `/jobs`, `/jobs/{id}`,
`/jobs/{id}/download`, `/settings`) and their schemas do NOT change — the old and new extensions work
simultaneously against backend 2.0.0 without errors (docs/v2.0.0-roadmap.md §6.9).'
servers:
- url: https://pdf2md.dev
description: 'Production — PRIMARY origin (EP-024, promoted). v1 at root (/register, /jobs, …); v2 under /api/v2/*. The API is served identically on both production domains; OAuth redirect_uri and billing return URLs follow the request origin (allow-list PUBLIC_ORIGINS), so the OAuth callback host matches whichever domain you start on.
'
- url: https://pdf2md.huskyhaul.online
description: Production — alternative origin (kept for the v1 extension). Same API surface.
- url: http://localhost:8080
description: Local docker nginx (same routing — v1 root + /api/v2/*)
security:
- DeviceToken: []
tags:
- name: v2 Jobs
description: 'v2 (EP-023): jobs for agents/integrations (API key or session)'
paths:
/api/v2/jobs:
post:
tags:
- v2 Jobs
summary: Create a job (upload or URL)
description: 'EP-023-T3 (implemented). In v2.0.0, creating a job requires an API key (scope jobs:create; owner_type=api_key) — there is no web UI for creating jobs, and a session actor gets 403. Idempotency-Key is optional: a repeat with the same key within the account returns the same job (200), without duplicating it.'
security:
- ApiKey: []
parameters:
- $ref: '#/components/parameters/IdempotencyKey'
requestBody:
required: true
content:
multipart/form-data:
schema:
$ref: '#/components/schemas/V2CreateJobFromFileRequest'
application/json:
schema:
$ref: '#/components/schemas/V2CreateJobFromUrlRequest'
responses:
'200':
description: Idempotent repeat — existing job (same Idempotency-Key)
content:
application/json:
schema:
$ref: '#/components/schemas/V2Job'
'201':
description: Created
content:
application/json:
schema:
$ref: '#/components/schemas/V2Job'
'400':
$ref: '#/components/responses/V2BadRequest'
'401':
$ref: '#/components/responses/V2Unauthorized'
'403':
description: API key required / no jobs:create scope
content:
application/json:
schema:
$ref: '#/components/schemas/V2Error'
'409':
description: 'slots_full — all slots are in use (clears as jobs finish) | quota_exceeded — the monthly page allowance is spent (clears on the 1st). EP-070-T7: the quota body also carries `used`, `limit` and `reset_at` (RFC3339, start of the next UTC month) so a client can say which limit and when, in its own language. 409 rather than 429 on purpose: 429 renders as "retry in a moment", which is wrong for something that returns next month.'
content:
application/json:
schema:
$ref: '#/components/schemas/V2Error'
'413':
$ref: '#/components/responses/V2TooLarge'
'429':
$ref: '#/components/responses/V2RateLimited'
operationId: postApiV2Jobs
x-operation-id-source: derived
get:
tags:
- v2 Jobs
summary: List the actor's jobs
security:
- ApiKey: []
- Session: []
parameters:
- name: status
in: query
required: false
schema:
$ref: '#/components/schemas/JobStatus'
responses:
'200':
description: List
content:
application/json:
schema:
type: object
required:
- items
properties:
items:
type: array
items:
$ref: '#/components/schemas/V2Job'
'401':
$ref: '#/components/responses/V2Unauthorized'
operationId: getApiV2Jobs
x-operation-id-source: derived
/api/v2/jobs/batch:
post:
tags:
- v2 Jobs
summary: Batch create (≤ the number of free slots)
description: 'EP-023-T3 (implemented). API key + jobs:create. URL-only. Atomicity — all-or-nothing: if the number of items > free slots → 409 slots_full (nothing is created); on an error in any item the whole batch is rolled back.'
security:
- ApiKey: []
parameters:
- $ref: '#/components/parameters/IdempotencyKey'
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/V2BatchCreateRequest'
responses:
'201':
description: Created
content:
application/json:
schema:
type: object
required:
- items
properties:
items:
type: array
items:
$ref: '#/components/schemas/V2Job'
'401':
$ref: '#/components/responses/V2Unauthorized'
'409':
description: slots_full — the batch exceeds free slots | quota_exceeded — the monthly page allowance is spent (see POST /jobs)
content:
application/json:
schema:
$ref: '#/components/schemas/V2Error'
'429':
$ref: '#/components/responses/V2RateLimited'
operationId: postApiV2JobsBatch
x-operation-id-source: derived
/api/v2/jobs/upload-ticket:
post:
tags:
- v2 Jobs
summary: Mint a paid upload ticket (device-signed)
description: EP-048. Device-signed (ES256). A linked, paid device mints a one-time, short-TTL ticket bound server-side to {device, account, tier, byte cap}, then streams a tier-sized file to POST /api/v2/jobs/upload. This lets the web app and the extension upload files larger than the free/v1 10 MB limit, which the body-hashed v1 /jobs cannot stream. Returns eligible=false (200) for an anonymous/unlinked device or a tier at or below the free limit, so the client stays on v1 /jobs.
security:
- DeviceToken: []
responses:
'200':
description: Ticket (eligible=true) or not eligible (eligible=false)
content:
application/json:
schema:
$ref: '#/components/schemas/V2UploadTicket'
'401':
$ref: '#/components/responses/V2Unauthorized'
'429':
$ref: '#/components/responses/V2RateLimited'
operationId: postApiV2JobsUploadTicket
x-operation-id-source: derived
/api/v2/jobs/upload:
post:
tags:
- v2 Jobs
summary: Streamed upload with a ticket (paid UI upload)
description: 'EP-048. Authenticated ONLY by a one-time Upload-Ticket header obtained from POST /api/v2/jobs/upload-ticket (no per-body ES256 signature, which is why this lane can STREAM, unlike v1 /jobs). Enforced at the ticket''s per-tier byte cap; creates an owner_type=account_device job for the ticket''s account. Single-use: the ticket is consumed on arrival.'
security:
- UploadTicket: []
requestBody:
required: true
content:
multipart/form-data:
schema:
$ref: '#/components/schemas/V2CreateJobFromFileRequest'
responses:
'200':
description: Idempotent repeat — existing job (same Idempotency-Key)
content:
application/json:
schema:
$ref: '#/components/schemas/V2Job'
'201':
description: Created
content:
application/json:
schema:
$ref: '#/components/schemas/V2Job'
'400':
$ref: '#/components/responses/V2BadRequest'
'401':
description: Missing, invalid, expired, or already-used upload ticket
content:
application/json:
schema:
$ref: '#/components/schemas/V2Error'
'409':
description: 'slots_full — all slots are in use (clears as jobs finish) | quota_exceeded — the monthly page allowance is spent (clears on the 1st). EP-070-T7: the quota body also carries `used`, `limit` and `reset_at` (RFC3339, start of the next UTC month) so a client can say which limit and when, in its own language. 409 rather than 429 on purpose: 429 renders as "retry in a moment", which is wrong for something that returns next month.'
content:
application/json:
schema:
$ref: '#/components/schemas/V2Error'
'413':
$ref: '#/components/responses/V2TooLarge'
operationId: postApiV2JobsUpload
x-operation-id-source: derived
/api/v2/jobs/{jobId}:
get:
tags:
- v2 Jobs
summary: Job status
security:
- ApiKey: []
- Session: []
parameters:
- $ref: '#/components/parameters/JobId'
responses:
'200':
description: Job
content:
application/json:
schema:
$ref: '#/components/schemas/V2Job'
'401':
$ref: '#/components/responses/V2Unauthorized'
'404':
$ref: '#/components/responses/V2NotFound'
operationId: getApiV2JobsByJobId
x-operation-id-source: derived
delete:
tags:
- v2 Jobs
summary: Delete/cancel a job
security:
- ApiKey: []
- Session: []
parameters:
- $ref: '#/components/parameters/JobId'
responses:
'200':
description: Deleted/canceled
content:
application/json:
schema:
$ref: '#/components/schemas/V2Job'
'401':
$ref: '#/components/responses/V2Unauthorized'
'404':
$ref: '#/components/responses/V2NotFound'
operationId: deleteApiV2JobsByJobId
x-operation-id-source: derived
/api/v2/jobs/{jobId}/download:
get:
tags:
- v2 Jobs
summary: Download Markdown (ready only)
security:
- ApiKey: []
- Session: []
parameters:
- $ref: '#/components/parameters/JobId'
responses:
'200':
description: Markdown
content:
text/markdown:
schema:
type: string
'401':
$ref: '#/components/responses/V2Unauthorized'
'404':
$ref: '#/components/responses/V2NotFound'
'409':
description: Not yet ready (not_ready)
content:
application/json:
schema:
$ref: '#/components/schemas/V2Error'
'410':
description: Deleted by TTL (gone)
content:
application/json:
schema:
$ref: '#/components/schemas/V2Error'
operationId: getApiV2JobsByJobIdDownload
x-operation-id-source: derived
components:
schemas:
OCRLang:
type: string
description: 'OCR language hint (EP-070, additive). Selects the OCR recognition model for
scanned pages / forced OCR in BOTH engines (MinerU maps ja→japan, ko→korean and
es/pt/de/fr→latin; docling builds a per-request EasyOCR list <lang>+en).
Only affects OCR: PDFs with a digital text layer are extracted, not
recognized, and ignore this hint. Absent → the engine''s env default
(current ru+en behavior). The stable code ru selects the Cyrillic OCR model.
Unknown values are rejected with 400.
'
enum:
- ru
- en
- ja
- ko
- es
- pt
- de
- fr
V2CreateJobFromFileRequest:
type: object
required:
- file
properties:
file:
type: string
format: binary
file_name:
type: string
maxLength: 255
options:
$ref: '#/components/schemas/V2JobOptions'
external_id:
type: string
callback_url:
type: string
format: uri
description: v2 §6.8 per-job callback (optional, paid-gated, https/public)
callback_secret:
type: string
description: secret for X-P2M-Signature of the per-job callback
JobStatus:
type: string
description: Job status
enum:
- queued
- processing
- ready
- error
- canceled
- deleted
Engine:
type: string
description: 'Conversion engine (EP-015). Both engine containers are running; at most one is
resident (single-resident, EP-016). The old extension does not send this field →
the backend uses the default. EP-016: default `mineru` (reliable on scans/Cyrillic);
changed via env DEFAULT_ENGINE. `docling` — optional for simple PDFs.
'
enum:
- docling
- mineru
default: mineru
V2JobOptions:
type: object
description: Per-job conversion options (additive, like v1 device_settings). Applied by the v2 create endpoints (EP-026); each unset field falls back to the server default. Unlike v1 (which copies the device's stored /settings at create), v2 API jobs are deviceless, so options are passed per request here.
properties:
image_mode:
$ref: '#/components/schemas/ImageMode'
ocr_enabled:
type: boolean
engine:
$ref: '#/components/schemas/Engine'
conversion_mode:
$ref: '#/components/schemas/ConversionMode'
ocr_lang:
$ref: '#/components/schemas/OCRLang'
ImageMode:
type: string
description: Image handling mode in Markdown
enum:
- embedded
- placeholder
default: embedded
V2Job:
type: object
required:
- job_id
- status
- file_name
- created_at
- tier
properties:
job_id:
type: string
format: uuid
status:
$ref: '#/components/schemas/JobStatus'
file_name:
type: string
created_at:
type: string
format: date-time
status_since:
type: string
format: date-time
pages:
type: integer
nullable: true
truncated:
type: boolean
default: false
output_size:
type: integer
format: int64
nullable: true
download_url:
type: string
format: uri
nullable: true
description: populated for ready
tier:
$ref: '#/components/schemas/V2Tier'
slot_usage:
type: object
properties:
used:
type: integer
limit:
type: integer
external_id:
type: string
nullable: true
tags:
type: object
nullable: true
additionalProperties: true
V2BatchCreateRequest:
type: object
required:
- items
properties:
items:
type: array
minItems: 1
description: ≤ the number of the actor's free slots; otherwise 409 slots_full (batch does not bypass the slot limit, §4)
items:
$ref: '#/components/schemas/V2CreateJobFromUrlRequest'
V2Tier:
type: string
enum:
- anonymous
- free
- lifetime
- builder
- pro
- business
- enterprise
description: 'EP-069: `lifetime` is the one-time unlock, ranked BETWEEN free and builder — it raises the interactive limits and carries 600 pages/month, but grants no API keys, hosted MCP, webhooks or batch, so a subscription is genuinely more and its holder may still buy one.
'
ConversionMode:
type: string
description: 'Conversion mode / fast-path (EP-014). `simple` — the lightweight docling pipeline,
`auto` — autodetect + fallback to full, `full` — the full pipeline.
Backward compatibility: when the field is absent the backend uses `full`
(behavior identical to before). The new extension''s UI defaults to `auto`.
'
enum:
- simple
- auto
- full
default: full
V2CreateJobFromUrlRequest:
type: object
required:
- url
properties:
url:
type: string
format: uri
file_name:
type: string
maxLength: 255
options:
$ref: '#/components/schemas/V2JobOptions'
external_id:
type: string
tags:
type: object
additionalProperties: true
callback_url:
type: string
format: uri
description: v2 §6.8 per-job callback (optional)
callback_secret:
type: string
description: secret for signing the per-job callback
V2Error:
type: object
required:
- code
- message
properties:
code:
type: string
description: 'v2 codes: validation_error, unauthorized, forbidden, not_found, slots_full, rate_limited, not_ready, gone, idempotency_conflict, active_subscription, checkout_in_progress, quota_exceeded, file_too_large'
example: rate_limited
message:
type: string
reason:
type: string
description: 'EP-065-T8. Machine-readable sub-case, currently only on 409 active_subscription from /billing/checkout: same_plan | downgrade | shorter_interval | current_interval_unknown. Lets a localized client render its own wording instead of the English `message`. ABSENT for an anonymous caller by design — the per-case detail is what made the endpoint answer "does this address pay us" (EP-064-T7). Additive and optional: clients that ignore it keep working.
'
enum:
- same_plan
- downgrade
- shorter_interval
- current_interval_unknown
used:
type: integer
format: int64
description: 'EP-070-T7: on 409 quota_exceeded — pages already spent this month.'
limit:
type: integer
description: 'EP-070-T7: on 409 quota_exceeded — the monthly allowance that was reached.'
reset_at:
type: string
format: date-time
description: 'EP-070-T7: on 409 quota_exceeded — when the allowance returns (start of the next UTC calendar month, the exact boundary the counter rolls over on). Computed server-side so a client never guesses our timezone.'
V2UploadTicket:
type: object
description: 'EP-048: response of device-signed POST /api/v2/jobs/upload-ticket.'
required:
- eligible
- max_file_size_bytes
- tier
properties:
eligible:
type: boolean
description: true when a paid ticket was minted; false when the device is anonymous/unlinked or at/below the free limit (client uses v1 /jobs)
ticket:
type: string
description: one-time ticket for the Upload-Ticket header (present only when eligible)
max_file_size_bytes:
type: integer
description: the byte cap enforced by the upload (tier limit when eligible, else the free limit)
tier:
type: string
description: the account's tier (or 'anonymous' when unlinked)
expires_in_sec:
type: integer
description: ticket TTL in seconds (present only when eligible)
responses:
V2TooLarge:
description: File exceeds the tier limit (max_file_size)
content:
application/json:
schema:
$ref: '#/components/schemas/V2Error'
V2NotFound:
description: Not found or no access (ownership)
content:
application/json:
schema:
$ref: '#/components/schemas/V2Error'
V2BadRequest:
description: Invalid data (not a PDF, no url/file, broken link)
content:
application/json:
schema:
$ref: '#/components/schemas/V2Error'
V2Unauthorized:
description: Missing/invalid API key or session
content:
application/json:
schema:
$ref: '#/components/schemas/V2Error'
V2RateLimited:
description: Rate limit exceeded
headers:
Retry-After:
description: Seconds until retry
schema:
type: integer
content:
application/json:
schema:
$ref: '#/components/schemas/V2Error'
parameters:
JobId:
name: jobId
in: path
required: true
description: Job identifier (UUID)
schema:
type: string
format: uuid
IdempotencyKey:
name: Idempotency-Key
in: header
required: false
description: Idempotency key for safe retries of job-creation requests (ttl 24h)
schema:
type: string
maxLength: 128
example: req-123e4567
securitySchemes:
AdminSecret:
type: http
scheme: bearer
description: 'v2 (EP-023-T9): support read-view secret (ADMIN_SECRET). Server-only; empty → /api/v2/admin/* 404.'
DeviceToken:
type: http
scheme: bearer
bearerFormat: JWT
description: 'device_token, issued at `/register`. All protected requests are also signed (timestamp, nonce, body hash, signature) —
see docs/security.md (canonical string `METHOD\nPATH\nTIMESTAMP\nNONCE\nBODY_SHA256`, ±300s window, nonce TTL 5 min).
'
ApiKey:
type: http
scheme: bearer
bearerFormat: opaque
description: 'v2 (EP-023): API key `Authorization: Bearer p2m_...` over TLS. WITHOUT an ES256 body signature and anti-replay
(unlike DeviceToken) — this is a deliberate perimeter shift (docs/security.md §0-2). Scopes/limits/ownership
are checked by the server; the tier is not stored on the key (entitlements are resolved live).
'
Session:
type: apiKey
in: cookie
name: p2m_session
description: 'v2 (EP-023): the extension/web OAuth session (Google login). Used by the UI for /api/v2/me, /api/v2/limits, /api/v2/api-keys.'
UploadTicket:
type: apiKey
in: header
name: Upload-Ticket
description: 'v2 (EP-048): a one-time, short-TTL ticket from POST /api/v2/jobs/upload-ticket, bound
server-side to {device, account, tier, byte cap}. Authenticates the streamed
POST /api/v2/jobs/upload WITHOUT a per-body ES256 signature (so the body can stream).
Single-use (consumed on arrival) and short-lived, which bounds theft/replay.
'