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

# Add Organization Domain

> Map an email domain to an organization for automatic membership. After mapping, any account that signs up (or signs in) with an email at this domain is automatically added to the organization. A domain can belong to at most one organization.  This endpoint is idempotent - re-adding the same domain to the same organization returns the existing mapping.



## OpenAPI

````yaml api-reference/openapi/accounts.json POST /api/organizations/domains
openapi: 3.1.0
info:
  title: Recoup API - Accounts
  description: >-
    API documentation for the Recoup platform - an AI agent platform for the
    music industry
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: https://api.recoupable.dev
security: []
paths:
  /api/organizations/domains:
    post:
      description: >-
        Map an email domain to an organization for automatic membership. After
        mapping, any account that signs up (or signs in) with an email at this
        domain is automatically added to the organization. A domain can belong
        to at most one organization.  This endpoint is idempotent - re-adding
        the same domain to the same organization returns the existing mapping.
      requestBody:
        description: Domain-organization mapping parameters
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AddOrganizationDomainRequest'
      responses:
        '200':
          description: Domain mapped to organization successfully (or already mapped)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AddOrganizationDomainResponse'
        '400':
          description: Bad request - invalid or missing parameters
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
        '401':
          description: Unauthorized - missing or invalid authentication
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
        '403':
          description: Forbidden - caller is not a member of the organization
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
        '409':
          description: Conflict - domain is already mapped to a different organization
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
      security:
        - apiKeyAuth: []
        - bearerAuth: []
components:
  schemas:
    AddOrganizationDomainRequest:
      type: object
      required:
        - organizationId
        - domain
      properties:
        organizationId:
          type: string
          format: uuid
          description: The account ID of the organization
        domain:
          type: string
          description: The email domain to map (lowercase, no @)
          example: seekermusic.com
    AddOrganizationDomainResponse:
      type: object
      required:
        - status
        - id
        - domain
        - organization_id
      properties:
        status:
          type: string
          enum:
            - success
          description: Status of the request
        id:
          type: string
          format: uuid
          description: UUID of the domain mapping record
        domain:
          type: string
          description: The mapped email domain
          example: seekermusic.com
        organization_id:
          type: string
          format: uuid
          description: The account ID of the organization
    ErrorEnvelope:
      type: object
      required:
        - status
        - error
      properties:
        status:
          type: string
          enum:
            - error
          description: Status of the request
        error:
          type: string
          description: Error message describing what went wrong
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key
      description: Your Recoup API key. [Learn more](/quickstart#api-keys).
    bearerAuth:
      type: http
      scheme: bearer

````