Skip to content

API reference

Batches

A batch is one extraction run over one or more files: its status, rows and downloads.

The Batch object

  • created_atintegerRequired

    At least 0.

  • updated_atintegerRequired

    At least 0.

  • idstringRequired

    1 to 48 characters.

  • project_idstringRequired

    1 to 48 characters.

  • table_idstringRequirednullable

    1 to 48 characters.

  • actor_typestringRequired
    Allowed values
    userapi_key
  • actor_idstringRequired

    Up to 36 characters.

  • schema_jsonobjectRequired
The Batch objectjson
{  "created_at": 1711468800000,  "updated_at": 1711468800000,  "id": "batch_01h5a3g8k9m2n4p6q8r0t2v4x6",  "project_id": "string",  "table_id": "string",  "actor_type": "user",  "actor_id": "string",  "schema_json": {    "columns": [      {        "description": "string",        "instruction": "string",        "name": "string",        "type": "string"      }    ],    "instruction": "string",    "strictness": "strict"  },  "insert_mode": "append",  "status": "uploading",  "file_count": 42,  "files_done": 42,  "current_file": "string",  "csv_key": "string",  "json_key": "string",  "xlsx_key": "string",  "total_rows": 42,  "confidence": 0.5,  "duration_ms": 42,  "error": "string",  "extractions": [    {      "created_at": 1711468800000,      "id": "extr_01h5a3g8k9m2n4p6q8r0t2v4x6",      "batch_id": "string",      "table_id": "string",      "file_key": "string",      "file_name": "string",      "file_type": "text_pdf",      "file_checksum": "string",      "status": "pending",      "rows_key": "string",      "row_count": 42,      "confidence": 0.5,      "error": "string"    }  ]}

List batches

GET/v1/projects/{project_id}/batches

Path parameters

  • project_idstringRequired

Query parameters

  • cursorstringoptional

    Opaque cursor for forward pagination. Pass the nextCursor from the previous response with the same order. Takes precedence over page when both are sent.

  • pageintegeroptional

    1-based page number for offset pagination. Ignored when cursor is present.

    At least 1.

  • orderstringoptional

    Sort keys, comma-separated, each field[.asc|.desc][.nullsfirst|.nullslast]; at most 3. Sortable: created_at, status, total_rows. Default: created_at.desc. Nulls sort last ascending and first descending unless stated.

    Matches
    ^(?:created_at|status|total_rows)(?:\.(?:asc|desc))?(?:\.(?:nullsfirst|nullslast))?(?:,(?:created_at|status|total_rows)(?:\.(?:asc|desc))?(?:\.(?:nullsfirst|nullslast))?){0,2}$
  • limitintegeroptional

    Maximum number of items per page. Defaults to 20, capped by the endpoint's maxLimit.

    Default
    20

    Between 1 and 100.

  • statusstringoptional
    Allowed values
    uploadingprocessingmergingcompletepartialfailed

Returns

200application/json

  • countintegerRequired

    At least 0.

  • hasMorebooleanRequired
  • limitintegerRequired

    At least 1.

  • nextCursorstringRequirednullable
  • pageintegerRequirednullable

    At least 1.

  • batchesarray of objectsRequired
import { AnyrowSDK } from "@anyrow/sdk"const anyrow = new AnyrowSDK({  baseURL: "https://api.anyrow.ai",  headers: { Authorization: `ApiKey ${process.env.ANYROW_API_KEY}` },})const { data, error } = await anyrow.batch.list({  params: {    project_id: "{project_id}"  },})
{  "count": 0,  "hasMore": true,  "limit": 1,  "nextCursor": "string",  "page": 1,  "batches": [    {      "created_at": 1711468800000,      "updated_at": 1711468800000,      "id": "batch_01h5a3g8k9m2n4p6q8r0t2v4x6",      "project_id": "string",      "table_id": "string",      "actor_type": "user",      "actor_id": "string",      "schema_json": {        "columns": [          {            "description": "string",            "instruction": "string",            "name": "string",            "type": "string"          }        ],        "instruction": "string",        "strictness": "strict"      },      "insert_mode": "append",      "status": "uploading",      "file_count": 42,      "files_done": 42,      "current_file": "string",      "csv_key": "string",      "json_key": "string",      "xlsx_key": "string",      "total_rows": 42,      "confidence": 0.5,      "duration_ms": 42,      "error": "string"    }  ]}

Get batch

GET/v1/projects/{project_id}/batches/{batch_id}

Path parameters

  • project_idstringRequired
  • batch_idstringRequired

Returns

