> ## Documentation Index
> Fetch the complete documentation index at: https://docs.anythingmd.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Create a quote

> Returns the credits a conversion would reserve (maximumCredits) without starting it. Uploaded documents are quoted on their exact page count; URLs are quoted at the minimum because the file is not downloaded. A URL whose server does not report its size returns 422 size_unknown. Quotes can be fetched by id until expiresAt.



## OpenAPI

````yaml /openapi.json post /api/v1/quotes
openapi: 3.1.0
info:
  title: AnythingMD API
  version: 1.0.0-preview
  description: >-
    Convert PDFs, Office documents, spreadsheets and images into Markdown.
    Guides, pricing and limits: https://docs.anythingmd.com. Preview: available
    to workspaces that have purchased credits.
servers:
  - url: https://anythingmd.com
    description: Production
security:
  - BearerAuth: []
tags:
  - name: Uploads
    description: Stage a source document for conversion
  - name: Jobs
    description: Create and observe async conversion work
  - name: Artifacts
    description: Retrieve job outputs
  - name: Quotes
    description: See what a conversion would cost before starting it.
  - name: Receipts
    description: What a job was charged. Receipts outlive the job.
paths:
  /api/v1/quotes:
    post:
      tags:
        - Quotes
      summary: Create a quote
      description: >-
        Returns the credits a conversion would reserve (maximumCredits) without
        starting it. Uploaded documents are quoted on their exact page count;
        URLs are quoted at the minimum because the file is not downloaded. A URL
        whose server does not report its size returns 422 size_unknown. Quotes
        can be fetched by id until expiresAt.
      operationId: createQuote
      parameters:
        - name: Idempotency-Key
          in: header
          required: false
          schema:
            type: string
            minLength: 1
          description: >-
            If reused within the retention window, replay the original result
            instead of a second mutation
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateQuoteRequest'
      responses:
        '200':
          description: Existing quote returned for a replayed idempotency key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateQuoteResponse'
        '201':
          description: Quote created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateQuoteResponse'
        '400':
          description: Invalid request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
        '401':
          description: Missing or invalid API key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
        '402':
          description: >-
            Payment required. Body carries topUpPath and optional
            requiredCredits/availableCredits. Quote is omitted unless a saved
            quote is attached; Job stays amount-free.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PaymentRequiredError'
        '403':
          description: >-
            Authenticated, but the credential lacks the scope this operation
            requires (code: insufficient_scope). Reads need documents:read,
            uploads and job creation need documents:write, cancel needs
            documents:delete. Checked before the resource is looked up, so this
            never reveals whether the resource exists.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
        '404':
          description: Resource not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
        '422':
          description: >-
            Cannot estimate credits: the external URL did not advertise a file
            size. Jobs may still start; the hold is priced after ingest measures
            bytes.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
      security:
        - BearerAuth: []
