Api token
Generate an API token for the current user.
Use this endpoint to generate an API token for the current user. Two types of API tokens are supported:
- Generic API token: This token is short-lived and can be used for generic automation tasks. The expiration can be set by the user, but the server will impose a maximum expiration time.
- Workload API token: This token is scoped to a specific pipeline run, schedule or deployment and is used by pipeline workloads to authenticate with the server. A pipeline run ID, schedule ID or deployment ID must be provided and the generated token will only be valid for the indicated pipeline run, schedule or deployment. No time limit is imposed on the validity of the token. A workload API token can be used to authenticate and generate another workload API token, but only for the same schedule, pipeline run ID or deployment ID, in that order.
Args: token_type: The type of API token to generate. expires_in: The expiration time of the generic API token in seconds. If not set, the server will use the default expiration time for generic API tokens. The server also imposes a maximum expiration time. schedule_id: The ID of the schedule to scope the workload API token to. pipeline_run_id: The ID of the pipeline run to scope the workload API token to. deployment_id: The ID of the deployment to scope the workload API token to. auth_context: The authentication context.
Returns: The API token.
Raises: AuthorizationException: If not authorized to generate the API token. ValueError: If the request is invalid.
The API token type.
genericPossible values: Successful Response
Unauthorized
Validation Error
GET /api/v1/api_token HTTP/1.1
Host:
Authorization: Bearer YOUR_OAUTH2_TOKEN
Accept: */*
textLast updated
Was this helpful?