PDF2MD v2 Account API

v2 (EP-023): account, limits, usage

GitHub OpenAPI

Operations 7

GET /api/v2/account Device-to-account link status (device-signed) #
POST /api/v2/account/link/start Start device linking (device-signed) #
POST /api/v2/account/link/attach Link device to the current session's account (device-signed + session) #
GET /api/v2/me Current account #
GET /api/v2/limits Live actor entitlements #
GET /api/v2/usage Usage (fair-use progress) #

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/pdf2md-dev:pdf2md-dev-v2-account-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

pdf2md-dev-v2-account-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: PDF to Markdown API Facade v2 Account 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 Account
  description: 'v2 (EP-023): account, limits, usage'
paths:
  /api/v2/account:
    get:
      tags:
      - v2 Account
      summary: Device-to-account link status (device-signed)
      description: Device-signed (ES256). Returns linked=false for an anonymous device.
      security:
      - DeviceToken: []
      responses:
        '200':
          description: Status
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/V2AccountStatus'
        '401':
          $ref: '#/components/responses/V2Unauthorized'
      operationId: getApiV2Account
      x-operation-id-source: derived
  /api/v2/account/link/start:
    post:
      tags:
      - v2 Account
      summary: Start device linking (device-signed)
      description: Device-signed (ES256). Issues a one-time ticket bound to the VERIFIED device, and returns the web login URL (`login_url`) to open in a tab. Only the genuine device (holding the private key) can obtain a ticket → another device_id cannot be linked to someone else's account.
      security:
      - DeviceToken: []
      responses:
        '200':
          description: Login URL
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/V2LinkStart'
        '401':
          $ref: '#/components/responses/V2Unauthorized'
        '503':
          description: OAuth not configured
      operationId: postApiV2AccountLinkStart
      x-operation-id-source: derived
  /api/v2/account/link/attach:
    post:
      tags:
      - v2 Account
      summary: Link device to the current session's account (device-signed + session)
      description: 'Device-signed (ES256) AND session-authenticated (cookie). Links the VERIFIED device to the account of the CURRENT web session directly (no OAuth round-trip) and migrates the device''s anonymous jobs to that account. Idempotent. The web app calls this on /app/ load in account mode to self-heal a "session present but device unlinked" desync (a sign-in that skipped the device-link ticket, or a checkout-intent session) — otherwise device-signed job creation silently lands on the anonymous device and never appears in the account-scoped list. Both proofs are required: the device signature proves the device; the session proves the account.'
      security:
      - DeviceToken: []
      responses:
        '200':
          description: Linked
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/V2AccountStatus'
        '401':
          $ref: '#/components/responses/V2Unauthorized'
      operationId: postApiV2AccountLinkAttach
      x-operation-id-source: derived
  /api/v2/account/unlink:
    post:
      tags:
      - v2 Account
      summary: Unlink device from account / sign out in the extension (device-signed)
      description: Device-signed (ES256). Removes the link and returns the device's active jobs to anonymous mode (owner_type=device, tier=anonymous) without data loss. Idempotent (for an already anonymous device — linked=false).
      security:
      - DeviceToken: []
      responses:
        '200':
          description: Unlinked
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/V2AccountStatus'
        '401':
          $ref: '#/components/responses/V2Unauthorized'
      operationId: postApiV2AccountUnlink
      x-operation-id-source: derived
  /api/v2/me:
    get:
      tags:
      - v2 Account
      summary: Current account
      security:
      - ApiKey: []
      - Session: []
      responses:
        '200':
          description: Account
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/V2Me'
        '401':
          $ref: '#/components/responses/V2Unauthorized'
      operationId: getApiV2Me
      x-operation-id-source: derived
  /api/v2/limits:
    get:
      tags:
      - v2 Account
      summary: Live actor entitlements
      security:
      - ApiKey: []
      - Session: []
      responses:
        '200':
          description: Limits
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/V2Limits'
        '401':
          $ref: '#/components/responses/V2Unauthorized'
      operationId: getApiV2Limits
      x-operation-id-source: derived
  /api/v2/usage:
    get:
      tags:
      - v2 Account
      summary: Usage (fair-use progress)
      security:
      - ApiKey: []
      - Session: []
      responses:
        '200':
          description: Usage
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/V2Usage'
        '401':
          $ref: '#/components/responses/V2Unauthorized'
      operationId: getApiV2Usage
      x-operation-id-source: derived
