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

# Create an access token

> Exchanges OAuth 2.0 client credentials for a short-lived Bearer access token. Send the token in the `Authorization` header of subsequent requests. Tokens typically expire after one hour; request a new token when the current one expires. This endpoint does not accept a Bearer token.



## OpenAPI

````yaml /openapi.json post /auth/token
openapi: 3.0.0
info:
  title: goLance External API
  version: 1.0.0
servers:
  - url: https://external-api.golance.com
security: []
paths:
  /auth/token:
    post:
      tags:
        - Authentication
      summary: Create an access token
      description: >-
        Exchanges OAuth 2.0 client credentials for a short-lived Bearer access
        token. Send the token in the `Authorization` header of subsequent
        requests. Tokens typically expire after one hour; request a new token
        when the current one expires. This endpoint does not accept a Bearer
        token.
      requestBody:
        description: Client credentials issued for the company OAuth application.
        content:
          application/json:
            schema:
              type: object
              properties:
                clientId:
                  type: string
                  minLength: 1
                clientSecret:
                  type: string
                  minLength: 1
              required:
                - clientId
                - clientSecret
      responses:
        '200':
          description: >-
            An access token was issued. Cache `accessToken` until `expiresIn`
            seconds have elapsed.
          content:
            application/json:
              schema:
                type: object
                properties:
                  accessToken:
                    type: string
                  tokenType:
                    type: string
                    enum:
                      - Bearer
                  expiresIn:
                    type: number
                    minimum: 0
                    description: Expiration time in seconds
                required:
                  - accessToken
                  - tokenType
                  - expiresIn
        '400':
          description: >-
            The request body or query parameters failed validation. Returns
            `validation_error` and field-level `details`.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    description: Machine-readable error code
                  message:
                    type: string
                    description: Human-readable error message
                  details:
                    type: object
                    additionalProperties:
                      nullable: true
                    description: Field-level validation errors
                required:
                  - error
                  - message
        '401':
          description: >-
            The client ID or client secret is incorrect. Returns
            `invalid_client`.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    description: Machine-readable error code
                  message:
                    type: string
                    description: Human-readable error message
                  details:
                    type: object
                    additionalProperties:
                      nullable: true
                    description: Field-level validation errors
                required:
                  - error
                  - message
        '429':
          description: >-
            The client exceeded the authentication rate limit of 5 requests per
            minute per IP address and per client ID. Returns `rate_limited`.
            Wait for the `Retry-After` header before retrying.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    description: Machine-readable error code
                  message:
                    type: string
                    description: Human-readable error message
                  details:
                    type: object
                    additionalProperties:
                      nullable: true
                    description: Field-level validation errors
                required:
                  - error
                  - message
        '500':
          description: The token could not be issued. Returns `internal_error`.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    description: Machine-readable error code
                  message:
                    type: string
                    description: Human-readable error message
                  details:
                    type: object
                    additionalProperties:
                      nullable: true
                    description: Field-level validation errors
                required:
                  - error
                  - message

````