successful item updates and a completed job event. In some cases the items also return in a new pending Export Job when you export them again. The article also shows how to resolve the problem.
The Symptom
You processed an Export Job, and Pleo accepted every call:PUT /v3/export-jobs/{jobId}/itemsreturned200with"errors": [], and every item wassuccessful.POST /v3/export-job-eventswithcompletedreturned204.GET /v3/export-jobs/{jobId}shows the job ascompleted.
pending Export Job appears in GET /v3/export-jobs. It contains the same accounting entries.
Why This Happens
An Export Job and its items must move through the full sequence, in order. If you skip a step, the entries can stay in the Export queue. The step that is skipped most often is marking each itemin_progress before you mark it successful.
How to Reproduce on Staging
- In the Pleo Web App, export two expenses.
- Send
POST /v3/export-job-eventswith"event": "started"for the newpendingjob. - Send
PUT /v3/export-jobs/{jobId}/itemswith"status": "successful"for both items. Do not sendin_progressfirst. - Send
POST /v3/export-job-eventswith"event": "completed". - In the Pleo Web App, the expenses stay in the Queued tab.
How to Resolve It
Process each Export Job in this order. Do not skip step 2. If you do, the expenses stay in the Queued tab, even though Pleo accepts every call.1. Mark the Job In Progress
API Endpoint: POST/v3/export-job-events
- OAuth 2.0
- API Key
204, and the job’s status becomes in_progress.
2. Mark Every Item In Progress
API Endpoint: PUT/v3/export-jobs/{jobId}/items
Send every accounting entry in the job with "status": "in_progress", in batches of up to 100 items. Each item needs only accountingEntryId and status.
- OAuth 2.0
- API Key
3. Mark Each Item Successful or Failed
API Endpoint: PUT/v3/export-jobs/{jobId}/items
After your AS/ERP has processed the items, report the result for each one. For the full payloads, including failures, see How to Update Export Items.
- OAuth 2.0
- API Key
4. Complete the Job
API Endpoint: POST/v3/export-job-events
Send completed if all items succeeded, completed_with_errors if some items failed, or failed if all items failed. For more detail, see How to Update and Complete an Export Job.
- OAuth 2.0
- API Key
After Resolving
Check the job and its items:GET /v3/export-jobs/{jobId}shows"status": "completed".GET /v3/export-jobs/{jobId}/itemsshows each item assuccessful, withexportedAtset.- Refresh the Export page in the Pleo Web App. The expenses move from the Queued tab to the Exported tab.
Related Reading
- How to Update Export Items
- How to Update and Complete an Export Job
- How to Detect and Start Export Jobs
- Export Lifecycle