Skip to main content
GET
/
v1
/
classifications
from datetime import datetime
from retab import Retab

client = Retab()

classifications = client.classifications.list(limit=20, order="desc")
for c in classifications.data:
    print(f"{c.id}: {c.output.category}")

# Filter by date range
classifications = client.classifications.list(
    from_date=datetime(2024, 1, 1),
    to_date=datetime(2024, 12, 31),
    limit=50,
)
{
  "data": [
    {
      "id": "cls_01G34H8J2K",
      "organization_id": "org_abc123",
      "file": {
        "id": "file_6dd6eb00688ad8d1",
        "filename": "invoice.pdf",
        "mime_type": "application/pdf"
      },
      "model": "retab-small",
      "output": {
        "category": "invoice",
        "reasoning": "Contains line items and a total amount due."
      },
      "created_at": "2024-03-15T10:30:00Z",
      "updated_at": "2024-03-15T10:30:00Z"
    }
  ],
  "list_metadata": {
    "before": null,
    "after": "cls_01G34H8J2K",
    "total_count": 42
  }
}
List persisted classifications for your organization, with cursor-based pagination.
from datetime import datetime
from retab import Retab

client = Retab()

classifications = client.classifications.list(limit=20, order="desc")
for c in classifications.data:
    print(f"{c.id}: {c.output.category}")

# Filter by date range
classifications = client.classifications.list(
    from_date=datetime(2024, 1, 1),
    to_date=datetime(2024, 12, 31),
    limit=50,
)
{
  "data": [
    {
      "id": "cls_01G34H8J2K",
      "organization_id": "org_abc123",
      "file": {
        "id": "file_6dd6eb00688ad8d1",
        "filename": "invoice.pdf",
        "mime_type": "application/pdf"
      },
      "model": "retab-small",
      "output": {
        "category": "invoice",
        "reasoning": "Contains line items and a total amount due."
      },
      "created_at": "2024-03-15T10:30:00Z",
      "updated_at": "2024-03-15T10:30:00Z"
    }
  ],
  "list_metadata": {
    "before": null,
    "after": "cls_01G34H8J2K",
    "total_count": 42
  }
}

Query Parameters

before
string
Cursor for backward pagination.
after
string
Cursor for forward pagination.
limit
integer
default:"10"
Maximum number of classifications to return.
order
string
default:"desc"
Sort order by created_at. Valid values: asc, desc.
filename
string
Case-insensitive substring filter applied to file.filename.
from_date
string
Return classifications created on or after this date, in YYYY-MM-DD format.
to_date
string
Return classifications created on or before this date, in YYYY-MM-DD format.

Count

To fetch only the number of classifications matching a filter, use:
GET /v1/classifications/count?filename=invoice&from_date=2024-01-01
which returns { "count": <int> }.

Authorizations

Api-Key
string
header
required

Query Parameters

before
string | null
after
string | null
limit
integer
default:10
order
enum<string>
default:desc
Available options:
asc,
desc
filename
string | null
from_date
string | null
to_date
string | null
access_token
string | null

Response

Successful Response

data
any[]
required
list_metadata
ListMetadata · object
required