PDF Processing API Documentation

This document outlines how to use the PDF processing API endpoint for converting PDFs to markdown and storing them.

Example Requests

File upload:

1 2 3 4 curl -X POST https://backend.readpdfs.com/process_pdf/?uploadFile=true \ -H "x-api-key: your_api_key_here" \ -H "Content-Type: multipart/form-data" \ -F "file=@/path/to/your/file.pdf"

URL processing:

1 2 3 4 curl -X POST https://backend.readpdfs.com/process_pdf/ \ -H "x-api-key: your_api_key_here" \ -H "Content-Type: application/json" \ -d '{"pdf_url": "https://example.com/your-pdf-file.pdf"}'

Supported File Types

  • PDF
  • JPG/JPEG
  • PNG

Request Body

The request body can be either multipart/form-data (for file uploads) or JSON (for providing a URL):

For file upload:

1 2 3 4 5 Content-Type: multipart/form-data file: [Your file] uploadFile: true quality: standard (or high)

For URL processing:

1 2 3 4 5 6 Content-Type: application/json { "pdf_url": "https://example.com/your-pdf-file.pdf", "quality": "standard" (or "high") }

Example Request (cURL)

Here's an example of how to make a request to the PDF processing API:

File upload:

1 2 3 4 curl -X POST https://backend.readpdfs.com/process_pdf/?uploadFile=true&quality=high \ -H "x-api-key: your_api_key_here" \ -H "Content-Type: multipart/form-data" \ -F "file=@/path/to/your/file.pdf"

URL processing:

1 2 3 4 curl -X POST https://backend.readpdfs.com/process_pdf/?quality=standard \ -H "x-api-key: your_api_key_here" \ -H "Content-Type: application/json" \ -d '{"pdf_url": "https://example.com/your-pdf-file.pdf"}'

Example Request (cURL)

Here's an example of how to make a request to the PDF processing API:

File upload:

1 2 3 4 curl -X POST https://backend.readpdfs.com/process_pdf/?uploadFile=true \ -H "x-api-key: your_api_key_here" \ -H "Content-Type: multipart/form-data" \ -F "file=@/path/to/your/file.pdf"

URL processing:

1 2 3 4 curl -X POST https://backend.readpdfs.com/process_pdf/ \ -H "x-api-key: your_api_key_here" \ -H "Content-Type: application/json" \ -d '{"pdf_url": "https://example.com/your-pdf-file.pdf"}'

Response

The API will respond with a JSON object containing the following information:

1 2 3 4 5 { "document_id": "uuid", "markdown_text": "https://example.com/path/to/markdown_file.md", "credits_used": 10 }

Error Responses

The API may return the following error responses:

Rate Limiting and Usage

Please note that usage of this API is subject to rate limiting and credit consumption. Ensure that you have sufficient credits in your account before making requests.

For any questions or support, please contact our support team.