We’re working hard to make DeepSeek‑OCR accessible to everyone. Target launch: 2025‑10‑30. Need access sooner?

DeepSeek‑OCR API Documentation

Developer documentation for accessing the OCR service via HTTP API.

Overview

The OCR API extracts clean text from uploaded PDFs or images. Optionally include a prompt to guide extraction.

Base URL

https://api.deepsee-ocr.ai

Authentication

Authenticate requests using a Bearer token. Include your API key in the Authorization header.

Authorization: Bearer <YOUR_API_KEY>

Best practice: store your key in an environment variable like DEEPSEEK_OCR_API_KEY.

OCR Endpoint

Upload a file (PDF or image) and optional prompt; receive extracted text.

POST /v1/ocr
Content-Type: multipart/form-data

Form fields

  • file (required): The PDF or image to process.
  • prompt (optional): Instruction to guide extraction (e.g., focus on tables).
  • language (optional): ISO code to hint language, e.g., en, zh.

Response

Returns extracted text content as JSON.

{
  "text": "...extracted text content..."
}

Curl example

curl -X POST   https://api.deepsee-ocr.ai/v1/ocr   -H "Authorization: Bearer $DEEPSEEK_OCR_API_KEY"   -H "Accept: application/json"   -F file=@/path/to/file.pdf   -F prompt="Extract plain text"

JavaScript example (Node)

import fs from 'node:fs';
import FormData from 'form-data';
import fetch from 'node-fetch';

const form = new FormData();
form.append('file', fs.createReadStream('/path/to/file.pdf'));
form.append('prompt', 'Extract plain text');

const res = await fetch('https://api.deepsee-ocr.ai/v1/ocr', {
  method: 'POST',
  headers: { Authorization: 'Bearer ' + process.env.DEEPSEEK_OCR_API_KEY },
  body: form,
});
const data = await res.json();
console.log(data.text);

Python example

import os
import requests

url = 'https://api.deepsee-ocr.ai/v1/ocr'
headers = {
    'Authorization': f"Bearer {os.environ['DEEPSEEK_OCR_API_KEY']}",
    'Accept': 'application/json',
}
files = { 'file': open('/path/to/file.pdf', 'rb') }
data = { 'prompt': 'Extract plain text' }

r = requests.post(url, headers=headers, files=files, data=data)
r.raise_for_status()
print(r.json()['text'])

Rate Limits

To ensure fair usage and service stability, requests are rate-limited per API key.

  • Default: 100 requests per minute per API key.
  • Bursts may be temporarily throttled during high load.

Exceeded limits return HTTP 429 Too Many Requests.

HTTP/1.1 429 Too Many Requests
Content-Type: application/json

{ "error": "rate_limit_exceeded", "retry_after": 15 }

Errors

  • 400 Invalid request (missing file or unsupported type).
  • 401 Unauthorized (missing or invalid API key).
  • 413 Payload too large.
  • 429 Rate limit exceeded.
  • 500 Server error.

Notes

  • Use HTTPS endpoints only.
  • Prefer PDF uploads for multi-page documents.
  • Prompts can nudge extraction (e.g., "focus on text").