Skip to content
Ona Docs

CreateEnvironmentAccessToken

environments.create_environment_token(EnvironmentCreateEnvironmentTokenParams**kwargs) -> EnvironmentCreateEnvironmentTokenResponse
POST/gitpod.v1.EnvironmentService/CreateEnvironmentAccessToken

Creates an access token for the environment.

Generated tokens are valid for one hour and provide environment-specific access permissions. The token is scoped to a specific environment.

Examples

  • Generate environment token:

    Creates a temporary access token for accessing an environment.

    environmentId: "07e03a28-65a5-4d98-b532-8ea67b188048"
ParametersExpand Collapse
environment_id: str

environment_id specifies the environment for which the access token should be created.

formatuuid
ReturnsExpand Collapse
class EnvironmentCreateEnvironmentTokenResponse:
access_token: str

access_token is the token that can be used for environment authentication

CreateEnvironmentAccessToken

import os
from gitpod import Gitpod

client = Gitpod(
    bearer_token=os.environ.get("GITPOD_API_KEY"),  # This is the default and can be omitted
)
response = client.environments.create_environment_token(
    environment_id="07e03a28-65a5-4d98-b532-8ea67b188048",
)
print(response.access_token)
{
  "accessToken": "accessToken"
}
Returns Examples
{
  "accessToken": "accessToken"
}