- Python:
anyformat0.x → 1.x - TypeScript:
@anyformat/sdk0.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
Python
TypeScript
Python
Creating and running a workflow
The common create-and-run flow needs little change. In 1.0, keep the returnedRun 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 uploadcollection_id and file_id access with document_packet_id and files.
0.x
1.0
document_packet_id in your application. Individual file ids inside a packet are not runnable handles.
Removed file-centric methods
Replacelist_files() with packet listing, and replace run_workflow(workflow_id, file_ids) with a packet run.
0.x
1.0
get_document_packet(), delete_document_packet(), get_run(), and list_runs() when you need to manage those resources directly.
Pagination
All list methods now returnPage(items, next_cursor). Page numbers, totals, page_size, and the list-time status filter are gone.
0.x
1.0
Updating a workflow
Fetch the v3 definition, mutate it, and send it back. Preserve every existing field’spersistent_id, including when renaming a field, so analytics and ground truth stay attached.
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
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.xlookup=True flag with an explicit field source:
0.x
1.0
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
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
Anyformat.runWorkflow(workflowId, fileIds) has been removed. Run a staged packet instead:
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
iterWorkflows(), iterDocumentPackets(workflowId), or iterRuns(workflowId):
Result and error names
Renameresult.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, preservingpersistent_id:
.update(workflowId) also uses PATCH in 1.0.
Smart lookup fields
0.x
1.0
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
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_filesandrunWorkflow/run_workflowwith packet APIs. - Replace page-number pagination with
limit/cursor, or use the new iterators. - Preserve
persistent_idwhen editing existing workflow fields. - Update terminal-run and TypeScript error handling.
- Replace smart-lookup
lookupflags withsource. - Add idempotency keys to retried uploads and run triggers.
- Exercise create, upload, run, wait, list, and workflow-update paths in a staging environment.
