client.services.post_tokens

A method of the Services endpoint.

post_tokens(id: int, name: str, *, machine_token: bool = None, expires_in: int = None) Response

Create a new long-lived service token

API URL: POST /services/{id}/tokens

import civis
client = civis.APIClient()
response = client.services.post_tokens(...)
Parameters:
idint

The ID of the service.

namestr

The name of the token.

machine_tokenbool, optional

If true, create a compact token with no user information.

expires_inint, optional

The number of seconds until the token should expire

Returns:
civis.Response
  • idint

    The ID of the token.

  • namestr

    The name of the token.

  • usercivis.Response
    • idint

      The ID of this user.

    • namestr

      This user’s name.

    • usernamestr

      This user’s username.

    • initialsstr

      This user’s initials.

    • onlinebool

      Whether this user is online.

  • machine_tokenbool

    If true, this token is not tied to a particular user.

  • expires_atstr (date-time)

    The date and time when the token expires.

  • created_atstr (time)

    The date and time when the token was created.

  • tokenstr

    The value of the token. Only returned when the token is first created.