Skip to main content
This guide builds the smallest useful Pathway integration in Python. It submits a deal package, waits for the asynchronous parse, and retrieves bank analytics. Use a webhook when your application already has a public callback endpoint. Use polling for local scripts, jobs, and the first version of an integration.

Install the client

Set the token in your environment:
The examples use this shared setup:

Submit the deal

Send every file for one deal in the same multipart request.
The response only confirms that Pathway accepted the asynchronous workflow. The new Book continues through upload, classification, and parsing after the request closes.

Wait with polling

Poll the Book every few seconds. Stop when the status reaches completed, failed, or cancelled, and put a timeout around the whole wait.
Five seconds is a reasonable polling interval. Faster polling rarely makes the result arrive meaningfully sooner and uses the PAT’s request budget.

Fetch the result

After a completed parse, request the output your workflow needs.
The useful result endpoints are: Some Books contain no bank statements. In that case /analytics returns 400, while the relevant raw credit, tax, application, or identity result can still be present in book_meta.

Wait with a webhook

A webhook removes the polling loop. Add webhook_url to the submit request and expose a callback that accepts Pathway’s completion payload.
The receiver can remain small. Confirm the stored status with an authenticated API request before starting downstream work.
Pathway currently sends one unsigned webhook delivery. Keep the receiver idempotent and use the authenticated Book response as the final status.

Complete polling script

This version can be copied into one file and run directly.
Continue with Working with analytics data once this flow is returning completed Books.