Skip to main content
Retrieving Export Job Items is the first step in the export item processing phase. This step determines which Export Items must be processed, but does not include the accounting data itself.

Prerequisites

Before you begin:

Steps (Control Layer)

1. Retrieve Export Items for the Job

API Endpoint: GET /v3/export-jobs/{jobId}/items Example parameters: jobId: 8eb648ab-464b-42a0-BA17-eda703657e33 Returns control data:
  • accountingEntryId
  • status (pending, in_progress, etc.)
  • export tracking fields
This endpoint is used to:
  • determine processing scope
  • track progress
  • recover from interruptions

Example Request

      curl --request GET \
      --url https://external.staging.pleo.io/v3/export-jobs/8eb648ab-464b-42a0-BA17-eda703657e33/items \
      --header 'Authorization: Bearer <token>'

Example Response

Each Export Item represents a single accounting entry to be processed.
{
  "data": [
    {
      "exportJobId": "8eb648ab-464b-42a0-ba17-eda703657e33",
      "accountingEntryId": "59540ed2-0d68-4e36-9e31-58223975d9e9",
      "status": "pending",
      "externalId": null,
      "externalUrl": null,
      "failureReasonType": null,
      "failureReason": null,
      "exportedAt": null
    },
    {
      "exportJobId": "8eb648ab-464b-42a0-ba17-eda703657e33",
      "accountingEntryId": "6678bcee-c6a4-4b49-bb1e-8f9fd653d16c",
      "status": "pending",
      "externalId": null,
      "externalUrl": null,
      "failureReasonType": null,
      "failureReason": null,
      "exportedAt": null
    },
    {
      "exportJobId": "8eb648ab-464b-42a0-ba17-eda703657e33",
      "accountingEntryId": "9ea2ef81-4d73-460d-bbb4-ccf3da6f6f61",
      "status": "pending",
      "externalId": null,
      "externalUrl": null,
      "failureReasonType": null,
      "failureReason": null,
      "exportedAt": null
    },
    {
      "exportJobId": "8eb648ab-464b-42a0-ba17-eda703657e33",
      "accountingEntryId": "0c76ea71-aaaa-4ece-bb68-e1166ccaea04",
      "status": "pending",
      "externalId": null,
      "externalUrl": null,
      "failureReasonType": null,
      "failureReason": null,
      "exportedAt": null
    }
  ],
  "pagination": {
    "hasPreviousPage": false,
    "hasNextPage": false,
    "currentRequestPagination": {
      "sortingKeys": [],
      "sortingOrder": [],
      "parameters": {
        "jobId": [
          "8eb648ab-464b-42a0-ba17-eda703657e33"
        ]
      }
    },
    "startCursor": "AAAAAADJ3YT4YKWVVLYA=AFRDZIJCOBE2JLCIOQDPOKFVZY",
    "endCursor": "AAAAAADJ3YT4YKWTT6AA=4BWF5U5TLFGLNFMGIBLKZSXGGU",
    "total": 4
  }
}

2. Handle Pagination

Export Items may be returned across multiple pages.

Example Response (Pagination)

"pagination": {
  "hasNextPage": true,
  "endCursor": "<string>"
}
Example Pseudo:
items = []

do:
    response = fetchItems(cursor)
    items.append(response.data)
    cursor = response.pagination.endCursor
while response.pagination.hasNextPage

3. Handle Job Recovery (in_progress Jobs)

If your integration restarts or loses state, it must be able to resume processing safely.

3.1. (Optional) Retrieve Export Job Metadata

This step is optional. If your integration already tracks job state, it can be skipped. API Endpoint: GET /v3/export-jobs/{jobId} This endpoint can be used to rehydrate job-level context.
Example Request
curl -X GET " https://external.staging.pleo.io/v3/export-jobs/8eb648ab-464b-42a0-ba17-eda703657e33" \
  -H "Authorization: Bearer <access_token>"

3.2. Resume Processing from Export Items

If processing resumes after interruption:
  • The Export Job is already in_progress
  • Some Export Items may already have updated statuses
Your integration should:
  1. Re-fetch all Export Items
  2. Determine which items still require processing
  3. Continue from the last known state
Example Pseudo:
itemsToProcess = filter items where status == "pending"
This ensures the export workflow is resumable and idempotent.

4. Store Items for Processing

Persist Export Items for the processing phase. Store only what is necessary:
  • accountingEntryId (unique ID for the export item)
  • jobId (unique job reference of the Export Job)
  • status (status of the export item)
Example Pseudo:
for item in items:
    queue.push(item)

5. Maintain Deterministic Processing Order

Process Export Items in a stable and predictable order. Recommended strategies:
  • chronological order (by transaction date)
  • consistent ordering across retries

Result

After completing these steps:
  • All Export Items for the job have been retrieved
  • Pagination has been fully resolved
  • The workflow remains resumable and consistent
  • The integration does not yet have the payload of each expense item

What Comes Next?

Now that you have identified which items to process, retrieve their full accounting data.
this how-to is part of: