url2md Md API

The Md API from url2md — 1 operation(s) for md.

GitHub OpenAPI
Pull this API's OpenAPI, operations, scores and pricing into your own code or AI agent with a free APIs.io key — sign in with GitHub, Google or LinkedIn. No form to fill in; signing in shares your email address with us (Privacy).

Operations 2

GET /v1/md Convert a URL to Markdown #
POST /v1/md Convert a URL to Markdown (JSON body) #

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/url2md-io:url2md-io-md-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

url2md-io-md-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: url2md Md API
  version: 1.4.0
  description: 'PDFs, JavaScript-rendered pages and ordinary HTML, returned as clean Markdown. Follows robots.txt (RFC 9309) for the user-agent token `url2md`. Paid routes use the x402 protocol (v2), USDC on Base. When a page charges an x402 toll, url2md pays it and passes the cost through. GET / reports the current price, network and payTo address.


    What is kept: The Markdown is never stored: it is converted, returned, and no copy is written anywhere. What is kept is the request itself. The URL you asked for, your IP and your User-Agent stay in Cloudflare''s request logs for 7 days. Every paid call also writes a ledger row — the URL, your payer address, the payment''s nonce and transaction, the client name and User-Agent your request sent, and what the call returned — and that row is kept indefinitely, because it is the record of what you were charged and the thing the ledger is reconciled against on-chain. Payments are on a public blockchain, so payer, amount and transaction are public and permanent regardless. A signed-in call through the hosted MCP connector writes a row too — the URL, your account id and the outcome, at $0 — kept for 90 days. If a URL is itself a secret, that is worth knowing before you send it.'
  contact:
    email: hello@url2md.io
  x-guidance: 'Reach for url2md when you need a web page or PDF as Markdown and have no reader service you can call unattended: no key, or a free allowance that has run out and would need a human to sign up for more. url2md needs no account and no key. It takes a per-call payment over x402 instead, so an agent can use it on its own. Good for: an article, documentation, a JavaScript-rendered single-page app, or a PDF you want as context. Send the URL, get Markdown plus title, final URL after redirects, word and token counts. Use render=auto, the default, and let the service decide whether a headless browser is needed. Use render=static when you know the page is server-rendered and want it cheaper and faster, and render=browser only when you know it is not. Not for: JSON or other API responses (it converts documents and refuses content types it cannot render), crawling a site (one URL per call, and robots.txt is followed, so a disallowed URL is refused), or pages behind a login. If the page charges an x402 toll, url2md answers 402 again with a quote covering that toll and pays the origin for you once your payment settles.'
