Skip to main content
The 1.0 SDKs use API v3. Workflow authoring and the results payload remain familiar, but uploads, runs, pagination, and workflow updates now follow v3’s resource model. This guide covers both official packages:
  • Python: anyformat 0.x → 1.x
  • TypeScript: @anyformat/sdk 0.x → 1.x
The 0.x packages continue to use API v2. Do not upgrade the package without making the code changes below. For the HTTP-level endpoint changes and the v2 sunset schedule, see Migrating from v2.

What changes in 1.0

Authentication, API keys, the fluent workflow schema, standalone parse helpers, and the extraction results envelope do not require a conceptual migration. The standalone parse helpers still use the published v2 parse operation because v3 does not yet have an equivalent.

Install 1.0

The 1.0 Python package requires Python 3.10 or later. The TypeScript package requires Node.js 18 or later.
Python
TypeScript
During the 1.0 release-candidate period, opt in to the prerelease explicitly:
Python
TypeScript
Commit the updated lockfile, then run your type checker and tests. The removed methods and renamed properties are intentional compile-time migration signals.

Python

Creating and running a workflow

The common create-and-run flow needs little change. In 1.0, keep the returned Run if you need its status or identifiers.
0.x
1.0
run.wait() now reads the flat v3 run resource. It returns a Result on processed, raises ExtractionFailed on error, and raises ExtractionCancelled on cancelled. Both terminal exceptions subclass RunFailed.

Staged uploads and document packets

Replace upload collection_id and file_id access with document_packet_id and files.
0.x
1.0
A packet can contain between one and ten files. They are processed together as one document:
If you stored a 0.x collection id, it identifies the same underlying resource in v3; rename it to document_packet_id in your application. Individual file ids inside a packet are not runnable handles.

Removed file-centric methods

Replace list_files() with packet listing, and replace run_workflow(workflow_id, file_ids) with a packet run.
0.x
1.0
Use get_document_packet(), delete_document_packet(), get_run(), and list_runs() when you need to manage those resources directly.

Pagination

All list methods now return Page(items, next_cursor). Page numbers, totals, page_size, and the list-time status filter are gone.
0.x
1.0
For a full lazy traversal, prefer the 1.0 iterators:
The async client has equivalent async iterators.

Updating a workflow

Fetch the v3 definition, mutate it, and send it back. Preserve every existing field’s persistent_id, including when renaming a field, so analytics and ground truth stay attached.
Omit persistent_id only for a new field. The builder’s .update(workflow_id) now uses the same v3 PATCH behavior.

Errors

NoResultsYet has been removed because run status is explicit. Update terminal-run handling as follows:
1.0
HTTP exceptions now expose retryable and request_id. A 402 response raises PaymentRequired. The existing BadRequest, Unauthorized, Forbidden, NotFound, RateLimited, ServerError, and SDKTimeout names remain valid.

Smart lookup fields

Replace the 0.x lookup=True flag with an explicit field source:
0.x
1.0
Use source="lookup_if_missing" when extraction should run first and lookup should only fill an empty value.

TypeScript

Create the workflow before running it

In 0.x, WorkflowBuilder.run() could create and run in one chain. In 1.0, persist the workflow with .create(), then run the returned Workflow.
0.x
1.0
The 1.0 Run exposes id, workflowId, documentPacketId, and status. Run.wait() polls that run id instead of treating HTTP 412 as an in-progress result.

Staged uploads and document packets

0.x
1.0
Pass an array to create a multi-file packet:
Anyformat.runWorkflow(workflowId, fileIds) has been removed. Run a staged packet instead:
Packet management is available through getDocumentPacket(), listDocumentPackets(), and deleteDocumentPacket(). Run management is available through getRun() and listRuns().

Pagination

List calls now return { items, nextCursor } and accept { limit, cursor }.
0.x
1.0
For full traversal, use iterWorkflows(), iterDocumentPackets(workflowId), or iterRuns(workflowId):

Result and error names

Rename result.collectionId to result.documentPacketId. The deprecated unsuffixed error aliases have been removed. Import the Error-suffixed classes: Handle terminal run outcomes through RunFailedError or its more specific subclasses:
APIError additionally exposes errorCode, retryable, and requestId; 402 responses use PaymentRequiredError.

Updating a workflow

Use the typed GET → edit → PATCH round trip, preserving persistent_id:
The builder’s .update(workflowId) also uses PATCH in 1.0.

Smart lookup fields

0.x
1.0
Use source: "lookup_if_missing" to retain extraction as the primary source.

Add idempotency to retries

1.0 supports idempotency keys on uploads and run triggers. Use a stable, operation-specific key whenever your application retries after a timeout.
Python
TypeScript
Reusing the same key for the same operation replays the original response instead of creating another packet or billable run.

Migration checklist

  • Upgrade the runtime if needed: Python 3.10+ or Node.js 18+.
  • Upgrade the package and regenerate the lockfile.
  • TypeScript: add .create() before running a newly built workflow.
  • Rename collection/file handles to document packet handles.
  • Replace listFiles/list_files and runWorkflow/run_workflow with packet APIs.
  • Replace page-number pagination with limit/cursor, or use the new iterators.
  • Preserve persistent_id when editing existing workflow fields.
  • Update terminal-run and TypeScript error handling.
  • Replace smart-lookup lookup flags with source.
  • Add idempotency keys to retried uploads and run triggers.
  • Exercise create, upload, run, wait, list, and workflow-update paths in a staging environment.