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

# Get Access Token

> Use Access Tokens to access HoopAI resources on behalf of an authenticated location/company.



## OpenAPI

````yaml /api-reference/oauth/openapi.json post /oauth/token
openapi: 3.0.0
info:
  title: OAuth 2.0
  description: Documentation for OAuth 2.0 API
  version: '1.0'
  contact: {}
servers:
  - url: https://services.leadconnectorhq.com
security: []
tags:
  - name: OAuth 2.0
    description: Documentation for OAuth 2.0 API
paths:
  /oauth/token:
    post:
      tags:
        - OAuth 2.0
      summary: Get Access Token
      description: >-
        Use Access Tokens to access HoopAI resources on behalf of an
        authenticated location/company.
      operationId: get-access-token
      parameters: []
      requestBody:
        required: true
        content:
          application/x-www-form-urlencoded:
            schema:
              $ref: '#/components/schemas/GetAccessCodebodyDto'
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetAccessCodeSuccessfulResponseDto'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BadRequestDTO'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UnauthorizedDTO'
        '422':
          description: Unprocessable Entity
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UnprocessableDTO'
components:
  schemas:
    GetAccessCodebodyDto:
      type: object
      properties:
        client_id:
          type: string
          description: The ID provided by HoopAI for your integration
        client_secret:
          type: string
        grant_type:
          type: string
          enum:
            - authorization_code
            - refresh_token
            - client_credentials
        code:
          type: string
        refresh_token:
          type: string
        user_type:
          type: string
          description: The type of token to be requested
          example: Location
          enum:
            - Company
            - Location
        redirect_uri:
          type: string
          description: The redirect URI for your application
          example: https://myapp.com/oauth/callback/hoopai
      required:
        - client_id
        - client_secret
        - grant_type
    GetAccessCodeSuccessfulResponseDto:
      type: object
      properties:
        access_token:
          type: string
          example: ab12dc0ae1234a7898f9ff06d4f69gh
        token_type:
          type: string
          example: Bearer
        expires_in:
          type: number
          example: 86399
        refresh_token:
          type: string
          example: xy34dc0ae1234a4858f9ff06d4f66ba
        scope:
          type: string
          example: conversations/message.readonly conversations/message.write
        userType:
          type: string
          example: Location
        locationId:
          type: string
          description: Location ID - Present only for Sub-Account Access Token
          example: l1C08ntBrFjLS0elLIYU
        companyId:
          type: string
          description: Company ID
          example: l1C08ntBrFjLS0elLIYU
        approvedLocations:
          description: Approved locations to generate location access token
          example:
            - l1C08ntBrFjLS0elLIYU
          type: array
          items:
            type: string
        userId:
          type: string
          description: USER ID - Represent user id of person who performed installation
          example: l1C08ntBrFjLS0elLIYU
        planId:
          type: string
          description: Plan Id of the subscribed plan in paid apps.
          example: l1C08ntBrFjLS0elLIYU
        isBulkInstallation:
          type: boolean
          example: Bearer
      required:
        - userId
    BadRequestDTO:
      type: object
      properties:
        statusCode:
          type: number
          example: 400
        message:
          type: string
          example: Bad Request
    UnauthorizedDTO:
      type: object
      properties:
        statusCode:
          type: number
          example: 401
        message:
          type: string
          example: 'Invalid token: access token is invalid'
        error:
          type: string
          example: Unauthorized
    UnprocessableDTO:
      type: object
      properties:
        statusCode:
          type: number
          example: 422
        message:
          example:
            - Unprocessable Entity
          type: array
          items:
            type: string
        error:
          type: string
          example: Unprocessable Entity

````