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

# Issue an OAuth token

> Issue an OAuth token using client credentials.



## OpenAPI

````yaml https://api.engine.usesophic.com/openapi.json post /auth/token
openapi: 3.1.0
info:
  title: Sophic Engine API
  version: 0.1.0
servers:
  - url: https://api.engine.usesophic.com/
security: []
paths:
  /auth/token:
    post:
      summary: Issue an OAuth token
      description: Issue an OAuth token using client credentials.
      operationId: issue_token_auth_token_post
      requestBody:
        content:
          application/x-www-form-urlencoded:
            schema:
              $ref: '#/components/schemas/ClientCredentialsForm'
        required: true
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OAuthToken'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    ClientCredentialsForm:
      properties:
        client_id:
          type: string
          title: Client Id
          description: OAuth client ID.
        scope:
          title: Scope
          description: Space-separated list of scopes.
          x-remove-null-from-type-union: true
          type: string
        grant_type:
          const: client_credentials
          title: Grant Type
          description: Must be `client_credentials`.
        client_secret:
          type: string
          title: Client Secret
          description: OAuth client secret.
      type: object
      required:
        - client_id
        - grant_type
        - client_secret
      title: ClientCredentialsForm
      description: Form for the `client_credentials` grant type.
    OAuthToken:
      properties:
        access_token:
          type: string
          title: Access Token
          description: The access token.
        token_type:
          type: string
          title: Token Type
          description: The token type. Always 'bearer' for JWT tokens.
        expires_in:
          type: integer
          title: Expires In
          description: The number of seconds until the token expires.
        scope:
          type: string
          title: Scope
          description: The scopes of the token, comma-separated.
        refresh_token:
          anyOf:
            - type: string
            - type: 'null'
          title: Refresh Token
          description: >-
            A refresh token for obtaining new access tokens without
            re-authentication.
      type: object
      required:
        - access_token
        - token_type
        - expires_in
        - scope
      title: OAuthToken
    Error:
      properties:
        detail:
          type: string
          title: Detail
          description: A human-readable description of the error.
        code:
          type: string
          title: Code
          description: A machine-readable error code.
        docs:
          title: Docs
          description: A URL to documentation about this error code.
          x-remove-null-from-type-union: true
          type: string
        context:
          title: Context
          description: An optional object for adding extra context to the error.
          x-remove-null-from-type-union: true
          additionalProperties:
            anyOf:
              - type: string
              - type: integer
          type: object
        params:
          title: Params
          description: An optional list of params that failed validation.
          x-remove-null-from-type-union: true
          items:
            $ref: '#/components/schemas/InvalidParam'
          type: array
      type: object
      required:
        - detail
        - code
      title: Error
    InvalidParam:
      properties:
        path:
          items:
            anyOf:
              - type: integer
              - type: string
          type: array
          title: Path
          description: Path to the field name (or index if a list) that errored.
        detail:
          type: string
          title: Detail
          description: Human-readable detail for error.
        code:
          type: string
          title: Code
          description: A machine-readable error code.
      type: object
      required:
        - path
        - detail
        - code
      title: InvalidParam

````