Skip to main content
GET
/
iam
/
clients
/
{clientId}
/
tokens
Python
from gcore import Gcore

client = Gcore(
    api_key="My API Key",
)
api_token_list = client.iam.api_tokens.list(
    client_id=0,
)
print(api_token_list)
[
  {
    "name": "My token",
    "description": "It's my token",
    "exp_date": "2021-01-01 12:00:00+00:00",
    "client_user": {
      "role": {
        "id": 1,
        "name": "Administrators"
      },
      "deleted": false,
      "user_id": 123,
      "user_name": "John Doe",
      "user_email": "some@email.com",
      "client_id": 456
    },
    "id": 42,
    "deleted": false,
    "expired": false,
    "created": "2021-01-01 12:00:00+00:00",
    "last_usage": "2021-01-01 12:00:00+00:00"
  }
]

Authorizations

Authorization
string
header
required

API key for authentication. Make sure to include the word apikey, followed by a single space and then your token. Example: apikey 1234$abcdef

Path Parameters

clientId
integer
required

Account ID.

Query Parameters

role
string

Group's ID. Possible values are:

  • 1 - Administrators* 2 - Users* 5 - Engineers* 3009 - Purge and Prefetch only (API+Web)* 3022 - Purge and Prefetch only (API)

Example, &role=Engineers

issued_by
integer

User's ID. Use to get API tokens issued by a particular user.
Example, &issued_by=1234

not_issued_by
integer

User's ID. Use to get API tokens issued by anyone except a particular user.
Example, ¬_issued_by=1234

deleted
boolean

The state of API tokens included in the response.
Two possible values:

  • True - API token was not deleted.* False - API token was deleted.

Example, &deleted=True

Response

OK.

name
string
required

API token name.

Example:

"My token"

exp_date
string | null
required

Date when the API token becomes expired (ISO 8086/RFC 3339 format), UTC. If null, then the API token will never expire.

Example:

"2021-01-01 12:00:00+00:00"

client_user
object
required

API token role. API token role and issuer data.

id
integer
required

API token ID.

Example:

42

deleted
boolean
required

Deletion flag. If true, then the API token was deleted.

Example:

false

expired
boolean
required

Expiration flag. If true, then the API token has expired. When an API token expires it will be automatically deleted.

Example:

false

created
string
required

Date when the API token was issued (ISO 8086/RFC 3339 format), UTC.

Example:

"2021-01-01 12:00:00+00:00"

last_usage
string
required

Date when the API token was last used (ISO 8086/RFC 3339 format), UTC.

Example:

"2021-01-01 12:00:00+00:00"

description
string

API token description.

Example:

"It's my token"

I