Skip to content
Ona Docs

CreateEnvironmentLogsToken

client.environments.createLogsToken(EnvironmentCreateLogsTokenParams { environmentId } body, RequestOptionsoptions?): EnvironmentCreateLogsTokenResponse { accessToken }
POST/gitpod.v1.EnvironmentService/CreateEnvironmentLogsToken

Creates an access token for retrieving environment logs.

Generated tokens are valid for one hour and provide read-only access to the environment’s logs.

Examples

  • Generate logs token:

    Creates a temporary access token for retrieving environment logs.

    environmentId: "07e03a28-65a5-4d98-b532-8ea67b188048"
ParametersExpand Collapse
body: EnvironmentCreateLogsTokenParams { environmentId }
environmentId?: string

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

+required

formatuuid
ReturnsExpand Collapse
EnvironmentCreateLogsTokenResponse { accessToken }
accessToken: string

access_token is the token that can be used to access the logs of the environment

CreateEnvironmentLogsToken

import Gitpod from '@gitpod/sdk';

const client = new Gitpod({
  bearerToken: process.env['GITPOD_API_KEY'], // This is the default and can be omitted
});

const response = await client.environments.createLogsToken({
  environmentId: '07e03a28-65a5-4d98-b532-8ea67b188048',
});

console.log(response.accessToken);
{
  "accessToken": "accessToken"
}
Returns Examples
{
  "accessToken": "accessToken"
}