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

# Create an OAuth provider

> Add a new OAuth provider for a user.



## OpenAPI

````yaml /openapi/server.json post /oauth-providers
openapi: 3.1.0
info:
  title: Hexclave REST API
  version: 1.0.0
  description: >-
    The Hexclave REST API. All request headers are documented as canonical
    `X-Hexclave-*`; the equivalent `X-Stack-*` aliases are accepted on every
    endpoint for backwards compatibility. Response headers
    `X-Hexclave-actual-status`, `X-Hexclave-known-error`, and
    `X-Hexclave-request-id` are emitted alongside their legacy `X-Stack-*`
    equivalents.
servers:
  - url: https://api.hexclave.com/api/v1
    description: Hexclave REST API
security: []
paths:
  /oauth-providers:
    post:
      tags:
        - Oauth
      summary: Create an OAuth provider
      description: Add a new OAuth provider for a user.
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                user_id:
                  type: string
                  example: 3241a285-8329-4d69-8f3d-316e08cf140c
                  description: >-
                    The ID of the user, or the special value `me` for the
                    currently authenticated user
                provider_config_id:
                  type: string
                email:
                  type: string
                  example: test@gmail.com
                  description: >-
                    Email of the OAuth provider. This is used to display and
                    identify the OAuth provider in the UI.
                allow_sign_in:
                  type: boolean
                  example: true
                  description: >-
                    Whether the user can use this OAuth provider to sign in.
                    Only one OAuth provider per type can have this set to
                    `true`.
                allow_connected_accounts:
                  type: boolean
                  example: true
                  description: >-
                    Whether the user can use this OAuth provider as connected
                    account. Multiple OAuth providers per type can have this set
                    to `true`.
                account_id:
                  type: string
                  example: google-account-id-12345
                  description: >-
                    Account ID of the OAuth provider. This uniquely identifies
                    the account on the provider side.
              required:
                - user_id
                - provider_config_id
                - allow_sign_in
                - allow_connected_accounts
                - account_id
              example:
                user_id: 3241a285-8329-4d69-8f3d-316e08cf140c
                email: test@gmail.com
                allow_sign_in: true
                allow_connected_accounts: true
                account_id: google-account-id-12345
      responses:
        '201':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  account_id:
                    type: string
                    example: google-account-id-12345
                    description: >-
                      Account ID of the OAuth provider. This uniquely identifies
                      the account on the provider side.
                  user_id:
                    type: string
                    example: 3241a285-8329-4d69-8f3d-316e08cf140c
                    description: >-
                      The ID of the user, or the special value `me` for the
                      currently authenticated user
                  id:
                    type: string
                    example: b3d396b8-c574-4c80-97b3-50031675ceb2
                    description: The unique identifier of the OAuth provider
                  email:
                    type: string
                    example: test@gmail.com
                    description: >-
                      Email of the OAuth provider. This is used to display and
                      identify the OAuth provider in the UI.
                  provider_config_id:
                    type: string
                    example: google
                    description: >-
                      Provider config ID of the OAuth provider. This uniquely
                      identifies the provider config on config.json file
                  type:
                    type: string
                    enum:
                      - google
                      - github
                      - microsoft
                      - spotify
                      - facebook
                      - discord
                      - gitlab
                      - bitbucket
                      - linkedin
                      - apple
                      - x
                      - twitch
                    example: google
                    description: >-
                      OAuth provider type, one of `google`, `github`,
                      `microsoft`, `spotify`, `facebook`, `discord`, `gitlab`,
                      `bitbucket`, `linkedin`, `apple`, `x`, `twitch`
                  allow_sign_in:
                    type: boolean
                    example: true
                    description: >-
                      Whether the user can use this OAuth provider to sign in.
                      Only one OAuth provider per type can have this set to
                      `true`.
                  allow_connected_accounts:
                    type: boolean
                    example: true
                    description: >-
                      Whether the user can use this OAuth provider as connected
                      account. Multiple OAuth providers per type can have this
                      set to `true`.
                required:
                  - account_id
                  - user_id
                  - id
                  - provider_config_id
                  - type
                  - allow_sign_in
                  - allow_connected_accounts

````