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 AccountFilter all accounts where the currency matches a specific Currency Code.
UNLISTEDExample: PUBLICPossible values: Filter all accounts where the currency matches a specific Currency Code.
USDFilter all accounts where the externalId matches a specific string.
cb8ff63f-cb92-4328-b3c7-b54e2b6dbc5fSet the page number of resources to return.
1Set the maximum number of resources to return.
20List 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
currencyCodeonce created.
Get a specific account by ID.
Account ID
a1b2c3d4e5Found 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
a1b2c3d4e5Updated 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
a1b2c3d4e5A 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 GMTConfirmation 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 Failedresponse. You should then take theLast-Modifiedheader included with the error response, set it as theIf-Unmodified-Sincerequest header & repeat the request.On successful delete, you'll receive a
204 No Contentresponse.If you receive a
412 Precondition Failedresponse again, use the newLast-Modifiedheader 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