Recipes

The flows below are the ones most integrations need. Each one's query is already loaded as a tab in the API reference explorer, so read the shape of the flow here and run the actual calls there — no copying.

Each assumes you've created a token (see Authentication) and are sending it as a Bearer token, or that you're signed in to Dynition in the same browser, in which case the explorer is already authenticated.

Upload a purchase order

Three steps, and only the first and last are GraphQL. The file bytes never pass through the API.

1. Ask for a signed upload URL — tab CreateFileUpload. Tell the API the file's name, type and size; you get back a fileId and a short-lived signedUrl.

2. PUT the bytes straight to storage, using the signedUrl, method and headers from that response:

curl -X PUT "<signedUrl>" \
  -H "Content-Type: application/pdf" \
  --data-binary @po-1042.pdf

3. Create the purchase order from the fileId — tab UploadPurchaseOrder. This is what kicks off extraction and matching. Pass a companyId too if you already know the buyer.

Watch processing finish

The PO comes back with status: PROCESSING. Poll it with the PurchaseOrderDetail tab until status is NEEDS_REVIEW, COMPLETED or FAILED — then its line items, company match and totals are ready. processing.step and processing.totalSteps track progress in the meantime.

Read purchase orders

RecentPurchaseOrders pages through them newest-first; PurchaseOrderDetail fetches one by ID with its line items and what the matcher resolved each to. Both use the cursor shape described in Pagination.

Read companies and products

The same cursor shape works across domains: Companies lists them, SearchProducts searches the catalog.

Two things that catch people out, both visible in those tabs: product SKUs live on variants, not on the product itself; and the product connection returns an exact totalCount where most others return approxTotalCount.

Every field and argument is documented in the explorer's Docs panel, which is generated from the schema itself. Ask for only the fields you need — a GraphQL response contains exactly what you selected.