GL accounts via API
Create, list, retrieve, and update chart of accounts entries programmatically using the GL accounts API.
The GL accounts API lets you manage your chart of accounts in Airwallex Spend. Sync GL accounts from your ERP or accounting system so employees and automated workflows can code expenses, bills, and other Spend items with the correct general ledger accounts.
Before you begin
- Obtain your access token API by authenticating to Airwallex using your unique Client ID and API key. You can create scoped API keys in Settings > Developer > API keys in the Airwallex web app. Spend resources require Organization-level permissions.
- Set up custom accounting data for an overview of accounting data concepts, including external IDs, legal entity scope, and status.
Sync GL accounts from your ERP
A typical sync workflow looks like this:
- List existing GL accounts in Airwallex, filtering by
external_idorstatuswhere needed. - Create GL accounts that exist in your ERP but not yet in Airwallex. Match on
external_idbefore creating. A duplicateexternal_idor account name causes the create request to fail. - Update GL accounts whose names, codes, or other attributes have changed in your ERP.
- Set
statustoARCHIVEDon update for GL accounts that are no longer active in your ERP.
Use external_id to reference a value from your ERP on create and update so you can match records across systems.
Create a GL account
To create a chart of accounts entry, call the Create GL account API endpoint.
Each GL account must have a unique account name (value) within your organization. When you provide an external_id, it must also be unique: this is the identifier you use as field_value_id when coding transactions via the Spend API.
-
Send the create request with your ERP identifier as
external_id:Shell1curl -X POST \2 'https://api-demo.airwallex.com/api/v1/accounting/gl_accounts/create' \3 -H 'Authorization: Bearer {{ACCESS_TOKEN}}' \4 -H 'Content-Type: application/json' \5 -d '{6 "request_id": "985461d5-016f-4e1f-a387-5f1380b42d92",7 "code": "601022001",8 "value": "Travel Costs - Domestic Transportation",9 "value_label": "Travel - Domestic Flight | 601022001",10 "external_id": "601022001"11 }'The
codefield is optional and accepts GL codes up to 64 characters. Omitlegal_entity_idswhen the GL account applies to all legal entities in your organization. -
The response returns the created GL account with its unique Airwallex
id:JSON1{2 "id": "ba46f0ff-8081-4db6-8333-4e011fe9561d",3 "code": "601022001",4 "value": "Travel Costs - Domestic Transportation",5 "value_label": "Travel - Domestic Flight | 601022001",6 "external_id": "601022001",7 "status": "ACTIVE",8 "created_at": "2026-06-15T00:00:00Z",9 "updated_at": "2026-06-15T00:00:00Z"10}
List GL accounts
To retrieve GL accounts, call the List GL accounts API endpoint.
-
Send the request with optional filters:
Shell1curl -G \2 'https://api-demo.airwallex.com/api/v1/accounting/gl_accounts' \3 --data-urlencode 'status=ACTIVE' \4 --data-urlencode 'external_id=601022001' \5 -H 'Authorization: Bearer {{ACCESS_TOKEN}}' -
The response returns a paginated list of GL accounts:
JSON1{2 "items": [3 {4 "id": "ba46f0ff-8081-4db6-8333-4e011fe9561d",5 "code": "601022001",6 "value": "Travel Costs - Domestic Transportation",7 "value_label": "Travel - Domestic Flight | 601022001",8 "external_id": "601022001",9 "status": "ACTIVE",10 "created_at": "2026-06-15T00:00:00Z",11 "updated_at": "2026-06-15T00:00:00Z"12 }13 ],14 "page_after": "string",15 "page_before": "string"16}
Key query parameters include:
| Parameter | Description |
|---|---|
status | Filter by ACTIVE or ARCHIVED. |
external_id | Filter by the external ID from your ERP. |
legal_entity_id | Filter by a specific legal entity ID. |
page | A bookmark for pagination. Use the value from page_after or page_before in the previous response. |
Get GL account details
To retrieve a specific GL account, call the Get GL account API endpoint.
-
Use the
idfrom the list or create response:Shell1curl -G \2 'https://api-demo.airwallex.com/api/v1/accounting/gl_accounts/{{GL_ACCOUNT_ID}}' \3 -H 'Authorization: Bearer {{ACCESS_TOKEN}}'
Update a GL account
To update an existing GL account, call the Update GL account API endpoint.
-
Send the update request with the fields you want to change:
Shell1curl -X POST \2 'https://api-demo.airwallex.com/api/v1/accounting/gl_accounts/{{GL_ACCOUNT_ID}}/update' \3 -H 'Authorization: Bearer {{ACCESS_TOKEN}}' \4 -H 'Content-Type: application/json' \5 -d '{6 "code": "601022001",7 "value": "Travel Costs - Domestic Transportation",8 "value_label": "Travel - Domestic Flight | 601022001",9 "external_id": "601022001",10 "legal_entity_ids": [11 "le_U3jlHqQRNHWn2zAKeeT8sx"12 ],13 "status": "ARCHIVED"14 }' -
The response returns the updated GL account.
Use GL accounts in Spend APIs
When coding line items on bills, purchase orders, expenses, or other Spend resources, reference a GL account in accounting_field_selections using:
field_id:Chart of accountsfield_value_id: The GL accountexternal_id(for example,601022001)identifier_type:EXTERNAL_ID
1{2 "accounting_field_selections": [3 {4 "field_id": "Chart of accounts",5 "field_value_id": "601022001",6 "identifier_type": "EXTERNAL_ID"7 }8 ]9}
Next steps
Now that you can manage GL accounts via the API, explore these related guides: