Export purchase orders in a date range to CSV
AI agents: read /llms.txt; add .md to any page URL. This page as Markdown: /reference/data-exports/v1-data-export-export-purchase-order-list.md. Index of every page and the rules for every call: /llms.txt. Guides and concepts in one file: /llms-full.txt. OpenAPI: /openapi.json.
POST/
Starts a CSV export of purchase orders whose issue date falls in the range, one row per purchase order, with the vendor, status, ordered and received totals, and the related sales orders and customers. Deleted purchase orders are left out. It runs in the background: the response is the new export with status pending.
Business rules
start_dateandend_dateare required, andend_datecan't be beforestart_date. There is no maximum range. There is nodate_field: the range is the purchase order's issue date.- One export of each type at a time for the whole team: while one is
pendingorgenerating, creating another of the same type is a 422 (duplicate_report). - At most 3 exports pending or generating per team, of any type. A fourth is a 429 (
export_capacity). columns, when sent, must be a non-empty list of column ids for this type.GET /v1/api/store/{team_slug}/data_export/definitionslists them with their labels.idempotency_key, when sent, must be a string of at most 100 characters. Reusing a key with a different type, different settings or another person is a 422.
Side effects
- Queues the export and returns it at once with
statuspending. The file is built in the background. - People with the Download Center open see it appear and update live. No email is sent.
- The file is kept for 3 days after it is ready, then deleted. The export stays in the list as history.
Path parameters
Your team slug, shown as Team ID next to your API key in Profile.
- Example
your-team
- Example
Request body
application/json, required.
End of the range, inclusive, on or after
start_date. A date alone means midnight UTC at its start, which leaves that day out, so send the last moment of the day:2026-10-31T23:59:59.999Z.Start of the range, inclusive: a date and time in UTC, such as
2026-10-01T00:00:00Z. An offset (2026-10-01T00:00:00-07:00) is accepted and converted to UTC; a value with neither is read as UTC.columnsarray of stringsThe columns to include, in the order you want them in the file. Omit it for every column in the default order. Repeats are dropped.
- Each item is one of:
"id","name","vendor","issue_date","due_date","billing_address_label","warehouse_label","creator","status","received_subtotal","received_tax","received_total","ordered_subtotal","ordered_tax","ordered_total","related_orders","related_customers","internal_note","vendor_note" - At least 1 item
- Items must be unique
- Each item is one of:
idempotency_keystringOptional, a string of up to 100 characters. Send the same key to retry the same request safely: you get the export it created, and nothing new starts while that export is
pending,generating,ready, or failed withexport_generation_failed. If it failed withexport_queue_failedorexport_attempt_expired, the same key queues it again. Keys are shared by the whole team.- At most 100 characters
Response
200Successful response.
Child fields (12)
What you asked for: the dates (and
date_field) as you sent them, and thecolumnsyou chose, without repeats, withschema_version. Null for customer and product exports sent withoutcolumns.Child fields (5)
columnsarray of stringsOnly when you chose columns.
date_fieldstringSales order exports only.
end_datestringschema_versionintegerOnly when you chose columns.
start_datestring
A plain number for the person who created it. It is not a hash id and no operation takes it; show
creator.nameinstead.The person who created it; null if their account was deleted. More of their account fields may appear; rely only on these.
Why it failed.
export_generation_failed: the file could not be built; create a new export.export_attempt_expired: it did not finish in time.export_queue_failed: it could not be queued. Null unlessstatusisfailed.- One of:
"export_generation_failed","export_attempt_expired","export_queue_failed"
- One of:
When the download stops working: 3 days after the export became ready. The file is then deleted; the export stays in the list but can't be downloaded.
File size in bytes, once ready.
The export id. Use it to poll and to download.
Child fields (2)
Rows written so far, not counting the header row. Updated every 500 rows; product exports update only at the end.
Rows in the file, not counting the header row. Null until the export is ready: there is no total to show a percentage against while it runs.
pending: queued.generating: running.ready: the file can be downloaded.failed: seeerror_code.- One of:
"pending","generating","ready","failed"
- One of:
- One of:
"customer_list","sales_order_list","invoice_list","invoice_item_list","payment_list","purchase_order_list","tax_list","simple_product_list","variant_product_list"
- One of:
Errors
401The API key is missing or wrong (
unauthenticated).403You are not allowed to do this.
api_access_not_in_plan: your team's plan doesn't include API access (Pro and above, with an active subscription or trial), so every request answers this until the team upgrades. When your role lacks the permission the operation needs, the body is only{"message": "Insufficient Permission"}. Other refusals use the error envelope, withunauthorizedoruser_is_not_authorized.404Not found.
page_not_found: the team slug is unknown, you are not a member of the team, or an id in the path is not one of this team's.code: null, with a message that starts "No query results for": there is no record with that id.422The request was refused and changed nothing.
validation_failedlists what to fix inerror.fields; other codes name a business rule, explained inerror.message. A few checks answer with only{"message": "..."}. An operation that calls another service (a payment provider, a carrier, an accounting app) can answerconnect_timeout("Please retry again") when that service does not answer in time: the change may or may not have happened there, so read the record back before you retry.- When
- Dates are missing, not dates, or out of order, or, for sales orders,
date_fieldis missing or not one of the six (invalid_export_request, "Choose valid, ordered export dates and a supported date field."). - Fix
- Send both dates, with
end_dateon or afterstart_date, and for sales orders adate_fieldfrom the list. - When
- A column id is unknown,
columnsis not a list, or it is empty (invalid_export_request, "The selected export columns are invalid." or "Select at least one export column."). - Fix
- Use ids from the definitions operation, or omit
columns. - When
idempotency_keyis not a string or is longer than 100 characters (invalid_export_request, "The export request key is invalid.").- Fix
- Send a string of up to 100 characters, or leave it out.
- When
- An export of this type is already pending or generating for your team (
duplicate_report, "There is already a report being generated. Please wait until the report is fully generated"). - Fix
- Poll the running export and download it instead, or wait until it finishes.
- When
- The
idempotency_keywas used for a different export, or by another member (invalid_export_request, "This request key was already used for a different export."). - Fix
- Use a new key for a new export.
429Your team already has 3 exports pending or generating.
- When
- Three exports are already pending or generating (
export_capacity). - Fix
- Wait for one to finish, then try again.
503Exports are paused for a few minutes during a YoPrint update, or the export could not be queued (
export_queue_failed, "The export could not be queued. Try again.").- When
- Exports are paused during an update (
export_creation_paused, withRetry-After: 120), even for a retry with the same key; or the export could not be queued (export_queue_failed, noRetry-After). - Fix
- When paused, wait the
Retry-Afterseconds and send the request again. After a queue failure, send it again with the sameidempotency_keyto queue the same export.
Notes
- The range is inclusive at both ends and is compared in UTC, with times. To cover whole days in your team's time zone, convert its midnights to UTC, or send the offset:
2026-10-01T00:00:00-07:00to2026-10-31T23:59:59.999-07:00. There is no maximum range. - Amounts in the file are decimal strings with 2 decimal places and no currency symbol, such as
125.00. In invoice and tax exports (invoice_list,tax_list),tax_percentageis a percentage as a decimal string (8.25,0), empty when the invoice has no single tax rate (for example a fixed tax amount). In sales order, invoice, and tax exports (sales_order_list,invoice_list,tax_list), thepaidcolumn isTRUEorFALSE. - Dates in the file are
YYYY-MM-DD, in your team's time zone. - The full flow: create the export, poll
GET /v1/api/store/{team_slug}/data_export/{id}every few seconds untilstatusisready(orfailed), then download the file withGET /v1/api/store/{team_slug}/data_export/{id}/downloadwithin 3 days. - Retrying with the same
idempotency_keyreturns the same export and starts nothing new while it ispending,generating,ready, or failed withexport_generation_failed(send a new key to try that one again). Afterexport_queue_failedorexport_attempt_expired, the same key queues the same export again, and the one-per-type (422duplicate_report) and three-per-team (429export_capacity) limits apply. - The file is CSV, UTF-8 with a byte order mark. Its first row holds the column ids, such as
order_id(not the labels), in the order ofcolumnsor, without it, the default order. An export with no matching records has only that row.
Related
- GETGet a data export
/v1/ api/ store/ {team_slug}/ data_export/ {id} - GETDownload a data export's file
/v1/ api/ store/ {team_slug}/ data_export/ {id}/ download - GETList export types and their columns
/v1/ api/ store/ {team_slug}/ data_export/ definitions
