Appearance
Utils and Security
Methods for managing access and settings of WAPI database instance.
Quick Reference
| Method | Description |
|---|---|
| createAccessToken | Create a JWT token for use with HTTP api |
| createApikey | Create a new API key for accessing WAPI |
| findApikeys | Search for API keys using either a simple filter or queryBuilder |
| getFlags | Retrieve the current state of configurable Flags for your WAPI instance |
| healthcheck | Get information about the health of the API |
| setFlags | Configure WAPI instance Flags |
| updateApikey | Update an API key |
createAccessToken
Create a JWT token for use with HTTP api
ts
await client.createAccessToken({
token: {
type: 'limited',
scopes: ['getBalance'],
filters: {
wallet_foreign: 'user-1-wallet',
token_foreign: 'EUR',
},
expiresIn: 60,
},
});ts
{
authToken: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ0eXBlIjoibGltaXRlZCIsImNvbm5lY3Rpb24iOiJ3YXBpX2VlZjE2Mzp0ZXN0Iiwic2NvcGVzIjpbImF1dGhlbnRpY2F0aW9uQ2hlY2siLCJnZXRCYWxhbmNlIl0sImZpbHRlcnMiOnsid2FsbGV0X2ZvcmVpZ24iOiJ1c2VyLTEtd2FsbGV0IiwidG9rZW5fZm9yZWlnbiI6IkVVUiJ9LCJpYXQiOjE3Njk0MzUxODEsImV4cCI6MTc2OTQzODc4MX0.JC92-n35SCx8LWuSVwHToFkDuy-Bs1FUdx3wAPwCEdM'
};createAccessTokenFnInput
Input for createAccessToken
| Attribute | Type | Required | Description |
|---|---|---|---|
token | {} | ||
options | {} | Optional flags for input |
createAccessTokenFnOutput
Output of createAccessToken
| Attribute | Type | Always | Description |
|---|---|---|---|
authToken | string | ✓ | The JWT token |
createApikey
Create a new API key for accessing WAPI
ts
await client.createApikey({
type: 'limited',
description: 'New limited key',
functions: ['createTransfer', 'findWalletMany'],
valid_until: moment().add(2, 'hour').toISOString(),
metadata: {
myFancyKey: true,
},
});ts
{
apikey: {
id: 4,
apikey: '8205f03e54',
type: 'limited',
description: 'New limited key',
metadata: {
myFancyKey: true
},
valid_until: '2026-01-01T10:00:00.000Z',
status: 'active',
created_at: '2026-01-01T10:00:00.000Z',
updated_at: '2026-01-01T10:00:00.000Z',
functions: [
'authenticationCheck',
'healthcheck',
'createTransfer',
'findWalletMany'
],
apisecret: '1061a716ac29dcd47d2deae3107c95ce93f34cd690c8eca0'
}
};createApikeyFnInput
Input for createApikey
| Attribute | Type | Required | Description |
|---|---|---|---|
type | | ✓ | Type of the Apikey |
description | string | ✓ | Description of the accessKey |
functions | | Scopes for limited apikey, will be ignored if type is admin | |
valid_until | string | ApiKey expiration datetime | |
metadata | | Custom key/value object | |
options | {} |
createApikeyFnOutput
Output of createApikey
| Attribute | Type | Always | Description |
|---|---|---|---|
apikey | {} | ✓ |
findApikeys
Search for API keys using either a simple filter or queryBuilder
ts
await client
.findApikeys()
.where({
status: 'active',
})
.where('description', 'like', 'Find test key%')
.limit(5)
.offset(0)
.orderBy(['description', { column: 'id', order: 'desc' }])
.options({
tracking_id: 'find-apikeys-test',
return_metadata_total: true,
});ts
{
apikeys: [
{
id: 3,
apikey: 'findtest1',
type: 'admin',
description: '2026-01-01T10:00:00.000Z',
metadata: {
even: false,
index: 1
},
valid_until: null,
scopes: null,
status: 'active',
created_at: '2026-01-01T10:00:00.000Z',
updated_at: '2026-01-01T10:00:00.000Z'
},
{
id: 4,
apikey: 'findtest2',
type: 'limited',
description: '2026-01-01T10:00:00.000Z',
metadata: {
even: true,
index: 2
},
valid_until: null,
scopes: null,
status: 'active',
created_at: '2026-01-01T10:00:00.000Z',
updated_at: '2026-01-01T10:00:00.000Z'
},
{
id: 5,
apikey: 'findtest3',
type: 'admin',
description: '2026-01-01T10:00:00.000Z',
metadata: {
even: false,
index: 3
},
valid_until: null,
scopes: null,
status: 'active',
created_at: '2026-01-01T10:00:00.000Z',
updated_at: '2026-01-01T10:00:00.000Z'
},
{
id: 6,
apikey: 'findtest4',
type: 'limited',
description: '2026-01-01T10:00:00.000Z',
metadata: {
even: true,
index: 4
},
valid_until: '2026-01-01T10:00:00.000Z',
scopes: null,
status: 'active',
created_at: '2026-01-01T10:00:00.000Z',
updated_at: '2026-01-01T10:00:00.000Z'
},
{
id: 8,
apikey: 'findtest6',
type: 'limited',
description: '2026-01-01T10:00:00.000Z',
metadata: {
even: true,
index: 6
},
valid_until: null,
scopes: null,
status: 'active',
created_at: '2026-01-01T10:00:00.000Z',
updated_at: '2026-01-01T10:00:00.000Z'
}
],
metadata: {
limit: 5,
offset: 0,
total: 8,
more_rows: true,
order: [
{
field: 'description',
direction: 'asc'
},
{
field: 'id',
direction: 'desc'
}
]
}
};findApikeysFnInput
Input for findApikeys
| Attribute | Type | Required | Description |
|---|---|---|---|
type | | Type of the apikey | |
status | | Status of the apikey | |
description | string | Apikey description | |
metadata | | Metadata filter for custom properties | |
options | {} | Optional flags for input |
findApikeysFnOutput
Output of findApikeys
| Attribute | Type | Always | Description |
|---|---|---|---|
apikeys | ({})[] | ✓ | Found apikeys |
metadata | {} | ✓ | Metadata about the search |
getFlags
Retrieve the current state of configurable Flags for your WAPI instance
ts
await client.getFlags();ts
{
flags: {
allow_timestamps: false,
production: true
}
};getFlagsFnInput
Input for getFlags
| Attribute | Type | Required | Description |
|---|---|---|---|
options | {} | Optional flags for input |
getFlagsFnOutput
Output of getFlags
| Attribute | Type | Always | Description |
|---|---|---|---|
flags | {} | ✓ | System wide flags |
healthcheck
Get information about the health of the API
ts
await client.healthcheck();ts
{
status: 'green',
version: '0.17.4',
database_size: '9531 kB',
indexes_size: '576 kB',
connection_count: 1
};healthcheckFnInput
Input for healthcheck
| Attribute | Type | Required | Description |
|---|---|---|---|
options | {} | Optional flags for input |
healthcheckFnOutput
Output of healthcheck
| Attribute | Type | Always | Description |
|---|---|---|---|
status | | ✓ | Status of the service |
message | string | Error message if some error occurred | |
database_size | string | Size of the database in MB | |
indexes_size | string | Size of all indexes of database in MB | |
connection_count | number | Number of external connections to this database | |
version | string | Version the server is running |
setFlags
Configure WAPI instance Flags
ts
await client.setFlags(
{
production: false,
allow_timestamps: true,
},
{
tracking_id: 'mylog',
},
);ts
{
flags: {
allow_timestamps: true,
production: false
},
message: 'flag updated, reconnect to apply'
};setFlagsFnInput
Input for setFlags
| Attribute | Type | Required | Description |
|---|---|---|---|
allow_timestamps | boolean | Allow setting timestamps in transfer insert/update statements | |
production | boolean | Is running in production mode? | |
options | {} | Optional flags for input |
setFlagsFnOutput
Output of setFlags
| Attribute | Type | Always | Description |
|---|---|---|---|
flags | {} | ✓ | System wide flags |
message | string | optional message |
updateApikey
Update an API key
ts
await client.updateApikey(
{
apikey: createResponse.apikey.apikey,
metadata: {
updated: true,
customField: 'test-value',
},
// status: 'deleted',
apisecret: true,
},
{
return_when_not_updated: true,
// GENERALOPTIONS
},
);ts
{
apikey: {
id: 2,
apikey: '5bcd795342',
type: 'admin',
scopes: null,
description: 'Key to update',
metadata: {
updated: true,
customField: 'test-value'
},
valid_until: null,
status: 'active',
created_at: '2026-01-01T10:00:00.000Z',
updated_at: '2026-01-01T10:00:00.000Z',
apisecret: 'dfeb989262413cdfc7131bce07a9249b44806400a4a8f7f7'
},
updated: true
};updateApikeyFnInput
Input for updateApikey
| Attribute | Type | Required | Description |
|---|---|---|---|
apikey | string | ✓ | Apikey identifier |
metadata | | Metadata for the apikey | |
status | deleted | Set to deleted to remove the apikey | |
apisecret | boolean | Set to true to regenerate the apisecret | |
options | {} | Optional flags for input |
updateApikeyFnOutput
Output of updateApikey
| Attribute | Type | Always | Description |
|---|---|---|---|
apikey | {} | ||
updated | boolean | Boolean showing if the Apikey was updated |