Skip to content
中文

Batches

Quickstart: official Python SDK

Base URL and authentication

Use existing resource IDs in paths. Set the environment variables shown in each example.

Create file batch

POST /knowledge/v1/vector_stores/{vector_store_id}/file_batches

Attaches existing Files as a batch for asynchronous ingestion. Supply exactly one of file_ids or files; files allows per-file settings. Existing attachments are reused. Read the returned batch id to monitor status.

Parameters

NameLocation and typeDescription
vector_store_idpath: stringRequired; Knowledge-base ID returned by create or list; use the ID rather than its display name. min characters: 1

Request body

Provide exactly one of file_ids or files. Already attached files are reused without changing their attributes or chunking.

Field Type Description
(1).file_ids string[] required; Existing File IDs to attach with shared attributes and chunking settings. Supply file_ids or files, never both.; min items: 1; max items: 500
(1).attributes object / null optional; Search-filter attributes applied to each newly attached file; omission or null leaves them unset.
(1).chunking_strategy object / object / object optional; Native attachment strategy. auto uses static chunks of 800 estimated tokens with 400 overlap; static supplies explicit chunk sizes; hierarchical indexes child chunks and supplies bounded parent context. Existing attachments are reused unchanged; remove and reattach a file to change its strategy.; default: {"type":"auto"}
(1).chunking_strategy (1) (1).type "auto" required; auto uses the default static chunk size of 800 estimated tokens with 400 overlap tokens.
(1).chunking_strategy (1) (2).type "static" required; static selects explicit chunk-size and overlap settings.
(1).chunking_strategy (1) (2).static object required; Chunk-size and overlap limits in estimated tokens.
(1).chunking_strategy (1) (2).static.max_chunk_size_tokens integer required; Estimated tokens per chunk.; min: 100; max: 4096
(1).chunking_strategy (1) (2).static.chunk_overlap_tokens integer required; Must not exceed half of max_chunk_size_tokens.; min: 0; max: 2048
(1).chunking_strategy (2).type "hierarchical" required; hierarchical selects smaller child chunks for matching and larger parent chunks for context.
(1).chunking_strategy (2).hierarchical object required; Required parent, child and overlap sizes in estimated tokens. All three values must be integers.
(1).chunking_strategy (2).hierarchical.parent_max_tokens integer required; Maximum estimated tokens per parent chunk, from 101 through 4096; must exceed child_max_tokens.; min: 101; max: 4096
(1).chunking_strategy (2).hierarchical.child_max_tokens integer required; Maximum estimated tokens per child chunk, at least 100 and strictly smaller than parent_max_tokens.; min: 100; max: 4095
(1).chunking_strategy (2).hierarchical.child_overlap_tokens integer required; Estimated tokens shared by adjacent children, from zero through floor(child_max_tokens / 2).; min: 0; max: 2047
(2).files object[] required; Files to attach with individual attributes and chunking settings; top-level attributes and chunking_strategy are ignored.; min items: 1; max items: 500
(2).files[].file_id string required; Existing source File ID returned by file upload; the file must be visible to the caller.; min characters: 1
(2).files[].attributes object optional; File attributes used by search filters. Up to 16 keys of 64 characters; string values up to 512 characters.; max keys: 16; Key length ≤ 64; Values: string / number / boolean
(2).files[].chunking_strategy object / object / object optional; Native attachment strategy. auto uses static chunks of 800 estimated tokens with 400 overlap; static supplies explicit chunk sizes; hierarchical indexes child chunks and supplies bounded parent context. Existing attachments are reused unchanged; remove and reattach a file to change its strategy.; default: {"type":"auto"}
(2).files[].chunking_strategy (1) (1).type "auto" required; auto uses the default static chunk size of 800 estimated tokens with 400 overlap tokens.
(2).files[].chunking_strategy (1) (2).type "static" required; static selects explicit chunk-size and overlap settings.
(2).files[].chunking_strategy (1) (2).static object required; Chunk-size and overlap limits in estimated tokens.
(2).files[].chunking_strategy (1) (2).static.max_chunk_size_tokens integer required; Estimated tokens per chunk.; min: 100; max: 4096
(2).files[].chunking_strategy (1) (2).static.chunk_overlap_tokens integer required; Must not exceed half of max_chunk_size_tokens.; min: 0; max: 2048
(2).files[].chunking_strategy (2).type "hierarchical" required; hierarchical selects smaller child chunks for matching and larger parent chunks for context.
(2).files[].chunking_strategy (2).hierarchical object required; Required parent, child and overlap sizes in estimated tokens. All three values must be integers.
(2).files[].chunking_strategy (2).hierarchical.parent_max_tokens integer required; Maximum estimated tokens per parent chunk, from 101 through 4096; must exceed child_max_tokens.; min: 101; max: 4096
(2).files[].chunking_strategy (2).hierarchical.child_max_tokens integer required; Maximum estimated tokens per child chunk, at least 100 and strictly smaller than parent_max_tokens.; min: 100; max: 4095
(2).files[].chunking_strategy (2).hierarchical.child_overlap_tokens integer required; Estimated tokens shared by adjacent children, from zero through floor(child_max_tokens / 2).; min: 0; max: 2047
(2).attributes JSON optional; ignored: Ignored when files is supplied.
(2).chunking_strategy JSON optional; ignored: Ignored when files is supplied.

