> ## Documentation Index
> Fetch the complete documentation index at: https://langchain-5e9cc07a-preview-fjmorr-1782499519-e1e0dbe.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Discover and register an OAuth provider

> Auto-discovers an OAuth provider's metadata from an MCP server URL and registers it for your organization. Idempotent: the same provider_slug and mcp_server_url returns the existing provider (200). Reusing a provider_slug with a different mcp_server_url returns 400.



## OpenAPI

````yaml /langsmith/headless-fleet-openapi.json post /v1/fleet/auth-providers/discover
openapi: 3.0.0
info:
  contact: {}
  description: >
    The Fleet API is a headless interface for building and running agents —
    create and configure agents, manage their connections and secrets, run
    threads, and wire up triggers.


    Paths are service-native (e.g. `/v1/fleet/agents`). Self-hosted deployments
    reach them through the gateway under an `/api` prefix (e.g.
    `/api/v1/fleet/agents`).


    ## Authentication


    Every request must carry **one** credential:


    | Scheme | Header | Value |

    | --- | --- | --- |

    | API key | `X-Api-Key` | A LangSmith API key (`lsv2_…`). |

    | Session token | `Authorization` | `Bearer <session JWT>`. |


    Workspace-scoped endpoints additionally require **`X-Tenant-Id`**, set to
    the workspace (tenant) UUID the request operates in. Organization- and
    identity-scoped endpoints omit it.


    ## Errors


    Errors follow [RFC 7807](https://www.rfc-editor.org/rfc/rfc7807) (Problem
    Details) and use one JSON shape across every endpoint:


    ```json

    {
      "type": "about:blank",
      "code": "agent_not_found",
      "detail": "No agent exists with that ID.",
      "status": 404
    }

    ```


    - `type` — URI identifying the error type. Currently always `about:blank`
    (the RFC 7807 default); branch on `code`, not `type`.

    - `code` — stable, machine-readable identifier. Branch on this rather than
    matching `detail`.

    - `detail` — human-readable explanation. Proxied endpoints also echo it as
    `message`.

    - `status` — mirrors the HTTP status code.


    | Status | Meaning |

    | --- | --- |

    | `400` | Malformed request or failed validation. |

    | `401` | Missing or invalid credentials. |

    | `403` | Authenticated, but not permitted to access this resource. |

    | `404` | The resource does not exist or is not visible to your workspace. |

    | `409` | Conflicts with current state (e.g. a duplicate). |

    | `422` | Well-formed but semantically invalid. |

    | `500` | Unexpected server error. |

    | `502` / `503` | An upstream dependency failed or was unavailable. Retries
    are usually safe. |


    ## Pagination


    List endpoints return a fixed-size page and an opaque cursor:


    ```json

    { "items": [ ], "next_cursor": "eyJ…" }

    ```


    - `page_size` — items per page, `1`–`100` (default `20`).

    - `cursor` — pass the previous response's `next_cursor` to fetch the next
    page. An absent or empty `next_cursor` means there are no more results.


    Cursors are opaque — don't construct or parse them.
  title: Fleet API
  version: v1
servers:
  - url: /
security: []
tags:
  - name: agents
  - name: agent connections
  - name: threads
  - name: skills
  - name: auth
  - name: integrations
  - name: secrets
  - name: models
  - name: tenants
  - name: users
paths:
  /v1/fleet/auth-providers/discover:
    post:
      tags:
        - auth
      summary: Discover and register an OAuth provider
      description: >-
        Auto-discovers an OAuth provider's metadata from an MCP server URL and
        registers it for your organization. Idempotent: the same provider_slug
        and mcp_server_url returns the existing provider (200). Reusing a
        provider_slug with a different mcp_server_url returns 400.
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/auth.DiscoverProviderRequest'
        description: MCP server discovery details
        required: true
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/auth.ProviderResponse'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/auth.errorResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/auth.errorResponse'
        '502':
          description: Bad Gateway
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/auth.errorResponse'
      security:
        - API_Key: []
        - Tenant_ID: []
        - Bearer_Auth: []
components:
  schemas:
    auth.DiscoverProviderRequest:
      type: object
      properties:
        allowed_redirect_uris:
          description: >-
            Custom callback URLs registered with the MCP authorization server
            via dynamic

            client registration so headless flows can redirect to them. The full
            set is

            registered when the provider is created and cannot be changed
            afterward — DCR

            has no update path, so re-creating the provider is required to
            change them.

            Omit the field or send an empty list when no custom callbacks are
            needed.
          type: array
          items:
            type: string
          example:
            - https://myapp.com/oauth/callback
        mcp_server_url:
          type: string
          example: https://tools.langchain.com/mcp/slack
        name:
          type: string
        provider_slug:
          type: string
    auth.ProviderResponse:
      type: object
      properties:
        allowed_redirect_uris:
          description: Callback URLs permitted as redirect_uri in headless auth sessions.
          type: array
          items:
            type: string
        auth_url:
          type: string
          example: https://github.com/login/oauth/authorize
        authorization_params:
          description: Extra static query parameters appended to the authorization URL.
          type: object
          additionalProperties:
            type: string
        client_id:
          type: string
          example: Iv1.0a1b2c3d4e5f6a7b
        code_challenge_method:
          description: PKCE challenge method; null when PKCE is unused.
          type: string
          example: S256
        created_at:
          type: string
          example: '2026-01-15T09:30:00Z'
        id:
          type: string
          example: 1a2b3c4d-5e6f-7081-92a3-b4c5d6e7f809
        is_dynamic_client:
          description: True when registered via OAuth dynamic client registration.
          type: boolean
          example: false
        mcp_server_url:
          description: Set when the provider was discovered from an MCP server.
          type: string
        name:
          type: string
          example: GitHub
        organization_id:
          type: string
          example: 7f8e9d0c-1b2a-3948-5766-8594a3b2c1d0
        provider_slug:
          type: string
          example: github-oauth-provider
        provider_type:
          description: Provider family, e.g. oauth2 or mcp.
          type: string
          example: oauth2
        token_endpoint_auth_method:
          type: string
          example: client_secret_post
        token_url:
          type: string
          example: https://github.com/login/oauth/access_token
        updated_at:
          type: string
          example: '2026-01-15T09:30:00Z'
        uses_pkce:
          description: Whether the provider uses PKCE in the authorization-code flow.
          type: boolean
          example: true
    auth.errorResponse:
      type: object
      properties:
        code:
          type: string
        detail:
          type: string
        status:
          type: integer
        type:
          type: string
  securitySchemes:
    API_Key:
      description: LangSmith API key (`lsv2_...`).
      type: apiKey
      name: X-Api-Key
      in: header
    Tenant_ID:
      description: Workspace (tenant) UUID the request operates in.
      type: apiKey
      name: X-Tenant-Id
      in: header
    Bearer_Auth:
      description: Session JWT, sent as `Bearer <token>`.
      type: apiKey
      name: Authorization
      in: header

````