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

# Get access token

> Obtain an access token using OAuth 2.0 client credentials flow. The token must be included
in the `Authorization` header as `Bearer <token>` for all subsequent API requests.

Tokens expire after a set period and must be refreshed by requesting a new token.




## OpenAPI

````yaml post /oauth/token
openapi: 3.0.3
info:
  title: Wealthyhood Authentication API
  version: 1.0.0
  description: >
    OAuth 2.0 authentication endpoints for obtaining access tokens to
    authenticate API requests.


    The Authentication API uses the OAuth 2.0 client credentials flow, which is
    designed for

    machine-to-machine (M2M) communication. Access tokens are required for all
    Wealthyhood API endpoints.
servers:
  - url: '{auth_endpoint_url}'
    variables:
      auth_endpoint_url:
        default: https://wealthyhood-sandbox.eu.auth0.com
        description: Authentication server endpoint URL.
security: []
tags:
  - name: Authentication
    description: OAuth 2.0 token endpoints.
paths:
  /oauth/token:
    post:
      tags:
        - Authentication
      summary: Get access token
      description: >
        Obtain an access token using OAuth 2.0 client credentials flow. The
        token must be included

        in the `Authorization` header as `Bearer <token>` for all subsequent API
        requests.


        Tokens expire after a set period and must be refreshed by requesting a
        new token.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - grant_type
                - audience
                - client_id
                - client_secret
              properties:
                grant_type:
                  type: string
                  description: OAuth 2.0 grant type. Must be `client_credentials`.
                  enum:
                    - client_credentials
                  example: client_credentials
                audience:
                  type: string
                  description: API identifier/audience for the access token.
                  example: your-audience
                client_id:
                  type: string
                  description: Your client identifier issued by Wealthyhood.
                  example: your-client-id
                client_secret:
                  type: string
                  description: Your client secret issued by Wealthyhood.
                  format: password
                  example: your-client-secret
            examples:
              clientCredentials:
                summary: Client credentials request
                value:
                  grant_type: client_credentials
                  audience: your-audience
                  client_id: your-client-id
                  client_secret: your-client-secret
      responses:
        '200':
          description: Access token successfully issued.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TokenResponse'
              examples:
                success:
                  summary: Successful token response
                  value:
                    access_token: eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9...
                    token_type: Bearer
                    expires_in: 3600
                    scope: your-scope
        '400':
          description: Bad request – invalid parameters or malformed request.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                invalidGrant:
                  summary: Invalid grant type
                  value:
                    error: invalid_grant
                    error_description: Grant type must be client_credentials
                missingParameter:
                  summary: Missing required parameter
                  value:
                    error: invalid_request
                    error_description: Missing required parameter 'client_id'
        '401':
          description: Unauthorized – invalid client credentials.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                invalidClient:
                  summary: Invalid client credentials
                  value:
                    error: invalid_client
                    error_description: Client authentication failed
components:
  schemas:
    TokenResponse:
      type: object
      required:
        - access_token
        - token_type
        - expires_in
        - scope
      properties:
        access_token:
          type: string
          description: >
            The bearer token to include in API requests. Use this token in the
            `Authorization` header

            as `Bearer <access_token>`.
          example: >-
            eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ...
        token_type:
          type: string
          description: Token type. Always `Bearer` for this API.
          enum:
            - Bearer
          example: Bearer
        expires_in:
          type: integer
          description: >
            Number of seconds until the access token expires. Request a new
            token before expiration

            to maintain uninterrupted API access.
          example: 3600
          minimum: 1
        scope:
          type: string
          description: Granted scope for this token.
          example: your-scope
    Error:
      type: object
      required:
        - error
        - error_description
      properties:
        error:
          type: string
          description: Machine-readable error code following OAuth 2.0 error format.
          example: invalid_client
          enum:
            - invalid_request
            - invalid_client
            - invalid_grant
            - unauthorized_client
            - unsupported_grant_type
            - invalid_scope
        error_description:
          type: string
          description: Human-readable error description providing additional context.
          example: Client authentication failed

````