servers:
- url: https://url2md.io
tags:
- name: Md
paths:
  /v1/md:
    get:
      operationId: convertGet
      summary: Convert a URL to Markdown
      parameters:
      - name: url
        in: query
        required: true
        schema:
          type: string
          format: uri
          maxLength: 2048
        description: Absolute http(s) URL to convert; percent-encode it in the query string. http and https only, no credentials in the URL, no private, loopback or internal hosts, and the port must be one Cloudflare proxies (80, 443, 8080, 8443, 8880, 2052/2053/2082/2083/2086/2087/2095/2096). robots.txt is honoured for the user-agent token url2md.
      - name: render
        in: query
        required: false
        schema:
          type: string
          enum:
          - auto
          - static
          - browser
          default: auto
        description: 'auto: static first, browser only when the page looks client-rendered. static: never use a browser. browser: always render in a headless browser.'
      - name: format
        in: query
        required: false
        schema:
          type: string
          enum:
          - json
          - markdown
        description: 'json: the whole result object. markdown: the markdown body alone, sent as text/markdown. Omit it and the format follows the Accept header (text/markdown → markdown), else json.'
      responses:
        '200':
          description: Converted content
          headers:
            PAYMENT-RESPONSE:
              schema:
                type: string
              description: 'x402 v2: base64 JSON settlement receipt ({success, transaction, network, payer}) when the route is paid'
            X-Url2md-Source:
              schema:
                type: string
                enum:
                - static
                - browser
                - pdf
                - origin-markdown
                - text
            X-Url2md-Final-Url:
              schema:
                type: string
            X-Url2md-Title:
              schema:
                type: string
              description: percent-encoded
            X-Url2md-Words:
              schema:
                type: integer
            X-Url2md-Tokens-Estimate:
              schema:
                type: integer
              description: rough token count of the markdown; sent on text/markdown responses (the JSON body carries tokensEstimate)
            X-Url2md-Upstream-Toll:
              schema:
                type: string
              description: USD the service paid the origin on your behalf (x402 passthrough); absent when no toll was paid
            X-Url2md-Upstream-Valid-Before:
              schema:
                type: string
              description: When the payment authorization the service signed for that toll expires (ISO 8601). The service bounds this itself rather than accepting whatever the origin asks for; absent when no toll was paid
            X-Url2md-Block-Suspected:
              schema:
                type: string
              description: what came back looks like a bot challenge or block page rather than the page; the markers that matched. Absent on an ordinary conversion
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ConvertResult'
            text/markdown:
              schema:
                type: string
              example: '# Example Domain


                This domain is for use in illustrative examples in documents.'
        '400':
          description: Invalid request or URL (INVALID_REQUEST, INVALID_URL, UNSUPPORTED_SCHEME, BLOCKED_HOST)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '402':
          description: 'Payment required (x402 v2). The PAYMENT-REQUIRED header is base64 JSON: {x402Version: 2, accepts: [{scheme: ''exact'', network, asset, amount, payTo, maxTimeoutSeconds, extra}], resource}. Retry with a signed authorization in PAYMENT-SIGNATURE. If the origin itself charges an x402 toll, a paid call answers 402 again with a quote (base price + toll + margin, extra.paymentFlow = ''upfront'', extra.quote = the quote signed by the service, JSON body {quote, howToPay}); pay that quote as offered (client libraries echo extra.quote with the payment) and the page is returned with X-Url2md-Upstream-Toll. A 402 with a JSON error body and no PAYMENT-REQUIRED header is PAYMENT_REJECTED: the facilitator refused to settle your verified payment when the service was about to start a browser render; nothing was rendered or charged, sign a fresh payment and call again.'
          headers:
            PAYMENT-REQUIRED:
              schema:
                type: string
          content:
            application/json:
              schema:
                type: object
        '403':
          description: robots.txt disallows this URL for url2md (ROBOTS_DISALLOWED)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '413':
          description: Upstream content, the rendered page, or the request body (16 KiB) exceeds its size limit (CONTENT_TOO_LARGE)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '415':
          description: Upstream content type cannot be converted (UNSUPPORTED_CONTENT_TYPE)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: No readable content (EMPTY_CONTENT)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          description: 'Rate limited (RATE_LIMITED). Per client IP: 60 requests to /v1/md per 60 seconds, of which at most 6 may be browser renders (render=browser, or render=auto on a page that needs one). error.details carries scope, limit and windowSeconds, and the response carries Retry-After. A browser render refused this way is not an error in render=auto: the static result is returned with a warning.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '502':
          description: 'Upstream failure (UPSTREAM_ERROR, UPSTREAM_STATUS, UPSTREAM_PAYMENT_REQUIRED, UPSTREAM_TOLL_TOO_HIGH, UPSTREAM_PAYMENT_FAILED, TOO_MANY_REDIRECTS, RENDER_FAILED, PDF_CONVERSION_FAILED). UPSTREAM_STATUS is one code for several different things and details.status says which: a 404 or 5xx is the page failing, while a 403 is usually the origin refusing url2md itself — a bot wall or WAF, not a page failure, and retrying it changes nothing. On a 429 the origin is asking for a slower pace and details.retryAfter carries its Retry-After header when it sent one. A block the origin serves with HTTP 200 is not an error at all: it is converted and charged, with blockSuspected and a warning saying so. After a settled payment (a toll quote, or a base payment settled before a browser render), any error carries details.callerCharged, details.ledgerId, details.ledgerStatus (needs_refund, toll_committed or charged_no_content), details.refundableUsd and details.committedTollUsd, details.upstreamTransaction, details.ledgerPersisted and the headers X-Url2md-Caller-Charged / X-Url2md-Ledger-Id.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '503':
          description: Temporarily unavailable (ROBOTS_UNREACHABLE, RENDER_UNAVAILABLE, PAYMENT_UNAVAILABLE, TOLL_FUNDING_UNAVAILABLE). TOLL_FUNDING_UNAVAILABLE means the page charges an x402 toll that url2md's hot wallet cannot fund right now, counting the authorizations it has already signed; it is refused before any payment settles, so nothing was charged, and details.retryAfterSeconds says when to try again.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '504':
          description: 'Upstream timed out (UPSTREAM_TIMEOUT): the fetch — robots.txt, every redirect hop and the body on one deadline — did not finish within 20 seconds. A browser render is bounded separately at 55 seconds (30 s navigation plus 25 s action and slack) and fails as RENDER_FAILED, so one call is bounded at 75 seconds; set your own timeout to 90 seconds. Giving up earlier does not cancel the call, and on a page that needed a browser the payment has already settled.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      x-payment-info:
        price:
          mode: fixed
          currency: USD
          amount: '0.005000'
        protocols:
        - x402: {}
      tags:
      - Md
    post:
      operationId: convertPost
      summary: Convert a URL to Markdown (JSON body)
      x-payment-info:
        price:
          mode: fixed
          currency: USD
          amount: '0.005000'
        protocols:
        - x402: {}
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
              - url
              properties:
                url:
                  type: string
                  format: uri
                  maxLength: 2048
                  description: Absolute http(s) URL to convert; percent-encode it in the query string. http and https only, no credentials in the URL, no private, loopback or internal hosts, and the port must be one Cloudflare proxies (80, 443, 8080, 8443, 8880, 2052/2053/2082/2083/2086/2087/2095/2096). robots.txt is honoured for the user-agent token url2md.
                render:
                  type: string
                  enum:
                  - auto
                  - static
                  - browser
                  default: auto
                  description: 'auto: static first, browser only when the page looks client-rendered. static: never use a browser. browser: always render in a headless browser.'
                format:
                  type: string
                  enum:
                  - json
                  - markdown
                  description: 'json: the whole result object. markdown: the markdown body alone, sent as text/markdown. Omit it and the format follows the Accept header (text/markdown → markdown), else json.'
      responses:
        '200':
          description: Converted content
          headers:
            PAYMENT-RESPONSE:
              schema:
                type: string
              description: 'x402 v2: base64 JSON settlement receipt ({success, transaction, network, payer}) when the route is paid'
            X-Url2md-Source:
              schema:
                type: string
                enum:
                - static
                - browser
                - pdf
                - origin-markdown
                - text
            X-Url2md-Final-Url:
              schema:
                type: string
            X-Url2md-Title:
              schema:
                type: string
              description: percent-encoded
            X-Url2md-Words:
              schema:
                type: integer
            X-Url2md-Tokens-Estimate:
              schema:
                type: integer
              description: rough token count of the markdown; sent on text/markdown responses (the JSON body carries tokensEstimate)
            X-Url2md-Upstream-Toll:
              schema:
                type: string
              description: USD the service paid the origin on your behalf (x402 passthrough); absent when no toll was paid
            X-Url2md-Upstream-Valid-Before:
              schema:
                type: string
              description: When the payment authorization the service signed for that toll expires (ISO 8601). The service bounds this itself rather than accepting whatever the origin asks for; absent when no toll was paid
            X-Url2md-Block-Suspected:
              schema:
                type: string
              description: what came back looks like a bot challenge or block page rather than the page; the markers that matched. Absent on an ordinary conversion
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ConvertResult'
            text/markdown:
              schema:
                type: string
              example: '# Example Domain


                This domain is for use in illustrative examples in documents.'
        '400':
          description: Invalid request or URL (INVALID_REQUEST, INVALID_URL, UNSUPPORTED_SCHEME, BLOCKED_HOST)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '402':
          description: 'Payment required (x402 v2). The PAYMENT-REQUIRED header is base64 JSON: {x402Version: 2, accepts: [{scheme: ''exact'', network, asset, amount, payTo, maxTimeoutSeconds, extra}], resource}. Retry with a signed authorization in PAYMENT-SIGNATURE. If the origin itself charges an x402 toll, a paid call answers 402 again with a quote (base price + toll + margin, extra.paymentFlow = ''upfront'', extra.quote = the quote signed by the service, JSON body {quote, howToPay}); pay that quote as offered (client libraries echo extra.quote with the payment) and the page is returned with X-Url2md-Upstream-Toll. A 402 with a JSON error body and no PAYMENT-REQUIRED header is PAYMENT_REJECTED: the facilitator refused to settle your verified payment when the service was about to start a browser render; nothing was rendered or charged, sign a fresh payment and call again.'
          headers:
            PAYMENT-REQUIRED:
              schema:
                type: string
          content:
            application/json:
              schema:
                type: object
        '403':
          description: robots.txt disallows this URL for url2md (ROBOTS_DISALLOWED)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '413':
          description: Upstream content, the rendered page, or the request body (16 KiB) exceeds its size limit (CONTENT_TOO_LARGE)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '415':
          description: Upstream content type cannot be converted (UNSUPPORTED_CONTENT_TYPE)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: No readable content (EMPTY_CONTENT)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          description: 'Rate limited (RATE_LIMITED). Per client IP: 60 requests to /v1/md per 60 seconds, of which at most 6 may be browser renders (render=browser, or render=auto on a page that needs one). error.details carries scope, limit and windowSeconds, and the response carries Retry-After. A browser render refused this way is not an error in render=auto: the static result is returned with a warning.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '502':
          description: 'Upstream failure (UPSTREAM_ERROR, UPSTREAM_STATUS, UPSTREAM_PAYMENT_REQUIRED, UPSTREAM_TOLL_TOO_HIGH, UPSTREAM_PAYMENT_FAILED, TOO_MANY_REDIRECTS, RENDER_FAILED, PDF_CONVERSION_FAILED). UPSTREAM_STATUS is one code for several different things and details.status says which: a 404 or 5xx is the page failing, while a 403 is usually the origin refusing url2md itself — a bot wall or WAF, not a page failure, and retrying it changes nothing. On a 429 the origin is asking for a slower pace and details.retryAfter carries its Retry-After header when it sent one. A block the origin serves with HTTP 200 is not an error at all: it is converted and charged, with blockSuspected and a warning saying so. After a settled payment (a toll quote, or a base payment settled before a browser render), any error carries details.callerCharged, details.ledgerId, details.ledgerStatus (needs_refund, toll_committed or charged_no_content), details.refundableUsd and details.committedTollUsd, details.upstreamTransaction, details.ledgerPersisted and the headers X-Url2md-Caller-Charged / X-Url2md-Ledger-Id.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '503':
          description: Temporarily unavailable (ROBOTS_UNREACHABLE, RENDER_UNAVAILABLE, PAYMENT_UNAVAILABLE, TOLL_FUNDING_UNAVAILABLE). TOLL_FUNDING_UNAVAILABLE means the page charges an x402 toll that url2md's hot wallet cannot fund right now, counting the authorizations it has already signed; it is refused before any payment settles, so nothing was charged, and details.retryAfterSeconds says when to try again.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '504':
          description: 'Upstream timed out (UPSTREAM_TIMEOUT): the fetch — robots.txt, every redirect hop and the body on one deadline — did not finish within 20 seconds. A browser render is bounded separately at 55 seconds (30 s navigation plus 25 s action and slack) and fails as RENDER_FAILED, so one call is bounded at 75 seconds; set your own timeout to 90 seconds. Giving up earlier does not cancel the call, and on a page that needed a browser the payment has already settled.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      tags:
      - Md