components:
  schemas:
    CreateQuoteRequest:
      type: object
      properties:
        operation:
          default: convert
          description: Work to price
          type: string
          enum:
            - convert
        capabilityVersion:
          default: '1'
          description: Capability version the quote is pinned to
          type: string
          minLength: 1
        source:
          oneOf:
            - type: object
              properties:
                type:
                  type: string
                  const: document
                documentId:
                  type: string
                  minLength: 1
                  description: Id of an uploaded source document
              required:
                - type
                - documentId
              additionalProperties: false
            - type: object
              properties:
                type:
                  type: string
                  const: external
                fileUrl:
                  type: string
                  minLength: 1
                  description: Caller-supplied URL for the server to fetch
                fileName:
                  description: Original file name; defaults to "document" if omitted
                  type: string
              required:
                - type
                - fileUrl
              additionalProperties: false
          description: Input the quote should estimate
        idempotencyKey:
          description: >-
            If the same key is reused within the window, return the original
            quote
          type: string
          minLength: 1
      required:
        - operation
        - capabilityVersion
        - source
      additionalProperties: false
    CreateQuoteResponse:
      type: object
      properties:
        id:
          type: string
          minLength: 1
          description: Quote id
        operation:
          type: string
          enum:
            - convert
        capabilityVersion:
          type: string
          minLength: 1
          description: >-
            Pinned version of this capability. Quotes, receipts, rate cards, and
            Skills key off operation + version.
        estimatedUsage:
          type: object
          properties:
            inputBytes:
              description: Source document size in bytes
              type: integer
              minimum: 0
              maximum: 9007199254740991
            discoveredPages:
              description: Pages detected in the source
              type: integer
              minimum: 0
              maximum: 9007199254740991
            ocrPages:
              description: Pages that required OCR
              type: integer
              minimum: 0
              maximum: 9007199254740991
            outputBytes:
              description: Produced artifact bytes
              type: integer
              minimum: 0
              maximum: 9007199254740991
            durationMs:
              description: Wall-clock processing time in milliseconds
              type: integer
              minimum: 0
              maximum: 9007199254740991
          additionalProperties: false
          description: Estimated natural units; not a bill
        estimatedCredits:
          type: number
          minimum: 0
          description: Expected credits if work matches the estimate
        maximumCredits:
          type: number
          minimum: 0
          description: >-
            Credits that will be reserved when the job starts; the workspace
            needs at least this many
        priceVersion:
          type: string
          minLength: 1
          description: Rate-card version this quote is pinned to
        expiresAt:
          type: string
          format: date-time
          pattern: >-
            ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z))$
          description: ISO-8601 quote expiration
        createdAt:
          type: string
          format: date-time
          pattern: >-
            ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z))$
      required:
        - id
        - operation
        - capabilityVersion
        - estimatedUsage
        - estimatedCredits
        - maximumCredits
        - priceVersion
        - expiresAt
        - createdAt
      additionalProperties: false
    ApiError:
      type: object
      properties:
        error:
          type: string
          description: User-facing error message
        code:
          description: Optional machine-readable error code (e.g. invalid_request)
          type: string
      required:
        - error
      additionalProperties: false
    PaymentRequiredError:
      type: object
      properties:
        error:
          type: string
          description: User-facing error message
        code:
          description: Optional machine-readable error code (e.g. invalid_request)
          type: string
        quote:
          description: Quote that must be funded before the mutation can proceed
          type: object
          properties:
            id:
              type: string
              minLength: 1
              description: Quote id
            operation:
              type: string
              enum:
                - convert
            capabilityVersion:
              type: string
              minLength: 1
              description: >-
                Pinned version of this capability. Quotes, receipts, rate cards,
                and Skills key off operation + version.
            estimatedUsage:
              type: object
              properties:
                inputBytes:
                  description: Source document size in bytes
                  type: integer
                  minimum: 0
                  maximum: 9007199254740991
                discoveredPages:
                  description: Pages detected in the source
                  type: integer
                  minimum: 0
                  maximum: 9007199254740991
                ocrPages:
                  description: Pages that required OCR
                  type: integer
                  minimum: 0
                  maximum: 9007199254740991
                outputBytes:
                  description: Produced artifact bytes
                  type: integer
                  minimum: 0
                  maximum: 9007199254740991
                durationMs:
                  description: Wall-clock processing time in milliseconds
                  type: integer
                  minimum: 0
                  maximum: 9007199254740991
              additionalProperties: false
              description: Estimated natural units; not a bill
            estimatedCredits:
              type: number
              minimum: 0
              description: Expected credits if work matches the estimate
            maximumCredits:
              type: number
              minimum: 0
              description: >-
                Credits that will be reserved when the job starts; the workspace
                needs at least this many
            priceVersion:
              type: string
              minLength: 1
              description: Rate-card version this quote is pinned to
            expiresAt:
              type: string
              format: date-time
              pattern: >-
                ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z))$
              description: ISO-8601 quote expiration
            createdAt:
              type: string
              format: date-time
              pattern: >-
                ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z))$
          required:
            - id
            - operation
            - capabilityVersion
            - estimatedUsage
            - estimatedCredits
            - maximumCredits
            - priceVersion
            - expiresAt
            - createdAt
          additionalProperties: false
        topUpPath:
          description: >-
            Control-plane path or URL where the payer can add funds (not an
            amount)
          type: string
        requiredCredits:
          description: >-
            Credits needed to start this operation (reserved, not the final
            charge)
          type: number
          minimum: 0
        availableCredits:
          description: Credits currently available to this account
          type: number
          minimum: 0
      required:
        - error
      additionalProperties: false
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API key
      description: >-
        Create a key under Settings → API Keys and send it as `Authorization:
        Bearer amd_live_…`. See https://docs.anythingmd.com/authentication.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.