Accounts
An account represents a bank account, or virtual wallet of some kind, capable of holding a sum of transactions.
name
An account name of your choice.
visibility
One of "PUBLIC
", "PRIVATE
" or "UNLISTED
" - see Discovery.
currency
A supported currency for this account.
List all accounts.
Filter all accounts where the name contains a specific substring.
My Account
Filter all accounts where the currency matches a specific Currency Code.
UNLISTED
Example: PUBLIC
Possible values: Filter all accounts where the currency matches a specific Currency Code.
USD
Filter all accounts where the externalId matches a specific string.
cb8ff63f-cb92-4328-b3c7-b54e2b6dbc5f
Set the page number of resources to return.
1
Set the maximum number of resources to return.
20
List of Accounts
The request is not authenticated
The request is authenticated but not authorised to perform this action.
An error occurred
GET /accounts HTTP/1.1
Host: api.testbank.dev
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
{
"data": [
{
"type": "accounts",
"id": "a1b2c3d4e5",
"attributes": {
"name": "My Account",
"visibility": "PUBLIC"
},
"relationships": {
"currency": {
"data": {
"type": "currencies",
"id": "USD"
}
}
},
"meta": {
"externalId": "cb8ff63f-cb92-4328-b3c7-b54e2b6dbc5f",
"balanceTotal": "100.00",
"createdAt": "2023-07-12T19:00:00.000Z",
"updatedAt": "2023-07-12T19:00:00.000Z"
}
}
],
"meta": {
"prev": "/resource?page[count]=2&page[limit]=100",
"next": "/resource?page[count]=4&page[limit]=100",
"first": "/resource?page[count]=1&page[limit]=100",
"last": "/resource?page[count]=10&page[limit]=100"
}
}
Create a new account, with a name, visibility & currency. Optionally include an external ID so you can tie this account with a resource from your side. Optionally include an initial transaction to set the opening balance.
Created account
The request is not authenticated
The request is authenticated but not authorised to perform this action.
Resource not found
An error occurred
POST /accounts HTTP/1.1
Host: api.testbank.dev
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 319
{
"data": {
"type": "accounts",
"attributes": {
"name": "My Account",
"visibility": "PUBLIC"
},
"relationships": {
"currency": {
"data": {
"type": "currencies",
"id": "USD"
}
},
"initialBalance": {
"data": {
"type": "transactions",
"attributes": {
"amount": "100.00",
"reference": "text"
}
}
}
},
"meta": {
"externalId": "cb8ff63f-cb92-4328-b3c7-b54e2b6dbc5f"
}
}
}
{
"data": {
"type": "accounts",
"id": "a1b2c3d4e5",
"attributes": {
"name": "My Account",
"visibility": "PUBLIC"
},
"relationships": {
"currency": {
"data": {
"type": "currencies",
"id": "USD"
}
},
"initialTransaction": {
"data": {
"type": "transactions",
"id": "c3d4e5f6g7"
}
}
},
"meta": {
"externalId": "cb8ff63f-cb92-4328-b3c7-b54e2b6dbc5f",
"balanceTotal": "100.00",
"createdAt": "2023-07-12T19:00:00.000Z",
"updatedAt": "2023-07-12T19:00:00.000Z"
}
}
}
You cannot change an account's
currencyCode
once created.
Get a specific account by ID.
Account ID
a1b2c3d4e5
Found account.
The request is not authenticated
The request is authenticated but not authorised to perform this action.
Resource not found
An error occurred
GET /accounts/{accountId} HTTP/1.1
Host: api.testbank.dev
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
{
"data": {
"type": "accounts",
"id": "a1b2c3d4e5",
"attributes": {
"name": "My Account",
"visibility": "PUBLIC"
},
"relationships": {
"currency": {
"data": {
"type": "currencies",
"id": "USD"
}
}
},
"meta": {
"externalId": "cb8ff63f-cb92-4328-b3c7-b54e2b6dbc5f",
"balanceTotal": "100.00",
"createdAt": "2023-07-12T19:00:00.000Z",
"updatedAt": "2023-07-12T19:00:00.000Z"
}
}
}
Update an account's name, visibility & external ID. You cannot change an account's currency once opened.
Account ID
a1b2c3d4e5
Updated account
The request is not authenticated
The request is authenticated but not authorised to perform this action.
Resource not found
An error occurred
PATCH /accounts/{accountId} HTTP/1.1
Host: api.testbank.dev
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 146
{
"data": {
"type": "accounts",
"attributes": {
"name": "My Account",
"visibility": "PUBLIC"
},
"meta": {
"externalId": "cb8ff63f-cb92-4328-b3c7-b54e2b6dbc5f"
}
}
}
{
"data": {
"type": "accounts",
"id": "a1b2c3d4e5",
"attributes": {
"name": "My Account",
"visibility": "PUBLIC"
},
"relationships": {
"currency": {
"data": {
"type": "currencies",
"id": "USD"
}
}
},
"meta": {
"externalId": "cb8ff63f-cb92-4328-b3c7-b54e2b6dbc5f",
"balanceTotal": "100.00",
"createdAt": "2023-07-12T19:00:00.000Z",
"updatedAt": "2023-07-12T19:00:00.000Z"
}
}
}
Delete an account & all data related to the account. Please note: This may not delete all account & transaction data - other accounts' transactions will retain the account ID. All other attributes will cleared.
Account ID
a1b2c3d4e5
A Last-Modified
header from a previous response to this endpoint. If the Last Modified date of the resource matches this value, then the resource will be successfully deleted.
Tue, 03 May 2022 10:00:00 GMT
Confirmation the account is deleted.
No content
The request is not authenticated
The request is authenticated but not authorised to perform this action.
Resource not found
Please confirm deletion using Last-Modified
An error occurred
DELETE /accounts/{accountId} HTTP/1.1
Host: api.testbank.dev
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
No content
When deleting an account, you will first receive a
412 Precondition Failed
response. You should then take theLast-Modified
header included with the error response, set it as theIf-Unmodified-Since
request header & repeat the request.On successful delete, you'll receive a
204 No Content
response.If you receive a
412 Precondition Failed
response again, use the newLast-Modified
header received & repeat.
The root
account
root
accountThe root
account for Testbank is special. You can credit your account from the root account to generate a balance to play with, or you can empty your account to the root account to clear your account out.
Last updated