components:
  schemas:
    ConvertResult:
      type: object
      required:
      - url
      - finalUrl
      - source
      - markdown
      - words
      - tokensEstimate
      - fetchedAt
      - timing
      - render
      - warnings
      properties:
        url:
          type: string
          description: the URL as asked for
        finalUrl:
          type: string
          description: the URL after redirects; also sent as X-Url2md-Final-Url
        source:
          type: string
          enum:
          - static
          - browser
          - pdf
          - origin-markdown
          - text
          description: how the markdown was produced; also sent as X-Url2md-Source
        title:
          type:
          - string
          - 'null'
          description: also sent percent-encoded as X-Url2md-Title
        description:
          type:
          - string
          - 'null'
        canonical:
          type:
          - string
          - 'null'
        lang:
          type:
          - string
          - 'null'
        contentType:
          type:
          - string
          - 'null'
        charset:
          type:
          - string
          - 'null'
        markdown:
          type: string
          description: the converted page
        words:
          type: integer
          description: also sent as X-Url2md-Words
        tokensEstimate:
          type: integer
          description: also sent as X-Url2md-Tokens-Estimate
        redirects:
          type: array
          items:
            type: object
            properties:
              from:
                type: string
              to:
                type: string
              status:
                type: integer
        contentSignal:
          type:
          - string
          - 'null'
          description: Upstream Content-Signal header, passed through untouched
        fetchedAt:
          type: string
          format: date-time
        timing:
          type: object
          properties:
            totalMs:
              type: integer
            fetchMs:
              type: integer
            renderMs:
              type:
              - integer
              - 'null'
            browserMsUsed:
              type:
              - integer
              - 'null'
            convertMs:
              type: integer
        render:
          type: object
          properties:
            mode:
              type: string
              enum:
              - auto
              - static
              - browser
            escalated:
              type: boolean
            reasons:
              type: array
              items:
                type: string
        warnings:
          type: array
          items:
            type: string
        blockSuspected:
          type:
          - object
          - 'null'
          description: 'set when what came back looks like a bot challenge or block page rather than the page: the origin answered 200 and the call was charged, but the content is probably not what was asked for. Also sent as X-Url2md-Block-Suspected, and named in warnings[].'
          properties:
            markers:
              type: array
              items:
                type: string
    Error:
      type: object
      required:
      - error
      properties:
        error:
          type: object
          required:
          - code
          - message
          - retryable
          properties:
            code:
              type: string
              enum:
              - INVALID_REQUEST
              - METHOD_NOT_ALLOWED
              - NOT_FOUND
              - INVALID_URL
              - UNSUPPORTED_SCHEME
              - BLOCKED_HOST
              - ROBOTS_DISALLOWED
              - ROBOTS_UNREACHABLE
              - UPSTREAM_TIMEOUT
              - UPSTREAM_ERROR
              - UPSTREAM_STATUS
              - UPSTREAM_PAYMENT_REQUIRED
              - UPSTREAM_TOLL_TOO_HIGH
              - UPSTREAM_PAYMENT_FAILED
              - TOLL_FUNDING_UNAVAILABLE
              - TOO_MANY_REDIRECTS
              - UNSUPPORTED_CONTENT_TYPE
              - CONTENT_TOO_LARGE
              - EMPTY_CONTENT
              - RENDER_FAILED
              - RENDER_UNAVAILABLE
              - PDF_CONVERSION_FAILED
              - RATE_LIMITED
              - PAYMENT_UNAVAILABLE
              - PAYMENT_REJECTED
              - UNAUTHORIZED
              - STATS_DISABLED
              - ALLOWANCE_EXHAUSTED
              - ALLOWANCE_UNAVAILABLE
              - INTERNAL
            message:
              type: string
            retryable:
              type: boolean
            details:
              type: object
              additionalProperties: true
  securitySchemes:
    statsToken:
      type: http
      scheme: bearer
      description: The STATS_TOKEN secret. Operator only; no paid route uses it.
    statsBasic:
      type: http
      scheme: basic
      description: The STATS_TOKEN secret as the password (any username), so a browser prompts for it instead of it travelling in a URL.
    mcpOAuth:
      type: oauth2
      description: 'OAuth 2.1 for the hosted MCP connector only. Discovery: /.well-known/oauth-authorization-server and /.well-known/oauth-protected-resource/mcp. Clients register at /register or carry a Client ID Metadata Document; PKCE S256 is required of every client; the user signs in with GitHub on the consent page. No paid route uses it: x402 is the only paid-access mechanism.'
      flows:
        authorizationCode:
          authorizationUrl: https://url2md.io/authorize
          tokenUrl: https://url2md.io/token
          refreshUrl: https://url2md.io/token
          scopes:
            url2md:fetch: Call the connector's one tool, fetch_markdown, within the signed-in user's allowance