200application/json

  • created_atintegerRequired

    At least 0.

  • updated_atintegerRequired

    At least 0.

  • idstringRequired

    1 to 48 characters.

  • project_idstringRequired

    1 to 48 characters.

  • table_idstringRequirednullable

    1 to 48 characters.

  • actor_typestringRequired
    Allowed values
    userapi_key
  • actor_idstringRequired

    Up to 36 characters.

  • schema_jsonobjectRequired
  • insert_modestringRequirednullable
    Allowed values
    appenddedupmergereplace
  • statusstringRequired
    Allowed values
    uploadingprocessingmergingcompletepartialfailed
  • file_countintegerRequired

    At least 1.

  • files_doneintegerRequired

    At least 0.

  • current_filestringRequirednullable

    Up to 255 characters.

  • csv_keystringRequirednullable

    Up to 512 characters.

  • json_keystringRequirednullable

    Up to 512 characters.

  • xlsx_keystringRequirednullable

    Up to 512 characters.

  • total_rowsintegerRequirednullable

    At least 0.

  • confidencenumberRequirednullable
  • duration_msintegerRequirednullable

    At least 0.

  • errorstringRequirednullable

    Up to 2048 characters.

  • extractionsarray of objectsoptional

Errors

  • 404batch_not_foundnot_found
Errors every endpoint can return
import { AnyrowSDK } from "@anyrow/sdk"const anyrow = new AnyrowSDK({  baseURL: "https://api.anyrow.ai",  headers: { Authorization: `ApiKey ${process.env.ANYROW_API_KEY}` },})const { data, error } = await anyrow.batch.get({  params: {    project_id: "{project_id}",    batch_id: "{batch_id}"  },})
{  "created_at": 1711468800000,  "updated_at": 1711468800000,  "id": "batch_01h5a3g8k9m2n4p6q8r0t2v4x6",  "project_id": "string",  "table_id": "string",  "actor_type": "user",  "actor_id": "string",  "schema_json": {    "columns": [      {        "description": "string",        "instruction": "string",        "name": "string",        "type": "string"      }    ],    "instruction": "string",    "strictness": "strict"  },  "insert_mode": "append",  "status": "uploading",  "file_count": 42,  "files_done": 42,  "current_file": "string",  "csv_key": "string",  "json_key": "string",  "xlsx_key": "string",  "total_rows": 42,  "confidence": 0.5,  "duration_ms": 42,  "error": "string",  "extractions": [    {      "created_at": 1711468800000,      "id": "extr_01h5a3g8k9m2n4p6q8r0t2v4x6",      "batch_id": "string",      "table_id": "string",      "file_key": "string",      "file_name": "string",      "file_type": "text_pdf",      "file_checksum": "string",      "status": "pending",      "rows_key": "string",      "row_count": 42,      "confidence": 0.5,      "error": "string"    }  ]}

Download batch CSV

GET/v1/projects/{project_id}/batches/{batch_id}/download/csv

Path parameters

  • project_idstringRequired
  • batch_idstringRequired

Returns

No response body; the request succeeds or returns an error.

Errors

  • 404batch_not_foundnot_found
Errors every endpoint can return
import { AnyrowSDK } from "@anyrow/sdk"const anyrow = new AnyrowSDK({  baseURL: "https://api.anyrow.ai",  headers: { Authorization: `ApiKey ${process.env.ANYROW_API_KEY}` },})const { data, error } = await anyrow.batch.download.csv({  params: {    project_id: "{project_id}",    batch_id: "{batch_id}"  },})

Download batch JSON

GET/v1/projects/{project_id}/batches/{batch_id}/download/json

Path parameters

  • project_idstringRequired
  • batch_idstringRequired

Returns

No response body; the request succeeds or returns an error.

Errors

  • 404batch_not_foundnot_found
Errors every endpoint can return
import { AnyrowSDK } from "@anyrow/sdk"const anyrow = new AnyrowSDK({  baseURL: "https://api.anyrow.ai",  headers: { Authorization: `ApiKey ${process.env.ANYROW_API_KEY}` },})const { data, error } = await anyrow.batch.download.json({  params: {    project_id: "{project_id}",    batch_id: "{batch_id}"  },})

Download batch XLSX

GET/v1/projects/{project_id}/batches/{batch_id}/download/xlsx

Path parameters

  • project_idstringRequired
  • batch_idstringRequired

Returns

No response body; the request succeeds or returns an error.

Errors

  • 404batch_not_foundnot_found
Errors every endpoint can return
import { AnyrowSDK } from "@anyrow/sdk"const anyrow = new AnyrowSDK({  baseURL: "https://api.anyrow.ai",  headers: { Authorization: `ApiKey ${process.env.ANYROW_API_KEY}` },})const { data, error } = await anyrow.batch.download.xlsx({  params: {    project_id: "{project_id}",    batch_id: "{batch_id}"  },})