> ## Documentation Index
> Fetch the complete documentation index at: https://cognitio-agent.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# OAuth authorize

> Initiate OAuth authorization for a specific AI provider to get an authorization URL.



## OpenAPI

````yaml /openapi.json post /provider/{providerID}/oauth/authorize
openapi: 3.1.1
info:
  title: cognitio
  description: cognitio api
  version: 1.0.0
servers: []
security: []
paths:
  /provider/{providerID}/oauth/authorize:
    post:
      summary: OAuth authorize
      description: >-
        Initiate OAuth authorization for a specific AI provider to get an
        authorization URL.
      operationId: provider.oauth.authorize
      parameters:
        - in: query
          name: directory
          schema:
            type: string
        - in: query
          name: workspace
          schema:
            type: string
        - in: path
          name: providerID
          schema:
            type: string
          required: true
          description: Provider ID
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                method:
                  description: Auth method index
                  type: number
                inputs:
                  description: Prompt inputs
                  type: object
                  propertyNames:
                    type: string
                  additionalProperties:
                    type: string
              required:
                - method
      responses:
        '200':
          description: Authorization URL and method
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProviderAuthAuthorization'
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BadRequestError'
      x-codeSamples:
        - lang: js
          source: |-
            import { createCognitioClient } from "@cognitio/sdk

            const client = createCognitioClient()
            await client.provider.oauth.authorize({
              ...
            })
components:
  schemas:
    ProviderAuthAuthorization:
      type: object
      properties:
        url:
          type: string
        method:
          type: string
          enum:
            - auto
            - code
        instructions:
          type: string
      required:
        - url
        - method
        - instructions
    BadRequestError:
      type: object
      properties:
        data: {}
        errors:
          type: array
          items:
            type: object
            propertyNames:
              type: string
            additionalProperties: {}
        success:
          type: boolean
          const: false
      required:
        - data
        - errors
        - success

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.