# Get databases

This endpoint retrieves databases belonging to the account of the calling user.

Method Path Operation*
GET account/services/databases get_databases

*

In order for a user to perform the "get_databases" operation, the "get_databases" permission must be included in the list of allowed actions in the statement of the user's role.

# Request

No parameters.

Request
curl --location --request PATCH 'https://rest.trustedtwin.com/account/services/databases' \
--header 'Authorization: VVNSC3bOfkVsVt/NsuQMr8VVJ+i0GTefQAcGjiu9V1TpqopWR75fC1W0pa10R3Gg' \
>--header 'Content-Type: text/plain'
from trustedtwin.tt_api import TTRESTService

TT_SERVICE = TTRESTService(
    tt_auth="VVNSC3bOfkVsVt/NsuQMr8VVJ+i0GTefQAcGjiu9V1TpqopWR75fC1W0pa10R3Gg"
)

status, response = TT_SERVICE.get_databases()

# Response

Attribute Type Description
default string Database UUID of the default database of the account.
databases dictionary Dictionary containing databases with their attributes:
- key: Database UUID.
- value: Database attributes

# Database attributes

Attribute Type Description
status string, value is "running", "pending", or "service" Status of the database:
- "running": The Timeseries database is running.
- "pending": The Timeseries database is in the process of initialising.
- "service": Unexpected behaviour occurred and the Timeseries database is not available.
note string User-defined note. The maximum length of a note is 256 characters.
created_ts timestamp Time at which the database was created. Measured in seconds (to three decimal places) that have elapsed since the Unix epoch(opens new window).
updated_ts timestamp Time at which the database was last updated. Measured in seconds (to three decimal places) that have elapsed since the Unix epoch(opens new window).
Example JSON response
{
    "default": "75f48545-2442-4491-81cd-7679f665fa27", 
    "databases": {
        "75f48545-2442-4491-81cd-7679f665fa27":{
            "status": "running",
            "created_ts": 1705570409,
            "updated_ts": 1705570409,
            "note": "database_x" 
        },
        "1c35c001-1c1f-4c82-9fae-88ea4c7aec4c": {
            "status": "running",
            "created_ts": 1706521206,
            "updated_ts": 1706607606,
            "note": "database_y" 
        }
    }
}

Was this article helpful?