Airwallex logo

Card expenses via APIBeta

List, retrieve, and update card expenses programmatically using the Spend API.

Copy for LLMView as Markdown
Card expenses via API is in beta
We may include major new functionality or changes before general release. Learn more about beta.

The Card Expenses API lets you retrieve approved card expenses from Airwallex and mark them as synced after ingesting them into your ERP or accounting system. This prevents re-processing and keeps your records in sync.

Before you begin

List card expenses

To retrieve a list of card expenses, call the List card expenses API endpoint. You can use query parameters to filter results by status, sync status, and pagination.

  1. Send the request with your desired filters:

    Shell
    1curl -G \
    2 'https://api.sandbox.airwallex.com/api/v1/spend/expenses' \
    3 --data-urlencode 'status=APPROVED' \
    4 --data-urlencode 'sync_status=NOT_SYNCED' \
    5 -H 'Authorization: Bearer {{ACCESS_TOKEN}}'
  2. Review the response:

    JSON
    1{
    2 "items": [
    3 {
    4 "account_id": "acct_a2y0pxz3m4k5hoZldn97hjzp",
    5 "approvers": [
    6 ],
    7 "billing_amount": "1234.56",
    8 "billing_currency": "USD",
    9 "card_id": "bdfd278d-14f8-4d12-a04f-a7a1871babd2",
    10 "created_at": "2025-01-01T00:00:00Z",
    11 "description": "Business lunch with client",
    12 "id": "f865c064-57bb-4ca0-9793-54011e00cb53",
    13 "legal_entity_id": "le_U3jlHqQRNHWn2zAKeeT8sg",
    14 "merchant": "Restaurant ABC",
    15 "settled_at": "2025-03-03T00:00:00Z",
    16 "status": "APPROVED",
    17 "sync_status": "NOT_SYNCED",
    18 "card_transaction": {
    19 "status": "CLEARED",
    20 "amount": "1234.56",
    21 "currency": "USD"
    22 },
    23 "updated_at": "2025-02-02T00:00:00Z"
    24 },
    25 {
    26 "account_id": "acct_a2y0pxz3m4k5hoZldn97hjzp",
    27 "approvers": [
    30 ],
    31 "billing_amount": "567.89",
    32 "billing_currency": "USD",
    33 "card_id": "7d2faf05-a771-4964-92ed-0b65ef3ea04b",
    34 "created_at": "2025-01-01T01:00:00Z",
    35 "description": "Team dinner",
    36 "id": "313c9a4f-2e7b-40f2-9b89-ebb08bc7d856",
    37 "legal_entity_id": "le_U3jlHqQRNHWn2zAKeeT8sg",
    38 "merchant": "Restaurant XYZ",
    39 "settled_at": "2025-03-03T01:00:00Z",
    40 "status": "APPROVED",
    41 "sync_status": "NOT_SYNCED",
    42 "card_transaction": {
    43 "status": "CLEARED",
    44 "amount": "567.89",
    45 "currency": "USD"
    46 },
    47 "updated_at": "2025-02-02T01:00:00Z"
    48 }
    49 ],
    50 "page_after": "eyJwYWdlX2JlZm9yZSI6IjIwMjUtMDctMDFUMDA6MDA6MDBaIn0=",
    51 "page_before": "eyJwYWdlX2JlZm9yZSI6IjIwMjUtMDctMDFUMDA6MDA6MDBaIn0="
    52}

Key query parameters include:

ParameterDescription
statusFilter by expense statuses. Possible values are DRAFT, AWAITING_APPROVAL, REJECTED, APPROVED, ARCHIVED, DELETED.
sync_statusFilter by sync status (NOT_SYNCED, SYNCED, SYNC_FAILED, READY_TO_SYNC).
from_created_atFilter expenses created on or after this timestamp (ISO 8601).
to_created_atFilter expenses created on or before this timestamp (ISO 8601).
legal_entity_idFilter expenses by legal entity ID.
pageA bookmark for use in pagination to retrieve either the next page or the previous page of results. You can fetch the value for this identifier from the response of the previous API call.