Request example

终端窗口
curl -X POST "https://api.deepraxis.com/knowledge/v1/vector_stores/${VECTOR_STORE_ID}/file_batches" \
-H "Authorization: Bearer $PRAXIS_API_KEY"

Response

HTTP 200

Field Type Description
id string required; Resource ID.; min characters: 1
object "vector_store.files_batch" required; Object discriminator; vector_store.files_batch identifies a batch of attached files.
vector_store_id string required; Resource ID.; min characters: 1
status "in_progress" / "completed" / "cancelled" / "failed" required; cancelled means the batch was cancelled; otherwise in_progress means a member is still ingesting, failed means ingestion ended with failed members, and completed means no pending or failed members remain. Cancelling a terminal batch leaves it unchanged.
file_counts object required; Counts of files still attached to the store or batch, grouped by ingestion status.
file_counts.in_progress integer required; Number of files waiting for or undergoing ingestion.; min: 0
file_counts.completed integer required; Number of files whose ingestion completed.; min: 0
file_counts.failed integer required; Number of files whose ingestion failed.; min: 0
file_counts.cancelled integer required; Number of files stopped by batch cancellation.; min: 0
file_counts.total integer required; Total attached files across all ingestion statuses.; min: 0
created_at integer required; Unix timestamp in seconds.

Error codes and objects

Retrieve file batch

GET /knowledge/v1/vector_stores/{vector_store_id}/file_batches/{batch_id}

Retrieves a batch created in this knowledge base, including current status and file counts. Use the batch id returned by batch creation to monitor ingestion.

Parameters

NameLocation and typeDescription
vector_store_idpath: stringRequired; Knowledge-base ID returned by create or list; use the ID rather than its display name. min characters: 1
batch_idpath: stringRequired; File-batch ID returned by batch creation in this knowledge base. min characters: 1

Request example

终端窗口
curl -X GET "https://api.deepraxis.com/knowledge/v1/vector_stores/${VECTOR_STORE_ID}/file_batches/${BATCH_ID}" \
-H "Authorization: Bearer $PRAXIS_API_KEY"

Response

HTTP 200

Field Type Description
id string required; Resource ID.; min characters: 1
object "vector_store.files_batch" required; Object discriminator; vector_store.files_batch identifies a batch of attached files.
vector_store_id string required; Resource ID.; min characters: 1
status "in_progress" / "completed" / "cancelled" / "failed" required; cancelled means the batch was cancelled; otherwise in_progress means a member is still ingesting, failed means ingestion ended with failed members, and completed means no pending or failed members remain. Cancelling a terminal batch leaves it unchanged.
file_counts object required; Counts of files still attached to the store or batch, grouped by ingestion status.
file_counts.in_progress integer required; Number of files waiting for or undergoing ingestion.; min: 0
file_counts.completed integer required; Number of files whose ingestion completed.; min: 0
file_counts.failed integer required; Number of files whose ingestion failed.; min: 0
file_counts.cancelled integer required; Number of files stopped by batch cancellation.; min: 0
file_counts.total integer required; Total attached files across all ingestion statuses.; min: 0
created_at integer required; Unix timestamp in seconds.

