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

> ## Agent Instructions
> Setting up Context.dev for a user? Follow https://docs.context.dev/agent-quickstart.md. MCP clients sign in with OAuth and need no API key; application code reads CONTEXT_DEV_API_KEY.

# Parse a file

> Convert uploaded file bytes into Markdown and optional HTML.

<Badge color="blue">From 1 credit</Badge>

See the [guide](/parse/overview) for examples and usage.


## OpenAPI

````yaml POST /parse
openapi: 3.1.0
info:
  title: Context.dev API
  description: >-
    Scrape, crawl, search, and monitor websites, and retrieve brand, people, and
    news data.
  version: 1.0.0
servers:
  - url: https://api.context.dev/v1
security: []
tags:
  - name: Webhooks
    description: Inspect and retry batch and monitor webhook deliveries.
  - name: Logs
    description: Read your organization's API request logs.
  - name: Agent Feedback
    description: Report API issues and documentation mismatches.
  - name: Batches
    description: Scrape many pages or crawl a site asynchronously.
  - name: Monitors
    description: Watch websites for exact or meaningful changes.
  - name: News
    description: Search live and historical news about a company.
  - name: Answers
    description: Answer a research task from the live web in the JSON shape you ask for.
paths:
  /parse:
    post:
      tags:
        - Parsing
      summary: Parse a file
      description: Convert uploaded file bytes into Markdown and optional HTML.
      parameters:
        - schema:
            type: string
            enum:
              - txt
              - text
              - md
              - markdown
              - html
              - htm
              - xhtml
              - xml
              - rss
              - atom
              - csv
              - tsv
              - yaml
              - yml
              - py
              - java
              - js
              - jsx
              - mjs
              - cjs
              - json
              - jsonl
              - ndjson
              - php
              - sh
              - bash
              - zsh
              - fish
              - rb
              - ts
              - tsx
              - rtf
              - srt
              - css
              - scss
              - less
              - styl
              - sass
              - svg
              - pdf
              - docx
              - doc
              - xlsx
              - xlsm
              - xlsb
              - xltx
              - xltm
              - xls
              - pptx
              - pptm
              - ppsx
              - ppsm
              - potx
              - potm
              - ppt
              - pps
              - pot
              - jpg
              - jpeg
              - jpe
              - png
              - gif
              - bmp
              - tiff
              - tif
              - webp
              - ppm
              - pbm
              - pgm
              - pnm
            description: >-
              Optional file extension hint, such as pdf, docx, xlsx, pptx, html,
              json, csv, md, py, rtf, jpg, png, or txt.
          required: false
          description: >-
            Optional file extension hint, such as pdf, docx, xlsx, pptx, html,
            json, csv, md, py, rtf, jpg, png, or txt.
          name: extension
          in: query
        - schema:
            type: boolean
            default: true
            description: Preserve hyperlinks in Markdown output
          required: false
          description: Preserve hyperlinks in Markdown output
          name: includeLinks
          in: query
        - schema:
            type: boolean
            default: false
            description: Include image references in Markdown output
          required: false
          description: Include image references in Markdown output
          name: includeImages
          in: query
        - schema:
            type: boolean
            default: true
            description: Shorten base64-encoded image data in the Markdown output
          required: false
          description: Shorten base64-encoded image data in the Markdown output
          name: shortenBase64Images
          in: query
        - schema:
            type: boolean
            default: false
            description: Extract only the main content from HTML-like inputs
          required: false
          description: Extract only the main content from HTML-like inputs
          name: useMainContentOnly
          in: query
        - schema:
            type: boolean
            default: false
            description: >-
              Read text from images and scanned PDF pages. PDF page ranges still
              apply.
          required: false
          description: >-
            Read text from images and scanned PDF pages. PDF page ranges still
            apply.
          name: ocr
          in: query
        - schema:
            type: object
            properties:
              start:
                type: integer
                minimum: 1
                description: >-
                  First 1-based PDF page to parse. When omitted, parsing starts
                  at the first page.
              end:
                type: integer
                minimum: 1
                description: >-
                  Last 1-based PDF page to parse. When omitted, parsing ends at
                  the last page. Must be greater than or equal to start when
                  both are provided.
            additionalProperties: false
            description: >-
              PDF page-range options as a JSON object, e.g. {"start": 2, "end":
              5}.
          required: false
          description: >-
            PDF page-range options as a JSON object, e.g. {"start": 2, "end":
            5}.
          name: pdf
          in: query
        - schema:
            type: string
            minLength: 1
            maxLength: 100
            description: Optional client identifier used for usage attribution.
          required: false
          description: Optional client identifier used for usage attribution.
          name: client
          in: query
        - schema:
            type: string
            enum:
              - enabled
              - disabled
            default: disabled
            description: >-
              `enabled` turns on zero data retention. Returns 403
              `ZDR_NOT_ENABLED` unless your organization has ZDR.
          required: false
          description: >-
            `enabled` turns on zero data retention. Returns 403
            `ZDR_NOT_ENABLED` unless your organization has ZDR.
          name: zdr
          in: query
        - $ref: '#/components/parameters/RequestTags'
      requestBody:
        required: true
        description: Raw file bytes, up to 50 MiB.
        content:
          application/octet-stream:
            schema:
              type: string
              format: binary
          application/pdf:
            schema:
              type: string
              format: binary
          '*/*':
            schema:
              type: string
              format: binary
      responses:
        '200':
          description: Successful response
          headers:
            X-Request-Id:
              $ref: '#/components/headers/RequestId'
            X-RateLimit-Limit:
              $ref: '#/components/headers/RateLimitLimit'
            X-RateLimit-Remaining:
              $ref: '#/components/headers/RateLimitRemaining'
            X-RateLimit-Reset:
              $ref: '#/components/headers/RateLimitReset'
            X-RateLimit-Mode:
              $ref: '#/components/headers/RateLimitMode'
            X-Context-ZDR:
              description: >-
                Present with the value true when zero data retention was
                requested and honored.
              schema:
                type: string
                enum:
                  - 'true'
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    enum:
                      - true
                    description: Indicates success
                  markdown:
                    type: string
                    description: Input bytes converted to GitHub Flavored Markdown
                  type:
                    type: string
                    enum:
                      - html
                      - xml
                      - json
                      - jsonl
                      - text
                      - csv
                      - tsv
                      - markdown
                      - yaml
                      - python
                      - java
                      - javascript
                      - php
                      - shell
                      - ruby
                      - typescript
                      - rtf
                      - srt
                      - css
                      - scss
                      - less
                      - stylus
                      - sass
                      - svg
                      - pdf
                      - docx
                      - doc
                      - xlsx
                      - xls
                      - pptx
                      - ppt
                      - jpg
                      - png
                      - gif
                      - bmp
                      - tiff
                      - webp
                      - ppm
                      - pbm
                      - pgm
                      - pnm
                    description: Detected content type used for parsing
                  key_metadata:
                    $ref: '#/components/schemas/KeyMetadata'
                  request_id:
                    $ref: '#/components/schemas/RequestId'
                required:
                  - success
                  - markdown
                  - type
                  - request_id
        '400':
          description: Invalid input or no parseable content
          headers:
            X-Request-Id:
              $ref: '#/components/headers/RequestId'
            X-RateLimit-Limit:
              $ref: '#/components/headers/RateLimitLimit'
            X-RateLimit-Remaining:
              $ref: '#/components/headers/RateLimitRemaining'
            X-RateLimit-Reset:
              $ref: '#/components/headers/RateLimitReset'
            X-RateLimit-Mode:
              $ref: '#/components/headers/RateLimitMode'
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                  error_code:
                    type: string
                    enum:
                      - INPUT_VALIDATION_ERROR
                      - WEBSITE_ACCESS_ERROR
                  key_metadata:
                    $ref: '#/components/schemas/KeyMetadata'
                  request_id:
                    $ref: '#/components/schemas/RequestId'
                required:
                  - request_id
        '413':
          description: Request body exceeds the 50 MiB upload limit
          headers:
            X-Request-Id:
              $ref: '#/components/headers/RequestId'
            X-RateLimit-Limit:
              $ref: '#/components/headers/RateLimitLimit'
            X-RateLimit-Remaining:
              $ref: '#/components/headers/RateLimitRemaining'
            X-RateLimit-Reset:
              $ref: '#/components/headers/RateLimitReset'
            X-RateLimit-Mode:
              $ref: '#/components/headers/RateLimitMode'
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                  error_code:
                    type: string
                    enum:
                      - INPUT_VALIDATION_ERROR
        '415':
          description: Unsupported content type
          headers:
            X-Request-Id:
              $ref: '#/components/headers/RequestId'
            X-RateLimit-Limit:
              $ref: '#/components/headers/RateLimitLimit'
            X-RateLimit-Remaining:
              $ref: '#/components/headers/RateLimitRemaining'
            X-RateLimit-Reset:
              $ref: '#/components/headers/RateLimitReset'
            X-RateLimit-Mode:
              $ref: '#/components/headers/RateLimitMode'
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                  error_code:
                    type: string
                    enum:
                      - UNSUPPORTED_CONTENT
                  key_metadata:
                    $ref: '#/components/schemas/KeyMetadata'
                  request_id:
                    $ref: '#/components/schemas/RequestId'
                required:
                  - request_id
        '500':
          description: Internal server error
          headers:
            X-Request-Id:
              $ref: '#/components/headers/RequestId'
            X-RateLimit-Limit:
              $ref: '#/components/headers/RateLimitLimit'
            X-RateLimit-Remaining:
              $ref: '#/components/headers/RateLimitRemaining'
            X-RateLimit-Reset:
              $ref: '#/components/headers/RateLimitReset'
            X-RateLimit-Mode:
              $ref: '#/components/headers/RateLimitMode'
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                  error_code:
                    type: string
                    enum:
                      - INTERNAL_ERROR
                  key_metadata:
                    $ref: '#/components/schemas/KeyMetadata'
                  request_id:
                    $ref: '#/components/schemas/RequestId'
                required:
                  - request_id
        '503':
          description: >-
            Document parsing is at capacity. Retry after the delay in
            Retry-After.
          headers:
            X-Request-Id:
              $ref: '#/components/headers/RequestId'
            X-RateLimit-Limit:
              $ref: '#/components/headers/RateLimitLimit'
            X-RateLimit-Remaining:
              $ref: '#/components/headers/RateLimitRemaining'
            X-RateLimit-Reset:
              $ref: '#/components/headers/RateLimitReset'
            X-RateLimit-Mode:
              $ref: '#/components/headers/RateLimitMode'
            Retry-After:
              description: Seconds to wait before retrying the upload
              schema:
                type: integer
                minimum: 1
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                  error_code:
                    type: string
                    enum:
                      - INTERNAL_ERROR
                  key_metadata:
                    $ref: '#/components/schemas/KeyMetadata'
                  request_id:
                    $ref: '#/components/schemas/RequestId'
                required:
                  - request_id
      security:
        - bearerAuth: []
