Getting started
Back to home
Getting started

List database tokens

List connection-token metadata for the database. Existing token secrets are not returned.

GET/api/customer/v1/projects/{projectId}/databases/{databaseId}/tokens

Path parameters

NameValue
projectIdRequired resource ID from an earlier API response.
databaseIdRequired resource ID from an earlier API response.

Example request

Set HCODE_BASE_URL and HCODE_API_KEY as shown in Getting started. Replace resource variables with your own IDs.

curl --request GET "$HCODE_BASE_URL/api/customer/v1/projects/${PROJECT_ID}/databases/${DATABASE_ID}/tokens" \
  --header "Authorization: Bearer $HCODE_API_KEY"

Response

The JSON shape is defined in the response schema.

Response schema
{
  "type": "object",
  "properties": {
    "tokens": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "rawToken": {
            "type": "string"
          },
          "label": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "expiresAt": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "createdAt": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "isPermanent": {
            "type": "boolean"
          }
        },
        "required": [
          "id"
        ],
        "additionalProperties": true
      }
    }
  },
  "required": [
    "tokens"
  ],
  "additionalProperties": true
}

See errors and retries for failure responses.