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

# Authorize

> Start the OAuth authorization flow by redirecting users to the authorization endpoint. Users will grant permission to your application and be redirected back with an authorization code.

## Authorize

Start the OAuth authorization flow by redirecting users to the authorization endpoint. Users will grant permission to your application and be redirected back with an authorization code.

<ParamField body="query" path="client_id" type="string" required>
  Your OAuth client ID obtained from the dashboard
</ParamField>

<ParamField body="query" path="redirect_uri" type="string" required>
  The redirect URI registered with your OAuth client. Must exactly match the registered URI.
</ParamField>

<ParamField body="query" path="response_type" type="string" required>
  Must be set to `code` for authorization code flow
</ParamField>

<ParamField body="query" path="scope" type="string" required>
  The scope of access requested. Use `*` for full access.
</ParamField>

<CodeGroup>
  ```bash cURL theme={null}
  curl --location --globoff 'https://app.aisync.link/oauth/authorize?client_id={{client_id}}&redirect_uri={{redirect_uri}}&response_type=code&scope=*'
  ```
</CodeGroup>

After the user authorizes your application, they will be redirected to your `redirect_uri` with an authorization code:

```
{{redirect_uri}}?code={{authorization_code}}
```

<Note>
  The authorization code is single-use and expires quickly. Exchange it for an access token immediately.
</Note>


## OpenAPI

````yaml GET /oauth/authorize
openapi: 3.1.0
info:
  title: AI Sync OAuth API
  description: OAuth 2.0 API for authenticating and authorizing third-party applications
  version: 1.0.0
servers:
  - url: https://app.aisync.link
    description: Production server
security: []
paths:
  /oauth/authorize:
    get:
      tags:
        - OAuth
      summary: Authorize
      description: >-
        Start the OAuth authorization flow by redirecting users to the
        authorization endpoint. Users will grant permission to your application
        and be redirected back with an authorization code.
      operationId: authorize
      parameters:
        - name: client_id
          in: query
          description: Your OAuth client ID obtained from the dashboard
          required: true
          schema:
            type: string
        - name: redirect_uri
          in: query
          description: >-
            The redirect URI registered with your OAuth client. Must exactly
            match the registered URI.
          required: true
          schema:
            type: string
            format: uri
        - name: response_type
          in: query
          description: Must be set to 'code' for authorization code flow
          required: true
          schema:
            type: string
            enum:
              - code
            default: code
        - name: scope
          in: query
          description: The scope of access requested. Use '*' for full access.
          required: true
          schema:
            type: string
            default: '*'
      responses:
        '302':
          description: Redirect to redirect_uri with authorization code
          headers:
            Location:
              description: Redirect URI with code parameter
              schema:
                type: string
        '400':
          description: Invalid request parameters
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    Error:
      type: object
      properties:
        error:
          type: string
          description: Error code
        error_description:
          type: string
          description: Human-readable error description
        message:
          type: string
          description: Error message
      required:
        - error

````