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

# Test OAuth2 connection

> This endpoint tests the OAuth2 connection by attempting to exchange a token



## OpenAPI

````yaml post /v1/projects/{projectID}/endpoints/oauth2/test
openapi: 3.0.0
info:
  contact:
    email: support@getconvoy.io
    name: Convoy Support
    url: https://getconvoy.io/docs
  description: >-
    Convoy is a fast and secure webhooks proxy. This document contains
    datastore.s API specification.
  license:
    name: Mozilla Public License 2.0
    url: https://www.mozilla.org/en-US/MPL/2.0/
  termsOfService: https://getconvoy.io/terms
  title: Convoy API Reference
  version: 24.1.4
servers:
  - url: https://us.getconvoy.cloud/api
    description: US Region
  - url: https://eu.getconvoy.cloud/api
    description: EU Region
security: []
tags:
  - description: Subscription related APIs
    name: Subscriptions
  - description: Endpoint related APIs
    name: Endpoints
  - description: Event related APIs
    name: Events
  - description: Source related APIs
    name: Sources
  - description: EventDelivery related APIs
    name: Event Deliveries
  - description: Delivery Attempt related APIs
    name: Delivery Attempts
  - description: Portal Links related APIs
    name: Portal Links
  - description: Meta Events related APIs
    name: Meta Events
  - description: Event Types related APIs
    name: EventTypes
  - description: Filters related APIs
    name: Filters
  - description: Onboard related APIs
    name: Onboard
paths:
  /v1/projects/{projectID}/endpoints/oauth2/test:
    post:
      tags:
        - Endpoints
      summary: Test OAuth2 connection
      description: >-
        This endpoint tests the OAuth2 connection by attempting to exchange a
        token
      operationId: TestOAuth2Connection
      parameters:
        - description: Project ID
          in: path
          name: projectID
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/models.TestOAuth2Request'
        description: OAuth2 Configuration
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/util.ServerResponse'
                  - properties:
                      data:
                        $ref: '#/components/schemas/models.TestOAuth2Response'
                    type: object
          description: OK
        '400':
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/util.ServerResponse'
                  - properties:
                      data:
                        $ref: '#/components/schemas/handlers.Stub'
                    type: object
          description: Bad Request
        '401':
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/util.ServerResponse'
                  - properties:
                      data:
                        $ref: '#/components/schemas/handlers.Stub'
                    type: object
          description: Unauthorized
        '404':
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/util.ServerResponse'
                  - properties:
                      data:
                        $ref: '#/components/schemas/handlers.Stub'
                    type: object
          description: Not Found
      security:
        - ApiKeyAuth: []
components:
  schemas:
    models.TestOAuth2Request:
      properties:
        oauth2:
          $ref: '#/components/schemas/models.OAuth2'
      type: object
    util.ServerResponse:
      properties:
        message:
          type: string
        status:
          type: boolean
      type: object
    models.TestOAuth2Response:
      properties:
        access_token:
          type: string
        error:
          type: string
        expires_at:
          type: string
        message:
          type: string
        success:
          type: boolean
        token_type:
          type: string
      type: object
    handlers.Stub:
      type: object
    models.OAuth2:
      properties:
        audience:
          type: string
        authentication_type:
          type: string
        client_id:
          type: string
        client_secret:
          type: string
        expiry_time_unit:
          description: Expiry time unit (seconds, milliseconds, minutes, hours)
          type: string
        field_mapping:
          allOf:
            - $ref: '#/components/schemas/models.OAuth2FieldMapping'
          description: Field mapping for flexible token response parsing
        grant_type:
          type: string
        issuer:
          type: string
        scope:
          type: string
        signing_algorithm:
          type: string
        signing_key:
          $ref: '#/components/schemas/models.OAuth2SigningKey'
        subject:
          type: string
        url:
          type: string
      type: object
    models.OAuth2FieldMapping:
      properties:
        access_token:
          description: >-
            Field name for access token (e.g., "accessToken", "access_token",
            "token")
          type: string
        expires_in:
          description: >-
            Field name for expiry time (e.g., "expiresIn", "expires_in",
            "expiresAt")
          type: string
        token_type:
          description: Field name for token type (e.g., "tokenType", "token_type")
          type: string
      type: object
    models.OAuth2SigningKey:
      properties:
        crv:
          description: EC (Elliptic Curve) key fields
          type: string
        d:
          description: Private key (EC) or private exponent (RSA)
          type: string
        dp:
          description: RSA first factor CRT exponent (RSA private key only)
          type: string
        dq:
          description: RSA second factor CRT exponent (RSA private key only)
          type: string
        e:
          description: RSA public exponent (RSA only)
          type: string
        kid:
          description: Key ID
          type: string
        kty:
          description: 'Key type: "EC" or "RSA"'
          type: string
        'n':
          description: RSA key fields
          type: string
        p:
          description: RSA first prime factor (RSA private key only)
          type: string
        q:
          description: RSA second prime factor (RSA private key only)
          type: string
        qi:
          description: RSA first CRT coefficient (RSA private key only)
          type: string
        x:
          description: X coordinate (EC only)
          type: string
        'y':
          description: Y coordinate (EC only)
          type: string
      type: object
  securitySchemes:
    ApiKeyAuth:
      in: header
      name: Authorization
      type: apiKey

````