--- title: "Export history via Payhawk Developer API - Payhawk Help Center" slug: "export-history-via-payhawk-developer-api" description: "Use the Payhawk Export History API to read and set the export status of expenses, payments and payment fees, add messages and links, and filter by status." updated: 2026-10-23T13:45:42Z published: 2026-10-23T13:45:42Z canonical: "payhawk.com/export-history-via-payhawk-developer-api" --- > ## Documentation Index > Fetch the complete documentation index at: https://payhawk.com/help/llms.txt > Use this file to discover all available pages before exploring further. # Export history via Payhawk Developer API Payhawk’s Export History API gives you full control over managing and tracking the export status of expenses, their related payments, and payment fees. Each expense can have export history for three items: - Expense (for example, a vendor bill) - Payment (for example, a vendor payment) - Payment fee (for example, a journal entry) You can export them together or manage each one individually—for instance, mark only payments as exported while keeping the expense unexported. Through the API, you can: - Retrieve export records and statuses - Mark expenses, payments, or fees as exported or failed - Add messages and external record links - Filter expenses by export destination or export status Combined with export filters, these features allow you to build flexible integrations that ensure only unexported items are sent to external systems. ## Export filters You can use filters in the Developer API to refine data related to export status and destination. For the full list of filter definitions, [see the page](https://developers.payhawk.com/#:~:text=IDepositQueryParams-,IExpenseFilter,-IExpenseOrderBy). Supported filters include: - `export.into`: `$equal`, `$notEqual`, `$in` (any value) - `payment.export.into`: `$equal`, `$notEqual`, `$in` (any value) - `export.status`: `$equal` (`not-exported`, `succeeded`, `failed`) - `payment.export.status`: `$equal` (`not-exported`, `succeeded`, `failed`) These filters help identify expenses and payments by whether they’ve been exported, and into which system. ## Use cases The following examples showcase how you can use Payhawk’s Export History API in various scenarios. ### Getting all expenses or payments not exported into a specific system You can filter all expenses or payments that haven’t been exported into your system (for example, **My application**). Endpoint: [Get expenses](https://developers.payhawk.com/#/Expenses/get_api_v3_accounts__accountId__expenses) Example request: ```plaintext /api/v3/accounts/{{accountId}}/expenses?$filter={"$or":[{"payment.export.into":{"$notEqual":"My Application"}},{"export.into":{"$notEqual":"My Application"}}]} ``` Filter structure: ```plaintext ```json {  "$or": [    { "payment.export.into": { "$notEqual": "My Application" } },    { "export.into": { "$notEqual": "My Application" } }  ] } ``` ``` ### Getting all expenses or payments with a specific export status To find expenses or payments that failed to export, use: ```plaintext /api/v3/accounts/{{accountId}}/expenses?$filter={"$or":[{"payment.export.status":{"$equal":"failed"}},{"export.status":{"$equal":"failed"}}]} ``` Filter structure: ```plaintext ```json {  "$or": [    { "payment.export.status": { "$equal": "failed" } },    { "export.status": { "$equal": "failed" } }  ] } ``` ``` ### Retrieving export history Use this endpoint to view detailed export history for a specific expense. [GET /accounts/:accountId/expenses/:expenseId/export-history](https://developers.payhawk.com/#/Expenses/get_api_v3_accounts__accountId__expenses__expenseId__export_history) ### Creating export history This endpoint allows you to record the export outcome for an expense and its related items. [POST /accounts/:accountId/expenses/:expenseId/export-history](https://developers.payhawk.com/#/Expenses/post_api_v3_accounts__accountId__expenses__expenseId__export_history) Example request: ```plaintext ```json {  "expense": {    "exportedInto": "My Application",    "exportStatus": "succeeded",    "exportMessage": "Expense exported into My Application successfully",    "externalRecord": {      "id": "1363",      "url": "https://my.application/entries/expense-82"    },    "exportedAt": "2025-12-20T00:00:00.000Z"  } } ``` ``` The most recent export history entry appears in the **Export** section of the expense in the UI. Users can see all export entries under the **Activity** section (switch to view *All* or *Export*). The `exportMessage` provided in the export history post request is displayed under the Activity section for `exportStatus=failed`. ## Developer reference Endpoint: ```plaintext POST /accounts/:accountId/expenses/:expenseId/export-history ``` TypeScript Interfaces: ```plaintext ```tsx export interface IExternalRecord {  id: string;  url?: string; } export interface IExportHistoryItem {  exportedAt?: Date;  exportedInto?: string;  externalRecord: IExternalRecord;  exportMessage?: string;  exportStatus: ExportStatus; } export interface IExpenseExportHistoryItem extends IExportHistoryItem {} export interface IPaymentExportHistoryItem extends IExportHistoryItem {  paymentId: string; } export interface IExpenseExportHistoryItemAggregate {  expense?: IExportHistoryItem;  payments?: IPaymentExportHistoryItem[];  fees?: IPaymentExportHistoryItem[]; } ``` ``` Example payload ```plaintext ```json {  "expense": {    "exportedInto": "SAP Concur",    "exportStatus": "succeeded",    "exportMessage": "Great success for the expense",    "externalRecord": {      "id": "1363",      "url": "https://erp.integrations/entries/1363"    },    "exportedAt": "2025-04-29T00:00:00.000Z"  },  "payments": [    {      "paymentId": "5142",      "exportedInto": "SAP Concur",      "exportMessage": "Great success for the payment",      "exportStatus": "succeeded",      "externalRecord": {        "id": "2415",        "url": "https://erp.integrations/entries/2415"      },      "exportedAt": "2025-04-29T00:00:00.000Z"    }  ],  "fees": [    {      "paymentId": "5142",      "exportedInto": "SAP Concur",      "exportMessage": "Great success for the fee",      "exportStatus": "succeeded",      "externalRecord": {        "id": "2415-fee",        "url": "https://erp.integrations/entries/2415-fee"      },      "exportedAt": "2025-04-29T00:00:00.000Z"    }  ] } ``` ```