> ## 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 Grid access token

> Exchanges your API key for a short-lived token that authenticates against the Grid gateway as you, in one team.



## OpenAPI

````yaml post /v1/grid/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/grid/token:
    post:
      summary: Creates a Grid access token
      description: >-
        Exchanges your Baseten credentials for a short-lived token that
        authenticates against the Grid gateway as you, in the given team. Tokens
        expire after four hours and cannot be renewed; request a new one when
        needed. Routes keys cannot create tokens.
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateGridTokenRequestV1'
        required: true
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GridTokenV1'
      x-codeSamples:
        - lang: bash
          source: |-
            curl --request POST \
            --url https://api.baseten.co/v1/grid/token \
            --header "Authorization: Bearer $BASETEN_API_KEY" \
            --data '{
              "team_id": "abc1234"
            }'
        - lang: python
          source: |-
            import requests
            import os
            API_KEY = os.environ.get("BASETEN_API_KEY", "<YOUR_API_KEY>")
            url = "https://api.baseten.co/v1/grid/token"

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

            response = requests.request(
                "POST",
                url,
                headers=headers,
                json={'team_id': 'abc1234'}
            )

            print(response.text)
components:
  schemas:
    CreateGridTokenRequestV1:
      properties:
        team_id:
          anyOf:
            - minLength: 1
              type: string
            - type: 'null'
          default: null
          description: >-
            ID of the team. When omitted, the team you belong to; required when
            you belong to several.
          examples:
            - abc1234
          title: Team Id
      title: CreateGridTokenRequestV1
      type: object
    GridTokenV1:
      properties:
        token:
          description: >-
            Short-lived bearer token for the Grid gateway, scoped to you and the
            team. 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
        team_id:
          description: ID of the team the token invokes Grid routes in.
          examples:
            - abc1234
          title: Team Id
          type: string
        team_name:
          description: Name of that team.
          examples:
            - Engineering
          title: Team Name
          type: string
      required:
        - token
        - expires_at
        - team_id
        - team_name
      title: GridTokenV1
      type: object
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: >-
        Send `Authorization: Bearer <api_key>`. The legacy `Authorization:
        Api-Key <api_key>` scheme is also accepted.

````