> ## Documentation Index
> Fetch the complete documentation index at: https://docs.baseten.co/llms.txt
> Use this file to discover all available pages before exploring further.

# Create a sandbox access token

> Create a token for accessing a sandbox.

<Warning>
  This endpoint is experimental. Baseten can change or remove it without notice.
</Warning>

Related guide: [Create a sandbox access token](/sandboxes/authentication).


## OpenAPI

````yaml post /v1/token
openapi: 3.1.0
info:
  description: REST API for management of Baseten resources
  title: Baseten management API
  version: 1.0.0
servers:
  - url: https://api.baseten.co
security:
  - BearerAuth: []
paths:
  /v1/token:
    post:
      summary: Creates a sandbox access token
      description: >-
        Exchanges your Baseten credentials for a short-lived token that
        authenticates against the sandbox API. The token carries every team you
        belong to. Tokens expire after two hours and cannot be renewed; request
        a new one when needed. This endpoint is experimental and may change or
        be removed without notice.
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateTokenRequestV1'
        required: true
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TokenV1'
      x-codeSamples:
        - lang: bash
          source: |-
            curl --request POST \
            --url https://api.baseten.co/v1/token \
            --header "Authorization: Bearer $BASETEN_API_KEY" \
            --data '{
              "scopes": [
                "sandboxes"
              ]
            }'
        - lang: python
          source: |-
            import requests
            import os
            API_KEY = os.environ.get("BASETEN_API_KEY", "<YOUR_API_KEY>")
            url = "https://api.baseten.co/v1/token"

            headers = {"Authorization": f"Bearer {API_KEY}"}

            response = requests.request(
                "POST",
                url,
                headers=headers,
                json={'scopes': ['sandboxes']}
            )

            print(response.text)
components:
  schemas:
    CreateTokenRequestV1:
      properties:
        scopes:
          description: >-
            What the token should grant access to. Only `sandboxes` is supported
            today; the token then authenticates against the sandbox API.
          examples:
            - - sandboxes
          items:
            $ref: '#/components/schemas/TokenScopeV1'
          minItems: 1
          title: Scopes
          type: array
      required:
        - scopes
      title: CreateTokenRequestV1
      type: object
    TokenV1:
      properties:
        token:
          description: >-
            Short-lived bearer token for the sandbox API. Send it as
            Authorization: Bearer <token>.
          title: Token
          type: string
        expires_at:
          description: >-
            Token expiry in ISO 8601 format. Tokens cannot be renewed; request a
            new one.
          format: date-time
          title: Expires At
          type: string
      required:
        - token
        - expires_at
      title: TokenV1
      type: object
    TokenScopeV1:
      description: What a token minted by POST /v1/token grants access to.
      enum:
        - sandboxes
      title: TokenScopeV1
      type: string
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: >-
        Send `Authorization: Bearer <api_key>`. The legacy `Authorization:
        Api-Key <api_key>` scheme is also accepted.

````