Skip to main content

Prerequisites

  1. An Aifano account — sign up at studio.aifano.com
  2. An API key (starts with ak_live_)

Step 1: Get Your API Key

Navigate to Settings → API Keys in the Aifano Studio and create a new API key. Store it securely — you won’t be able to see it again.
export AIFANO_API_KEY="ak_live_your_key_here"

Step 2: Parse a Document

curl -X POST "https://platform.aifano.com/parse" \
  -H "Authorization: Bearer $AIFANO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "input": "https://example.com/sample.pdf"
  }'

Step 3: Upload and Parse a Local File

If your document isn’t publicly accessible, upload it first:
# Upload the file
curl -X POST "https://platform.aifano.com/upload" \
  -H "Authorization: Bearer $AIFANO_API_KEY" \
  -F "file=@/path/to/document.pdf"

# Parse using the returned file reference
curl -X POST "https://platform.aifano.com/parse" \
  -H "Authorization: Bearer $AIFANO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"input": "aifano://abc123def456.pdf"}'

Understanding the Response

{
  "job_id": "job_abc123",
  "duration": 2.34,
  "usage": {
    "num_pages": 5,
    "credits": 5
  },
  "result": {
    "type": "full",
    "chunks": [
      {
        "content": "# Introduction\n\nThis document covers...",
        "embed": "Introduction. This document covers...",
        "blocks": [
          {
            "type": "Title",
            "content": "Introduction",
            "bbox": { "left": 0.1, "top": 0.05, "width": 0.8, "height": 0.04, "page": 1 }
          }
        ]
      }
    ]
  }
}
Key fields:
  • chunks — Document content split into logical sections
  • blocks — Individual elements (text, tables, figures) with bounding boxes
  • usage — Pages processed and credits consumed

Next Steps