Skip to main content
GET
https://commodityai.app
/
api
/
v1
/
sources
/
{id}
/
records
/
{recordId}
/
sources
curl -X GET "https://commodityai.app/api/v1/sources/123e4567-e89b-12d3-a456-426614174000/records/550e8400-e29b-41d4-a716-446655440000/sources" \
  -H "Authorization: Bearer cai_live_your_api_key_here"
{
  "data": {
    "documents": [
      {
        "id": "550e8400-e29b-41d4-a716-446655440000",
        "filename": "invoice_pages_1-3.pdf",
        "mime_type": "application/pdf",
        "size": 245000,
        "page_start": 1,
        "page_end": 3,
        "classification": "invoices",
        "uploaded_at": "2024-01-15T10:30:00Z",
        "download_url": "https://storage.example.com/signed/...",
        "download_url_expires_at": "2024-01-15T11:30:00Z",
        "is_primary": true
      },
      {
        "id": "660e8400-e29b-41d4-a716-446655440001",
        "filename": "invoice_pages_4-5.pdf",
        "mime_type": "application/pdf",
        "size": 180000,
        "page_start": 4,
        "page_end": 5,
        "classification": "invoices",
        "uploaded_at": "2024-01-15T10:30:00Z",
        "download_url": "https://storage.example.com/signed/...",
        "download_url_expires_at": "2024-01-15T11:30:00Z",
        "is_primary": false
      }
    ],
    "files": [
      {
        "id": "770e8400-e29b-41d4-a716-446655440002",
        "filename": "invoice_packet.pdf",
        "mime_type": "application/pdf",
        "size": 1245000,
        "page_count": 10,
        "download_url": "https://storage.example.com/signed/...",
        "download_url_expires_at": "2024-01-15T11:30:00Z"
      }
    ]
  }
}
Returns the source documents and files associated with a source record, including signed download URLs with a 1-hour expiry. Useful for downloading the original documents that a record was extracted from.

Path Parameters

id
string
required
The unique identifier (UUID) of the source record definition
recordId
string
required
The unique identifier (UUID) of the source record

Request Examples

curl -X GET "https://commodityai.app/api/v1/sources/123e4567-e89b-12d3-a456-426614174000/records/550e8400-e29b-41d4-a716-446655440000/sources" \
  -H "Authorization: Bearer cai_live_your_api_key_here"

Response

{
  "data": {
    "documents": [
      {
        "id": "550e8400-e29b-41d4-a716-446655440000",
        "filename": "invoice_pages_1-3.pdf",
        "mime_type": "application/pdf",
        "size": 245000,
        "page_start": 1,
        "page_end": 3,
        "classification": "invoices",
        "uploaded_at": "2024-01-15T10:30:00Z",
        "download_url": "https://storage.example.com/signed/...",
        "download_url_expires_at": "2024-01-15T11:30:00Z",
        "is_primary": true
      },
      {
        "id": "660e8400-e29b-41d4-a716-446655440001",
        "filename": "invoice_pages_4-5.pdf",
        "mime_type": "application/pdf",
        "size": 180000,
        "page_start": 4,
        "page_end": 5,
        "classification": "invoices",
        "uploaded_at": "2024-01-15T10:30:00Z",
        "download_url": "https://storage.example.com/signed/...",
        "download_url_expires_at": "2024-01-15T11:30:00Z",
        "is_primary": false
      }
    ],
    "files": [
      {
        "id": "770e8400-e29b-41d4-a716-446655440002",
        "filename": "invoice_packet.pdf",
        "mime_type": "application/pdf",
        "size": 1245000,
        "page_count": 10,
        "download_url": "https://storage.example.com/signed/...",
        "download_url_expires_at": "2024-01-15T11:30:00Z"
      }
    ]
  }
}

Response Fields

data
object
Container for documents and files
Documents vs Files: A file is the original uploaded document (e.g., a 10-page PDF). A document is a page range extracted from a file during processing (e.g., pages 1-3 classified as an invoice). A single file may produce multiple documents.

Response Headers

All successful responses include rate limit headers to help you monitor your API usage:
X-RateLimit-Limit-Minute
number
Maximum number of requests allowed per minute (100)
X-RateLimit-Remaining-Minute
number
Number of requests remaining in the current minute
X-RateLimit-Reset-Minute
number
Unix timestamp (in seconds) when the per-minute limit resets
X-RateLimit-Limit-Day
number
Maximum number of requests allowed per day (10,000)
X-RateLimit-Remaining-Day
number
Number of requests remaining in the current day
X-RateLimit-Reset-Day
number
Unix timestamp (in seconds) when the daily limit resets
For more information on rate limits and how to handle them, see Rate Limits.

Error Codes

StatusCodeDescription
401unauthorizedInvalid or missing API key
404not_foundSource record definition or record not found
429rate_limit_exceededToo many requests (see Rate Limits)
500internal_errorInternal server error