Error codes and objects

Cancel file batch

POST /knowledge/v1/vector_stores/{vector_store_id}/file_batches/{batch_id}/cancel

Cancels only in-progress batches and pending files. Completed, failed and cancelled batches return unchanged (200, idempotent).

Parameters

NameLocation and typeDescription
vector_store_idpath: stringRequired; Knowledge-base ID returned by create or list; use the ID rather than its display name. min characters: 1
batch_idpath: stringRequired; File-batch ID returned by batch creation in this knowledge base. min characters: 1

Request example

终端窗口
curl -X POST "https://api.deepraxis.com/knowledge/v1/vector_stores/${VECTOR_STORE_ID}/file_batches/${BATCH_ID}/cancel" \
-H "Authorization: Bearer $PRAXIS_API_KEY"

Response

HTTP 200

Field Type Description
id string required; Resource ID.; min characters: 1
object "vector_store.files_batch" required; Object discriminator; vector_store.files_batch identifies a batch of attached files.
vector_store_id string required; Resource ID.; min characters: 1
status "in_progress" / "completed" / "cancelled" / "failed" required; cancelled means the batch was cancelled; otherwise in_progress means a member is still ingesting, failed means ingestion ended with failed members, and completed means no pending or failed members remain. Cancelling a terminal batch leaves it unchanged.
file_counts object required; Counts of files still attached to the store or batch, grouped by ingestion status.
file_counts.in_progress integer required; Number of files waiting for or undergoing ingestion.; min: 0
file_counts.completed integer required; Number of files whose ingestion completed.; min: 0
file_counts.failed integer required; Number of files whose ingestion failed.; min: 0
file_counts.cancelled integer required; Number of files stopped by batch cancellation.; min: 0
file_counts.total integer required; Total attached files across all ingestion statuses.; min: 0
created_at integer required; Unix timestamp in seconds.

Error codes and objects

List batch files

GET /knowledge/v1/vector_stores/{vector_store_id}/file_batches/{batch_id}/files

Lists files still attached from the identified batch, newest attachment first by default. Use the batch creation id and ?filter=failed to inspect failures; last_id is the next after cursor.

Parameters

NameLocation and typeDescription
vector_store_idpath: stringRequired; Knowledge-base ID returned by create or list; use the ID rather than its display name. min characters: 1
batch_idpath: stringRequired; File-batch ID returned by batch creation in this knowledge base. min characters: 1
afterquery: stringCursor ID from the previous page. min characters: 1
beforequery: stringReturn items before this ID. min characters: 1
limitquery: integerPage size. min: 1; max: 100; default: 20
orderquery: “asc” / “desc”Order by creation time; defaults to desc for stores/files and asc by index for segments. default: “desc”
filterquery: “in_progress” / “completed” / “failed” / “cancelled”in_progress means ingestion is pending or running; completed means searchable; failed means ingestion failed; cancelled means ingestion was stopped by batch cancellation. Omit to include all statuses.

Request example

终端窗口
curl -X GET "https://api.deepraxis.com/knowledge/v1/vector_stores/${VECTOR_STORE_ID}/file_batches/${BATCH_ID}/files" \
-H "Authorization: Bearer $PRAXIS_API_KEY"

Response

HTTP 200

