API#
Taubot V2.1 exposes an HTTPS API available at https://taubot.qzz.io/api, refered to in this documentation from here on out as TBAPI. The main usage of TBAPI is to enable applications and businesses to automate different aspects of Taubot such as transferring funds from one account to another.
Authentication#
Please fill out the API application form to request an application be made and a key to be provided.
TBAPI relies on two kinds of API keys: Master and Grant.
Master Key |
Grant Key |
|---|---|
Master keys are issued to applications and are notable for their ability to create Grant keys. |
Grant keys are issued to individuals by the Department of Technology in order to enable them to control their personal accounts. Primarily, they are issued by users to applications to grant the application a subset of permissions on a certain account. |
The key being used to make a request should be set as the Authorization HTTP header, for example:
Authorization: Bearer YOUR_KEY_HERE
Warning
Master keys expire in 60 days, while Grant keys expire in 90 days.
API reference#
Response Types#
Application#
Key |
Type |
Description |
|---|---|---|
application_id |
String |
The application’s UUID, encoded as a string |
application_name |
String |
The name of the application |
economy_name |
String |
The application’s economy currency name |
economy_id |
String |
The application economy’s UUID, encoded as a string |
owner_id |
String |
The application owner’s ID, encoded as a string |
Account#
Key |
Type |
Description |
|---|---|---|
account_id |
String |
The account’s UUID, encoded as a string |
owner_id |
String |
The account owner’s ID, encoded as a string |
account_name |
String |
The name of the account |
account_type |
String |
The type of account |
balance |
Integer |
The balance of the account in cents (for example: 100 would be 1 of a currency and 101 would be 1.01 of a currency) |
Transaction#
Key |
Type |
Description |
|---|---|---|
actor_id |
String |
The ID of the user or API key that performed this transaction, encoded as a string |
timestamp |
Double |
The Unix timestamp of when the transaction took place, returned as a float |
from_account |
String |
The account UUID of the account the money was transferred from, encoded as a string |
to_account |
String |
The account UUID of the account the money was sent to, encoded as a string |
amount |
Integer |
The amount in cents that was transferred |
Endpoints#
- GET /api/applications/{app_id}#
Gets an application by its UUID.
- Path app_id:
The application’s UUID or
mefor the requesting key’s application.- Status Codes:
200 OK – Returns an Application object.
400 Bad Request – Application UUID is invalid or malformed.
404 Not Found – Application not found.
Example Response (200 OK)
{ "application_id": "f47ac10b-58cc-4372-a567-0e02b2c3d479", "application_name": "test", "economy_name": "test", "economy_id": "af93101b-8301-4f97-96b5-dcfa9a28f90a", "owner_id": "809875420350119958" }
- GET /api/applications/users/{user_id}#
Gets a user’s applications.
- Path user_id:
The user’s Discord ID.
- Status Codes:
200 OK – Returns a list of Application objects.
400 Bad Request – User ID is a non-integer value.
403 Forbidden – The requesting key does not have the permission to view user applications (
MANAGE_ECONOMIES).
Example Response (200 OK)
[ { "application_id": "f47ac10b-58cc-4372-a567-0e02b2c3d479", "application_name": "test", "economy_name": "test", "economy_id": "af93101b-8301-4f97-96b5-dcfa9a28f90a", "owner_id": "809875420350119958" } ]
- GET /api/accounts#
Gets an account matching a specific name or owned by a specific user. Only one query parameter must be provided.
- Query Parameters:
user_id – The user’s Discord ID.
name – The account’s name.
- Status Codes:
400 Bad Request – Both or neither of
user_idand :name were entered, or the user ID is a non-integer value.404 Not Found – Account not found.
Example Request (HTTP)
GET /api/accounts?user_id=809875420350119958 HTTP/1.1 Host: taubot.qzz.io Authorization: Bearer ...
Note
The requesting key must have the
VIEW_BALANCEpermission to get the account’s balance, else the balance returned will benull.Example Response (200 OK)
{ "account_id": "021b1643-fcec-4cbb-bc00-ea136155e2e8", "owner_id": "809875420350119958", "account_name": "<@!809875420350119958>'s account", "account_type": "USER", "balance": null }
- GET /api/accounts/{acc_id}#
Gets an account by its UUID.
- Path acc_id:
The account’s UUID.
- Status Codes:
400 Bad Request – Account UUID is invalid or malformed.
404 Not Found – Account not found.
Note
The requesting key must have the
VIEW_BALANCEpermission to get the account’s balance, else the balance returned will benull.Example Response (200 OK)
{ "account_id": "021b1643-fcec-4cbb-bc00-ea136155e2e8", "owner_id": "809875420350119958", "account_name": "<@!809875420350119958>'s account", "account_type": "USER", "balance": null }
- POST /api/transactions/create#
Note
This endpoint is limited to Grant keys only.
Creates a new transaction; i.e. transfers fund from the requesting key’s account to another account.
- JSON Parameters:
to_account_id – The UUID of the destination account.
amount – The amount to transfer in cents.
- Status Codes:
200 OK – Transaction is successful.
400 Bad Request – To account UUID is invalid or malformed.
403 Forbidden – Error code 1000 - Cannot transfer from and to the same account.
403 Forbidden – Error code 1001 - Insufficient funds.
403 Forbidden – Error code 1002 - Spending limit reached.
404 Not Found – To account not found.
Example Request Body
{ "to_account_id": "021b1643-fcec-4cbb-bc00-ea136155e2e8", "amount": 10000 }
Example Response (403 Forbidden)
{ "error_code": 1000, "detail": "Cannot transfer from and to the same account" }
Example Response (200 OK)
{ "detail": "Successfully performed transaction" }
- GET /api/transactions#
Note
This endpoint is limited to Grant keys only.
Get the transactions of the requesting key’s account.
- Query Parameters:
limit – (Optional) The amount of transactions to return. Must be greater than 0 and less than 100.
sort – (Optional) Whether to sort the transactions in ascending or descending order of date.
0- newest first,1- oldest first.before – (Optional) Filter transactions made before a float timestamp.
after – (Optional) Filter transactions made after a float timestamp.
- Status Codes:
200 OK – Returns a list of Transaction objects.
400 Bad Request – Error code 2000 - Invalid sort mode.
400 Bad Request – Error code 2001 - Limit is less than or equal to 0.
400 Bad Request – Error code 2002 - Limit is greater than 100.
403 Forbidden – The requesting key does not have the permission to view transactions (
VIEW_BALANCE).
Example Request (HTTP)
GET /api/transactions?limit=10&sort=1 HTTP/1.1 Host: taubot.qzz.io Authorization: Bearer ...
Example Response (403 Forbidden)
{ "error_code": 2000, "detail": "Sort mode must be either: 0 - newest first, 1 - oldest first" }
Example Response (200 OK)
[ { "actor_id": "2", "timestamp": 1770647320.966851, "from_account": "021b1643-fcec-4cbb-bc00-ea136155e2e8", "to_account": "d107dd80-54de-4537-bd0c-fb63b9b0aff6", "amount": 300 }, { "actor_id": "3", "timestamp": 1770632032.316085, "from_account": "021b1643-fcec-4cbb-bc00-ea136155e2e8", "to_account": "d107dd80-54de-4537-bd0c-fb63b9b0aff6", "amount": 30000 } ]