openapi: 3.0.1
servers:
  - url: https://api.hubapi.com/
info:
  title: ""
  version: v1
  x-logo:
    url: https://api.apis.guru/v2/cache/logo/https_developers.hubspot.com_hubfs_assets_hubspot.com_buzz_HubSpotOpenGraph.png
  x-origin:
    - format: openapi
      url: https://api.hubspot.com/api-catalog-public/v1/apis/oauth/v1
      version: "3.0"
  x-providerName: hubapi.com
  x-serviceName: auth
tags:
  - name: Access_Tokens
  - name: Refresh_Tokens
  - name: Tokens
paths:
  "/oauth/v1/access-tokens/{token}":
    get:
      operationId: get-/oauth/v1/access-tokens/{token}_get
      parameters:
        - explode: false
          in: path
          name: token
          required: true
          schema:
            type: string
          style: simple
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/AccessTokenInfoResponse"
          description: successful operation
        default:
          $ref: "#/components/responses/Error"
      security: []
      tags:
        - Access_Tokens
  "/oauth/v1/refresh-tokens/{token}":
    delete:
      operationId: delete-/oauth/v1/refresh-tokens/{token}_archive
      parameters:
        - explode: false
          in: path
          name: token
          required: true
          schema:
            type: string
          style: simple
      responses:
        "204":
          content: {}
          description: No content
        default:
          $ref: "#/components/responses/Error"
      security: []
      tags:
        - Refresh_Tokens
    get:
      operationId: get-/oauth/v1/refresh-tokens/{token}_get
      parameters:
        - explode: false
          in: path
          name: token
          required: true
          schema:
            type: string
          style: simple
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/RefreshTokenInfoResponse"
          description: successful operation
        default:
          $ref: "#/components/responses/Error"
      security: []
      tags:
        - Refresh_Tokens
  /oauth/v1/token:
    post:
      operationId: post-/oauth/v1/token_create
      requestBody:
        content:
          application/x-www-form-urlencoded:
            schema:
              properties:
                client_id:
                  type: string
                client_secret:
                  type: string
                code:
                  type: string
                grant_type:
                  enum:
                    - authorization_code
                    - refresh_token
                  type: string
                redirect_uri:
                  type: string
                refresh_token:
                  type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/TokenResponseIF"
          description: successful operation
        default:
          $ref: "#/components/responses/Error"
      security: []
      tags:
        - Tokens
components:
  responses:
    Error:
      content:
        "*/*":
          schema:
            $ref: "#/components/schemas/Error"
      description: An error occurred.
  schemas:
    AccessTokenInfoResponse:
      properties:
        app_id:
          format: int32
          type: integer
        expires_in:
          format: int32
          type: integer
        hub_domain:
          type: string
        hub_id:
          format: int32
          type: integer
        scope_to_scope_group_pks:
          items:
            format: int32
            type: integer
          type: array
        scopes:
          items:
            type: string
          type: array
        token:
          type: string
        token_type:
          type: string
        trial_scope_to_scope_group_pks:
          items:
            format: int32
            type: integer
          type: array
        trial_scopes:
          items:
            type: string
          type: array
        user:
          type: string
        user_id:
          format: int32
          type: integer
      required:
        - app_id
        - expires_in
        - hub_id
        - scope_to_scope_group_pks
        - scopes
        - token
        - token_type
        - trial_scope_to_scope_group_pks
        - trial_scopes
        - user_id
      type: object
    Error:
      example:
        category: VALIDATION_ERROR
        correlationId: aeb5f871-7f07-4993-9211-075dc63e7cbf
        links:
          knowledge-base: https://www.hubspot.com/products/service/knowledge-base
        message: Invalid input (details will vary based on the error)
      properties:
        category:
          description: The error category
          type: string
        context:
          additionalProperties:
            items:
              type: string
            type: array
          description: Context about the error condition
          example:
            invalidPropertyName:
              - propertyValue
            missingScopes:
              - scope1
              - scope2
          type: object
        correlationId:
          description: A unique identifier for the request. Include this value with any error reports or support tickets
          example: aeb5f871-7f07-4993-9211-075dc63e7cbf
          format: uuid
          type: string
        errors:
          description: further information about the error
          items:
            $ref: "#/components/schemas/ErrorDetail"
          type: array
        links:
          additionalProperties:
            type: string
          description: A map of link names to associated URIs containing documentation about the error or recommended remediation steps
          type: object
        message:
          description: A human readable message describing the error along with remediation steps where appropriate
          example: An error occurred
          type: string
        subCategory:
          description: A specific category that contains more specific detail about the error
          type: string
      required:
        - category
        - correlationId
        - message
      type: object
    ErrorDetail:
      properties:
        code:
          description: The status code associated with the error detail
          type: string
        context:
          additionalProperties:
            items:
              type: string
            type: array
          description: Context about the error condition
          example:
            missingScopes:
              - scope1
              - scope2
          type: object
        in:
          description: The name of the field or parameter in which the error was found.
          type: string
        message:
          description: A human readable message describing the error along with remediation steps where appropriate
          type: string
        subCategory:
          description: A specific category that contains more specific detail about the error
          type: string
      required:
        - message
      type: object
    RefreshTokenInfoResponse:
      properties:
        client_id:
          type: string
        hub_domain:
          type: string
        hub_id:
          format: int32
          type: integer
        scopes:
          items:
            type: string
          type: array
        token:
          type: string
        token_type:
          type: string
        user:
          type: string
        user_id:
          format: int32
          type: integer
      required:
        - client_id
        - hub_id
        - scopes
        - token
        - token_type
        - user_id
      type: object
    TokenResponseIF:
      properties:
        access_token:
          type: string
        expires_in:
          format: int32
          type: integer
        id_token:
          type: string
        refresh_token:
          type: string
        token_type:
          type: string
      required:
        - access_token
        - expires_in
        - refresh_token
        - token_type
      type: object
x-hubspot-available-client-libraries:
  - PHP
  - Node
  - Python
  - Ruby