Get card expense details

To retrieve the full details of a specific expense, including attachments, line items, accounting fields, and comments, call the Get card expense API endpoint.

  1. Use the id from the list response:

    Shell
    1curl -G \
    2 'https://api.sandbox.airwallex.com/api/v1/spend/expenses/{{ID}}' \
    3 -H 'Authorization: Bearer {{ACCESS_TOKEN}}'
  2. The response includes complete expense details:

    JSON
    1{
    2 "account_id": "acct_a2y0pxz3m4k5hoZldn97hjzp",
    3 "accounting_field_selections": [
    4 {
    5 "source_id": "d8e2f0ff-8081-4db6-8333-4e011fe9561d",
    6 "type": "MERCHANT",
    7 "value": "Airwallex",
    8 "value_label": "Airwallex"
    9 }
    10 ],
    11 "approvers": [
    14 ],
    15 "attachments": [
    16 {
    17 "content_type": "image/jpeg",
    18 "created_at": "2025-02-02T00:00:00Z",
    19 "file_name": "receipt.jpg",
    20 "file_url": "https://www.airwallex.com/receipt.jpg",
    21 "id": "0fd62109-cfc0-4c94-86a5-d01c42506b76"
    22 }
    23 ],
    24 "billing_amount": "100.0",
    25 "billing_currency": "USD",
    26 "card_id": "93eed14b-104d-4f40-ae1d-3633c6538276",
    27 "comments": [
    28 {
    29 "content": "Please review this expense.",
    30 "created_at": "2025-02-02T08:00:00Z",
    31 "created_by": "[email protected]"
    32 }
    33 ],
    34 "created_at": "2025-01-01T00:00:00Z",
    35 "description": "This is a description of the expense.",
    36 "id": "ba46f0ff-8081-4db6-8333-4e011fe9561d",
    37 "legal_entity_id": "le_U3jlHqQRNHWn2zAKeeT8sg",
    38 "line_items": [
    39 {
    40 "accounting_field_selections": [
    41 {
    42 "source_id": "c9fcfdee-f943-45c9-abaa-45df1601ae04",
    43 "name": "Cost Center",
    44 "type": "OTHER",
    45 "value": "Office Expense",
    46 "external_id": "a7e44855-e7f3-47ce-be50-182b666d543c",
    47 "value_label": "Office Expense"
    48 }
    49 ],
    50 "description": "Office supplies purchase",
    51 "id": "a12fca5e-4aeb-4adb-85b0-428b4f078aba",
    52 "transaction_amount": "100.00"
    53 }
    54 ],
    55 "merchant": "Airwallex",
    56 "settled_at": "2025-03-03T00:00:00Z",
    57 "status": "APPROVED",
    58 "sync_status": "SYNCED",
    59 "card_transaction": {
    60 "status": "AUTHORIZED",
    61 "amount": "100.0",
    62 "currency": "USD"
    63 },
    64 "updated_at": "2025-02-02T00:00:00Z"
    65}

Use root-level accounting_field_selections for the merchant (type: MERCHANT). Use line_items[].accounting_field_selections for GL accounts, tax codes, and custom fields. See Accounting field selections.

Update sync status

After you persist an expense to your system, mark it as synced to prevent re-processing.

  1. Call the Sync card expense status API endpoint:

    Shell
    1curl -X POST \
    2 'https://api.sandbox.airwallex.com/api/v1/spend/expenses/{{ID}}/sync' \
    3 -H 'Authorization: Bearer {{ACCESS_TOKEN}}' \
    4 -H 'Content-Type: application/json' \
    5 -d '{
    6 "sync_status": "SYNCED"
    7 }'
  2. The response confirms the updated status:

    JSON
    1{
    2 "id": "ba46f0ff-8081-4db6-8333-4e011fe9561d",
    3 "sync_status": "SYNCED"
    4}

Next steps

Now that you can manage card expenses via the API, explore these related guides:

Was this page helpful?