Skip to main content
POST
/
markdown
Markdown File
curl --request POST \
  --url https://api.trycardinal.ai/markdown \
  --header 'Content-Type: multipart/form-data' \
  --header 'x-api-key: <api-key>' \
  --form 'fileUrl=<string>' \
  --form imageMetadataDetect=false \
  --form barcodeDetect=false \
  --form densePdfDetect=false \
  --form signatureDetect=false \
  --form startPage=1 \
  --form endPage=null \
  --form ephemeral=false \
  --form markdown=false \
  --form markdownPreserveTables=false \
  --form digitizeFigures=false \
  --form file=@example-file
{
  "success": true,
  "total_pages": 2,
  "successful_pages": 2,
  "failed_pages": 0,
  "pages": [
    {
      "content": "ACME CORPORATION\nInvoice #INV-2024-001\n...",
      "height": 792,
      "width": 612,
      "barcodes": [
        {
          "type": "QR",
          "value": "INV-2024-001",
          "bounding_box": {
            "x": 510,
            "y": 80,
            "w": 72,
            "h": 72
          }
        }
      ],
      "signatures": [
        {
          "label": "Authorized Signature",
          "confidence": 0.98,
          "bounding_box": {
            "x": 180,
            "y": 650,
            "w": 240,
            "h": 80
          }
        }
      ],
      "processed_tables": [
        {
          "id": "tbl_1",
          "format": "html",
          "html": "<table>...</table>"
        }
      ],
      "image_metadata": [
        {
          "kind": "photo",
          "dpi": 300,
          "mode": "gray",
          "bounding_box": {
            "x": 40,
            "y": 120,
            "w": 300,
            "h": 180
          }
        }
      ]
    },
    {
      "content": "Payment Terms\nNet 30...",
      "height": 792,
      "width": 612,
      "barcodes": [],
      "signatures": [],
      "processed_tables": [],
      "image_metadata": []
    }
  ],
  "pagination": {
    "start_page": 1,
    "end_page": 2,
    "page_limit": 100,
    "has_more_pages": false,
    "next_start_page": null,
    "total_pages": 2,
    "current_batch": "1-2",
    "remaining_pages": 0
  }
}

Authorizations

x-api-key
string
header
required

Body

multipart/form-data
  • Option 1
  • Option 2
file
file
required

PDF or image file to upload (required if no fileUrl).

fileUrl
string<uri>

Publicly accessible URL of the file to process (required if no file).

imageMetadataDetect
boolean
default:false

If true, includes image metadata in each page of the response.

barcodeDetect
boolean
default:false

If true, includes barcode detection results in each page of the response.

densePdfDetect
boolean
default:false

If true, includes dense tables in each page of the response.

signatureDetect
boolean
default:false

If true, includes signature detection results in each page of the response.

startPage
integer
default:1

Page number to start processing from.

endPage
integer | null

Page number to end processing at.

ephemeral
boolean
default:false

We return cropped images by default as presigned URLs. If true, these images are not stored and the URL field will contain a base64 string.

markdown
boolean
default:false

Controls table handling in output. By default, tables remain HTML to preserve structure. If true, tables are converted to Markdown via markdownify (may reduce fidelity).

markdownPreserveTables
boolean
default:false

Controls table handling in output. When true, tables remain as HTML while other content converts to Markdown. When false, follows default behavior (everything as HTML if tables present) or converts everything to Markdown if 'markdown' is true.

digitizeFigures
boolean
default:false

If true, figures are digitized and returned as HTML.

Response

Successful document processing response

success
boolean
required
pages
object[]
required
total_pages
integer
successful_pages
integer
failed_pages
integer
pagination
object