{
  "openapi": "3.0.3",
  "info": {
    "title": "PDF to Text & Markdown API",
    "version": "1.0.0",
    "description": "Extract text and Markdown from public PDF URLs. Responses are JSON {count, limit, results[], request_id}; errors are {error:{code,message,param?},request_id}. Requests are capped per call and time out after 25 seconds. Try it without a key at https://api.impakt.dev. Demo calls are capped at 5 per address per day and $0.50 for everyone per UTC day."
  },
  "servers": [
    {
      "url": "https://api.impakt.dev",
      "description": "Public API at https://api.impakt.dev."
    }
  ],
  "tags": [
    {
      "name": "PDF"
    }
  ],
  "paths": {
    "/pdf/extract": {
      "post": {
        "operationId": "extractPdf",
        "tags": [
          "PDF"
        ],
        "summary": "Extract text and Markdown from PDF URLs",
        "description": "Up to 2 public PDF URLs per call (files up to 15 MB, up to 50 pages each). Private or local addresses are blocked.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "urls"
                ],
                "properties": {
                  "urls": {
                    "type": "array",
                    "minItems": 1,
                    "maxItems": 2,
                    "items": {
                      "type": "string",
                      "format": "uri"
                    },
                    "example": [
                      "https://arxiv.org/pdf/1706.03762"
                    ]
                  },
                  "format": {
                    "type": "string",
                    "enum": [
                      "both",
                      "text",
                      "markdown"
                    ],
                    "default": "both"
                  },
                  "max_pages": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 50,
                    "default": 30
                  },
                  "include_pages": {
                    "type": "boolean",
                    "default": false,
                    "description": "Add per-page text."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PdfResponse"
                },
                "example": {
                  "count": 1,
                  "limit": 1,
                  "results": [
                    {
                      "url": "https://arxiv.org/pdf/1706.03762",
                      "status": "ok",
                      "error": null,
                      "title": null,
                      "author": null,
                      "subject": null,
                      "creator": "LaTeX with hyperref",
                      "producer": "pdfTeX-1.40.25",
                      "createdAt": "2024-04-10T21:11:43.000Z",
                      "modifiedAt": "2024-04-10T21:11:43.000Z",
                      "pdfVersion": "1.5",
                      "pageCount": 15,
                      "pagesExtracted": 15,
                      "truncated": false,
                      "charCount": 38344,
                      "wordCount": 5879,
                      "needsOcr": false,
                      "text": "Provided proper attribution is provided, Google hereby grants permission to reproduce the tables and figures in this paper solely for use in journalistic or sch…",
                      "markdown": "Provided proper attribution is provided, Google hereby grants permission to reproduce the tables and figures in this paper solely for use in journalistic or sch…",
                      "sha256": "bdfaa68d8984f0dc02beaca527b76f207d99b666d31d1da728ee0728182df697",
                      "fileSizeBytes": 2215244,
                      "processingMs": 771,
                      "extractedAt": "2026-11-19T13:23:52.959Z"
                    }
                  ],
                  "request_id": "00000000-0000-4000-8000-000000000000"
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameter or body.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Missing or invalid marketplace secret (call through the marketplace).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "The backend rejected the input.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Temporarily unavailable or daily capacity reached. Retry later.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "504": {
            "description": "Took longer than 25 seconds; reduce the amount of work.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "PdfExtraction": {
        "type": "object",
        "properties": {
          "url": {
            "type": "string"
          },
          "status": {
            "type": "string"
          },
          "error": {
            "nullable": true,
            "type": "string"
          },
          "title": {
            "type": "string",
            "nullable": true
          },
          "author": {
            "type": "string",
            "nullable": true
          },
          "subject": {
            "type": "string",
            "nullable": true
          },
          "creator": {
            "type": "string"
          },
          "producer": {
            "type": "string"
          },
          "createdAt": {
            "type": "string"
          },
          "modifiedAt": {
            "type": "string"
          },
          "pdfVersion": {
            "type": "string"
          },
          "pageCount": {
            "type": "integer"
          },
          "pagesExtracted": {
            "type": "integer"
          },
          "truncated": {
            "type": "boolean"
          },
          "charCount": {
            "type": "integer"
          },
          "wordCount": {
            "type": "integer"
          },
          "needsOcr": {
            "type": "boolean"
          },
          "text": {
            "type": "string",
            "description": "Omitted when format is markdown."
          },
          "markdown": {
            "type": "string",
            "description": "Omitted when format is text."
          },
          "sha256": {
            "type": "string"
          },
          "fileSizeBytes": {
            "type": "integer"
          },
          "processingMs": {
            "type": "integer"
          },
          "extractedAt": {
            "type": "string"
          }
        },
        "description": "One PdfExtraction record. Fields not offered by a source are null; some fields are omitted depending on the request (see property descriptions)."
      },
      "PdfResponse": {
        "type": "object",
        "required": [
          "count",
          "limit",
          "results",
          "request_id"
        ],
        "properties": {
          "count": {
            "type": "integer",
            "description": "Number of records returned."
          },
          "limit": {
            "type": "integer",
            "description": "Maximum records for this call."
          },
          "results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PdfExtraction"
            }
          },
          "request_id": {
            "type": "string",
            "format": "uuid"
          }
        }
      },
      "Error": {
        "type": "object",
        "required": [
          "error"
        ],
        "properties": {
          "error": {
            "type": "object",
            "required": [
              "code",
              "message"
            ],
            "properties": {
              "code": {
                "type": "string",
                "example": "invalid_parameter"
              },
              "message": {
                "type": "string"
              },
              "param": {
                "type": "string"
              }
            }
          },
          "request_id": {
            "type": "string",
            "format": "uuid"
          }
        }
      }
    }
  }
}
