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

# Begin connecting a mailbox via the hosted-auth flow



## OpenAPI

````yaml /api-reference/openapi.json post /v1/email/accounts/connect
openapi: 3.1.0
info:
  title: Feather API
  description: >-
    Unified customer experience platform API. Manages identity, conversations,
    memory, agents, procedures, policies, model routing, knowledge bases,
    integrations, and runtime execution.
  version: 1.21.0
servers:
  - url: https://api-sandbox.featherhq.com
    description: Sandbox
  - url: http://localhost:8000
    description: Local dev
security: []
paths:
  /v1/email/accounts/connect:
    post:
      tags:
        - email
      summary: Begin connecting a mailbox via the hosted-auth flow
      operationId: connectEmailMailbox
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ConnectMailboxRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ConnectMailboxResponse'
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Authentication required
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - APIKeyHeader: []
components:
  schemas:
    ConnectMailboxRequest:
      properties:
        agent_id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Agent Id
        agent_revision_id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Agent Revision Id
        team_id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Team Id
        team_revision_id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Team Revision Id
        login_hint:
          anyOf:
            - type: string
              maxLength: 320
            - type: 'null'
          title: Login Hint
      additionalProperties: false
      type: object
      title: ConnectMailboxRequest
      description: >-
        Initiate a mailbox-connect flow.


        ``agent_id`` / ``team_id`` are captured in the OAuth state so the

        callback can bind the grant atomically. Both optional — callers can

        bind later via the binding endpoint — but at most one may be set on a

        single request (a mailbox binds to either a single agent or a team).


        Revision pins (``agent_revision_id`` / ``team_revision_id``) are
        OPTIONAL:

        omitting one pins the target's current active revision at bind
        (pin-at-bind),

        a non-null value pins that exact revision. Each may only be set
        alongside

        its own agent/team id.
    ConnectMailboxResponse:
      properties:
        authorize_url:
          type: string
          title: Authorize Url
        state:
          type: string
          title: State
      additionalProperties: false
      type: object
      required:
        - authorize_url
        - state
      title: ConnectMailboxResponse
      description: Returns the URL the frontend should redirect / popup the user to.
    ErrorResponse:
      properties:
        error:
          type: string
          title: Error
        message:
          type: string
          title: Message
      type: object
      required:
        - error
        - message
      title: ErrorResponse
      description: Standard error response returned by all API error handlers.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    APIKeyHeader:
      type: apiKey
      in: header
      name: x-api-key

````