---
title: "CreatePortAccessToken"
method: POST
path: "/gitpod.v1.EnvironmentService/CreatePortAccessToken"
tags: ["gitpod.v1.EnvironmentService"]
---

# CreatePortAccessToken

`POST /gitpod.v1.EnvironmentService/CreatePortAccessToken`

Creates an access token for a specific port on an environment.

 The token grants access to the specified port based on the port's admission level.
 Tokens are short-lived (~1 hour) with refresh tokens for long-running connections.

 ### Examples

 - Generate port access token:

   Creates a token for accessing port 8080 on an environment.

   ```yaml
   environmentId: "07e03a28-65a5-4d98-b532-8ea67b188048"
   port: 8080
   ```

## Request body

- GitpodV1CreatePortAccessTokenRequest
  - `environmentId` string, uuid — environment_id specifies the environment for which the port access token should be created. +required
  - `port` integer — port specifies the port number for which the access token should be created. +required

## Response `200`

Success

- GitpodV1CreatePortAccessTokenResponse
  - `accessToken` string, required — access_token is the token that can be used to access the port.

## Other responses

- `default` — Error

---

[API](https://skmtc.net/gitpod-io/apis/gitpod-v1.md) · [All operations](https://skmtc.net/gitpod-io/apis/gitpod-v1/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/gitpod-io/gitpod-v1/revisions/44d50c2ac284/schema)
