> ## 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 Location Access Token from Agency Token

> This API allows you to generate locationAccessToken from AgencyAccessToken



## OpenAPI

````yaml /api-reference/oauth/openapi.json post /oauth/locationToken
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/locationToken:
    post:
      tags:
        - OAuth 2.0
      summary: Get Location Access Token from Agency Token
      description: >-
        This API allows you to generate locationAccessToken from
        AgencyAccessToken
      operationId: get-location-access-token
      parameters:
        - name: Version
          in: header
          description: API Version
          required: true
          schema:
            type: string
            enum:
              - '2021-07-28'
      requestBody:
        required: true
        content:
          application/x-www-form-urlencoded:
            schema:
              $ref: '#/components/schemas/GetLocationAccessCodeBodyDto'
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/GetLocationAccessTokenSuccessfulResponseDto
        '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'
      security:
        - bearer:
            - oauth.write
components:
  schemas:
    GetLocationAccessCodeBodyDto:
      type: object
      properties:
        companyId:
          type: string
          description: Company Id of location you want to request token for
        locationId:
          type: string
          description: The location ID for which you want to obtain accessToken
      required:
        - companyId
        - locationId
    GetLocationAccessTokenSuccessfulResponseDto:
      type: object
      properties:
        access_token:
          type: string
          example: ab12dc0ae1234a7898f9ff06d4f69gh
          description: >-
            Location access token which can be used to authenticate & authorize
            API under following scope
        token_type:
          type: string
          example: Bearer
        expires_in:
          type: number
          example: 86399
          description: Time in seconds remaining for token to expire
        scope:
          type: string
          example: conversations/message.readonly conversations/message.write
          description: Scopes the following accessToken have access to
        locationId:
          type: string
          description: Location ID - Present only for Sub-Account Access Token
          example: l1C08ntBrFjLS0elLIYU
        planId:
          type: string
          description: Plan Id of the subscribed plan in paid apps.
          example: l1C08ntBrFjLS0elLIYU
        userId:
          type: string
          description: USER ID - Represent user id of person who performed installation
          example: l1C08ntBrFjLS0elLIYU
      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
  securitySchemes:
    bearer:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: Access Token or Private Integration Token

````