POST
/
rag
RAG File
curl --request POST \
  --url https://api.trycardinal.ai/rag \
  --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 ephemeral=false \
  --form markdown=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,
      "bounding_boxes": [
        {
          "bounding_box": {
            "min_x": 0.612,
            "min_y": 0.3879,
            "max_x": 3.505,
            "max_y": 0.922
          },
          "content": "LTC6102 LTC6102-1/LTC6102HV"
        },
        {
          "bounding_box": {
            "min_x": 0.6104,
            "min_y": 1.1276,
            "max_x": 7.8187,
            "max_y": 1.6839
          },
          "content": "ELECTRICAL CHARACTERISTICS (LTC6102, LTC6102-1) The . denotes the specifications..."
        }
      ],
      "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
          }
        }
      ]
    }
  ],
  "pagination": {
    "start_page": 1,
    "end_page": 1,
    "page_limit": 100,
    "has_more_pages": false,
    "next_start_page": null,
    "total_pages": 1,
    "current_batch": "1-1",
    "remaining_pages": 0
  }
}

Authorizations

x-api-key
string
header
required

Body

multipart/form-data
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 detections in each page of the response.

densePdfDetect
boolean
default:false

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

signatureDetect
boolean
default:false

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

startPage
integer
default:1

Page number to start processing from.

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 content fields. By default, tables remain HTML to preserve structure. If true, tables are converted to Markdown via markdownify (may reduce fidelity).

Response

Successful document processing response

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