components:
  schemas:
    V2AccountStatus:
      type: object
      description: 'EP-023-T1: device-to-account link status (device-signed GET/POST /api/v2/account*).'
      required:
      - linked
      properties:
        linked:
          type: boolean
          description: true — the device is linked to an account
        account_id:
          type: string
          format: uuid
        email:
          type: string
        display_name:
          type: string
          nullable: true
        avatar_url:
          type: string
          nullable: true
        tier:
          $ref: '#/components/schemas/V2Tier'
        affected_jobs:
          type: integer
          description: How many jobs were re-attached/returned on link/unlink
        limits:
          allOf:
          - $ref: '#/components/schemas/V2Limits'
          nullable: true
          description: 'EP-025-T2 (additive): live entitlements for a linked device so the device-signed extension can show tier-correct limits without a session/API key (it cannot reach /api/v2/limits). Omitted when the device is anonymous or the resolver is unavailable.'
        slots_in_use:
          type: integer
          nullable: true
          description: 'EP-025-T2 (additive): active jobs currently owned by the linked account.'
        subscription:
          type: object
          nullable: true
          description: 'EP-025-T5 (additive): subscription status/period for the extension Account & Plan section. Omitted when the device is anonymous and has neither a subscription nor a live lifetime unlock.'
          properties:
            status:
              type: string
              enum:
              - free
              - trialing
              - active
              - past_due
              - canceled
              - paused
            cancel_at_period_end:
              type: boolean
            current_period_end:
              type: string
              format: date-time
              nullable: true
            trial_end:
              type: string
              format: date-time
              nullable: true
            lifetime:
              type: boolean
              description: 'EP-069-T13: the account holds a LIVE one-time unlock. Server-computed so four client surfaces do not each infer it and disagree.'
            manageable:
              type: boolean
              description: 'EP-069-T13/EP-070-T5: there is something the provider portal can change or cancel. FALSE for an account whose only purchase is the unlock — it has no schedule and cannot lapse, so offering "cancel" there is a support ticket at best. Built by ONE server-side builder shared by /me and /account: the two used to disagree, and the endpoint the extension reads never set it, so every recurring subscriber lost their Manage billing button.'
    V2Me:
      type: object
      required:
      - account_id
      - email
      - tier
      properties:
        account_id:
          type: string
          format: uuid
        email:
          type: string
        display_name:
          type: string
          nullable: true
        avatar_url:
          type: string
          format: uri
          nullable: true
          description: Google profile photo URL (EP-024-T11; used by the site header)
        tier:
          $ref: '#/components/schemas/V2Tier'
        subscription_status:
          type: string
          enum:
          - free
          - trialing
          - active
          - past_due
          - canceled
          - paused
    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.'
    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.

        '
    V2Limits:
      type: object
      description: Live actor entitlements (resolved from the subscription, §7.3)
      properties:
        tier:
          $ref: '#/components/schemas/V2Tier'
        max_active_slots:
          type: integer
          example: 3
        max_concurrent_conversions:
          type: integer
          example: 1
        max_file_size_bytes:
          type: integer
          format: int64
          example: 10485760
        processing_soft_budget_sec:
          type: integer
          example: 900
          description: 'The tier''s visible "time limit": the engine runs up to it and returns a partial result + the tier disclaimer (truncated=true), rather than a rejection. Invariant: < processing_timeout_sec. Shown on pricing and in the disclaimer.'
        processing_timeout_sec:
          type: integer
          example: 1200
          description: The worker's internal hard-backstop (= soft + ~5 min); not a marketing limit.
        ready_ttl_sec:
          type: integer
          example: 3600
        priority_base:
          type: integer
          example: 100
          description: §7.7, step-20 scale (anonymous=100)
        pool_eligibility:
          type: string
          enum:
          - free_only
          - free_and_paid
        monthly_pages_soft_limit:
          type: integer
          nullable: true
          description: 'EP-069: the monthly page allowance. SOFT on subscription tiers (past it the actor drops to the free pool for the rest of the cycle, never refused). HARD on anonymous (150), free (400) and lifetime (600) — those are refused with 409 quota_exceeded. Resolved for THIS actor: an API-key caller does not get the lifetime unlock (EP-070-T6).'
        monthly_pages_used:
          type: integer
          format: int64
          description: 'EP-070-T7: pages converted this UTC calendar month. Present here as well as on /api/v2/limits because the extension cannot reach that path (it needs an API key or a session cookie, and a cross-site extension fetch has neither).'
        webhooks_enabled:
          type: boolean
        slots_in_use:
          type: integer
          description: slots occupied right now
        rate_limits:
          type: object
          additionalProperties:
            type: integer
          description: 'per-class: api_requests_per_min, job_creates_per_min, upload_bytes_per_hour, download_requests_per_min, mcp_tool_calls_per_min'
    V2LinkStart:
      type: object
      description: 'EP-023-T1: response of device-signed POST /api/v2/account/link/start.'
      required:
      - login_url
      - expires_in_sec
      properties:
        login_url:
          type: string
          description: Web login URL with a one-time ticket — open in a tab
        expires_in_sec:
          type: integer
          description: ticket TTL (seconds)
    V2Usage:
      type: object
      description: 'EP-023-T9: monthly fair-use + durable counters (usage_ledger).'
      properties:
        period_start:
          type: string
          format: date
        pages:
          type: integer
          format: int64
        jobs:
          type: integer
        upload_bytes:
          type: integer
          format: int64
        download_count:
          type: integer
        mcp_calls:
          type: integer
        slots_in_use:
          type: integer
        max_active_slots:
          type: integer
        monthly_pages_soft_limit:
          type: integer
          nullable: true
          description: 'EP-069: soft on subscription tiers, HARD on anonymous/free/lifetime'
        monthly_pages_pct:
          type: integer
          description: '% of soft limit'
        warned:
          type: boolean
          description: true at ≥80% (§5)
        over_fair_use:
          type: boolean
          description: soft-degraded to free pool/band this cycle (≥100%)
  responses:
    V2Unauthorized:
      description: Missing/invalid API key or session
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/V2Error'
  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.

        '