components:
  parameters:
    RequestTags:
      name: tags
      in: query
      required: false
      style: form
      explode: false
      schema:
        $ref: '#/components/schemas/RequestTags'
      description: >-
        Comma-separated labels for filtering usage, e.g.
        `production,team-alpha`.
      example: production,team-alpha
  headers:
    RequestId:
      description: Unique ID of this request; also `request_id` in JSON bodies.
      schema:
        type: string
        format: uuid
    RateLimitLimit:
      description: >-
        Maximum request units per minute, or maximum concurrent requests when
        X-RateLimit-Mode is concurrency.
      schema:
        type: integer
        minimum: 1
    RateLimitRemaining:
      description: >-
        Request units remaining in the current minute, or concurrent requests
        still available when X-RateLimit-Mode is concurrency.
      schema:
        type: integer
        minimum: 0
    RateLimitReset:
      description: >-
        Unix timestamp in seconds when the per-minute rate limit resets. Omitted
        for concurrency limits.
      schema:
        type: integer
    RateLimitMode:
      description: >-
        Set to concurrency when the organization is limited by concurrent
        requests. Omitted for per-minute limits.
      schema:
        type: string
        enum:
          - concurrency
  schemas:
    KeyMetadata:
      type: object
      properties:
        credits_consumed:
          type: integer
          description: Credits charged for this request.
        credits_remaining:
          type: integer
          description: Credits remaining for your organization.
      required:
        - credits_consumed
        - credits_remaining
      description: Credits this request used and your remaining balance.
    RequestId:
      type: string
      format: uuid
      description: >-
        Unique ID of this request, also in `X-Request-Id`. Include it when
        contacting support.
      example: 3f1c2a6e-8b4d-4c1e-9f0a-2d7b5e6c8a91
    RequestTags:
      type: array
      items:
        type: string
        minLength: 1
        maxLength: 50
      maxItems: 20
      description: Labels for filtering usage in the dashboard.
      example:
        - production
        - team-alpha
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        Send `Authorization: Bearer <API_KEY>`. Keys have full access unless
        restricted to scopes.

````