Field Type Description
object "list" required; Object discriminator; list identifies a cursor-paginated collection.
data object[] required; Current page of attached files in the requested order.
data[].id string required; Same ID as the source File.; min characters: 1
data[].object "vector_store.file" required; Object discriminator; vector_store.file identifies a file attached to a knowledge base.
data[].vector_store_id string required; Resource ID.; min characters: 1
data[].status "in_progress" / "completed" / "cancelled" / "failed" required; in_progress means ingestion is pending or running; completed means searchable; failed means ingestion failed; cancelled means ingestion was stopped by batch cancellation.
data[].last_error object / null required; Ingestion failure details; null before a failure and after a successful ingestion or retry.
data[].last_error (1).code "server_error" / "unsupported_file" / "invalid_file" required; unsupported_file means the file type is unsupported; invalid_file means encrypted, empty or over the parsed-token limit; server_error covers other ingestion failures and deadline expiry.
data[].last_error (1).message string required; Explanation of the ingestion failure associated with code.
data[].usage_bytes integer required; Original source file size in bytes after completion; zero while pending, failed or cancelled.; min: 0
data[].created_at integer required; Unix timestamp in seconds.
data[].chunking_strategy object / object / object required; Native stored strategy, including hierarchical parent and child settings. auto input resolves to static; the OpenAI-compatible URL projects hierarchical as other.
data[].chunking_strategy (1) (1).type "static" required; static selects explicit chunk-size and overlap settings.
data[].chunking_strategy (1) (1).static object required; Chunk-size and overlap limits in estimated tokens.
data[].chunking_strategy (1) (1).static.max_chunk_size_tokens integer required; Estimated tokens per chunk.; min: 100; max: 4096
data[].chunking_strategy (1) (1).static.chunk_overlap_tokens integer required; Must not exceed half of max_chunk_size_tokens.; min: 0; max: 2048
data[].chunking_strategy (1) (2).type "other" required; other identifies a stored strategy whose chunk-size settings are unavailable.
data[].chunking_strategy (2).type "hierarchical" required; hierarchical selects smaller child chunks for matching and larger parent chunks for context.
data[].chunking_strategy (2).hierarchical object required; Required parent, child and overlap sizes in estimated tokens. All three values must be integers.
data[].chunking_strategy (2).hierarchical.parent_max_tokens integer required; Maximum estimated tokens per parent chunk, from 101 through 4096; must exceed child_max_tokens.; min: 101; max: 4096
data[].chunking_strategy (2).hierarchical.child_max_tokens integer required; Maximum estimated tokens per child chunk, at least 100 and strictly smaller than parent_max_tokens.; min: 100; max: 4095
data[].chunking_strategy (2).hierarchical.child_overlap_tokens integer required; Estimated tokens shared by adjacent children, from zero through floor(child_max_tokens / 2).; min: 0; max: 2047
data[].attributes object / null required; File attributes used for search filtering; null means no attributes are set.
data[].praxis object optional; Native ingestion progress and source-file measurements.
data[].praxis.failure_reason "file_too_large" / "encrypted" / "empty" / "unsupported_type" / "token_limit" / "recognition_unavailable" / "deadline_exceeded" / "internal" optional; Specific ingestion failure: file_too_large exceeds 512 MiB for PDFs or 50 MiB for other formats (the Router conversion limit); encrypted requires an unencrypted source; empty has no extractable text; unsupported_type needs a supported format; token_limit exceeds 5000000 estimated tokens; recognition_unavailable exhausted OCR retries; deadline_exceeded reached the ingestion or conversion deadline; internal is an unexpected provider or processing error. last_error retains the compatible code and an actionable message.
data[].praxis.pages_done integer optional; Number of extracted pages durably saved during parsing.; min: 0
data[].praxis.pages_total integer optional; Total pages discovered for parsing; present after inspection.; min: 0
data[].praxis.stage "queued" / "parse" / "chunk" / "embed" / "index" / null required; queued means waiting; parse extracts text; chunk splits text; embed creates vectors; index makes chunks searchable. Null means ingestion is no longer running.
data[].praxis.deadline_at integer / null required; Ingestion deadline in Unix seconds; unfinished ingestion fails when this time is reached.
data[].praxis.filename string required; Original source filename returned by the File service.
data[].praxis.bytes integer required; Original file size in bytes.; min: 0
data[].praxis.pages integer / null required; Number of parsed pages after successful ingestion; null before a successful parse is committed.
data[].praxis.chunk_count integer required; Number of ingested chunks; zero until completion and after failure or cancellation.; min: 0
first_id string / null required; ID of the first item on this page; null for an empty page.
last_id string / null required; ID of the last item on this page; use as after to continue. Null for an empty page.
has_more boolean required; Whether additional items remain after this page within the selected cursor range.

Error codes and objects