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

# Create Tenant

> Create a new tenant (organization/customer) - Usually auto-created during signup.

**⚠️ NOTE: For most users, tenants are AUTO-CREATED during signup!**

**When to use this endpoint:**
- **Platform Admins**: Manually create organizations for customers
- **Recovery**: If auto-creation failed during signup
- **Migration**: Importing existing organizations into the platform
- **Advanced**: Creating additional sub-organizations

**For Regular Users (BUSINESS role):**
- Your tenant is **automatically created** when you sign up via `POST /auth/signup`
- You don't need to call this endpoint
- Your tenant_id = your owner_id (automatically linked)

**What it does:**
- Creates a new tenant account with unique ID (uses current_user.owner_id)
- Sets up billing plan and usage limits
- Configures SIP capabilities (if enabled)
- Establishes compliance settings (HIPAA, PCI)
- Encrypts sensitive credentials (SIP passwords)

**Key Configuration:**
- `name`: Organization name
- `billing_plan`: Subscription tier (starter/business/enterprise)
- `max_concurrent_calls`: Call capacity limit (1-1000)
- `monthly_call_limit`: Monthly usage cap
- `sip_enabled`: Enable phone number integration
- `recording_enabled`: Call recording capability
- `analytics_enabled`: Analytics dashboard access

**User Flow Clarification:**
1. **Sign up** → `POST /auth/signup` (role=BUSINESS) → Tenant auto-created ✅
2. **Login** → `POST /auth/token` → Get access token
3. **Create agents** → `POST /agents` → Start building

❌ You do NOT need to manually create tenant after signup!



## OpenAPI

````yaml https://api.mrassistant.ai/openapi.json post /tenants
openapi: 3.1.0
info:
  title: Backend - Multilingual Voice Agent System
  description: FastAPI backend for multilingual voice agents with tool use
  version: 1.0.0
servers: []
security: []
paths:
  /tenants:
    post:
      tags:
        - tenants
      summary: Create Tenant
      description: >-
        Create a new tenant (organization/customer) - Usually auto-created
        during signup.


        **⚠️ NOTE: For most users, tenants are AUTO-CREATED during signup!**


        **When to use this endpoint:**

        - **Platform Admins**: Manually create organizations for customers

        - **Recovery**: If auto-creation failed during signup

        - **Migration**: Importing existing organizations into the platform

        - **Advanced**: Creating additional sub-organizations


        **For Regular Users (BUSINESS role):**

        - Your tenant is **automatically created** when you sign up via `POST
        /auth/signup`

        - You don't need to call this endpoint

        - Your tenant_id = your owner_id (automatically linked)


        **What it does:**

        - Creates a new tenant account with unique ID (uses
        current_user.owner_id)

        - Sets up billing plan and usage limits

        - Configures SIP capabilities (if enabled)

        - Establishes compliance settings (HIPAA, PCI)

        - Encrypts sensitive credentials (SIP passwords)


        **Key Configuration:**

        - `name`: Organization name

        - `billing_plan`: Subscription tier (starter/business/enterprise)

        - `max_concurrent_calls`: Call capacity limit (1-1000)

        - `monthly_call_limit`: Monthly usage cap

        - `sip_enabled`: Enable phone number integration

        - `recording_enabled`: Call recording capability

        - `analytics_enabled`: Analytics dashboard access


        **User Flow Clarification:**

        1. **Sign up** → `POST /auth/signup` (role=BUSINESS) → Tenant
        auto-created ✅

        2. **Login** → `POST /auth/token` → Get access token

        3. **Create agents** → `POST /agents` → Start building


        ❌ You do NOT need to manually create tenant after signup!
      operationId: create_tenant_tenants_post
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TenantCreate'
      responses:
        '201':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Tenant'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - HTTPBearer: []
components:
  schemas:
    TenantCreate:
      properties:
        name:
          type: string
          maxLength: 255
          minLength: 1
          title: Name
        billing_plan:
          type: string
          maxLength: 100
          minLength: 1
          title: Billing Plan
        sip_enabled:
          type: boolean
          title: Sip Enabled
          default: false
        recording_enabled:
          type: boolean
          title: Recording Enabled
          default: true
        analytics_enabled:
          type: boolean
          title: Analytics Enabled
          default: true
        max_concurrent_calls:
          type: integer
          maximum: 1000
          minimum: 1
          title: Max Concurrent Calls
          default: 10
        monthly_call_limit:
          type: integer
          minimum: 0
          title: Monthly Call Limit
          default: 1000
        sip_domain:
          anyOf:
            - type: string
            - type: 'null'
          title: Sip Domain
        sip_username:
          anyOf:
            - type: string
            - type: 'null'
          title: Sip Username
        sip_password:
          anyOf:
            - type: string
            - type: 'null'
          title: Sip Password
      type: object
      required:
        - name
        - billing_plan
      title: TenantCreate
      description: Tenant creation model.
    Tenant:
      properties:
        name:
          type: string
          maxLength: 255
          minLength: 1
          title: Name
        billing_plan:
          type: string
          maxLength: 100
          minLength: 1
          title: Billing Plan
        sip_enabled:
          type: boolean
          title: Sip Enabled
          default: false
        recording_enabled:
          type: boolean
          title: Recording Enabled
          default: true
        analytics_enabled:
          type: boolean
          title: Analytics Enabled
          default: true
        max_concurrent_calls:
          type: integer
          maximum: 1000
          minimum: 1
          title: Max Concurrent Calls
          default: 10
        monthly_call_limit:
          type: integer
          minimum: 0
          title: Monthly Call Limit
          default: 1000
        id:
          type: string
          format: uuid
          title: Id
        status:
          type: string
          title: Status
        monthly_usage_cents:
          type: integer
          title: Monthly Usage Cents
        meta_data:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Meta Data
        sip_domain:
          anyOf:
            - type: string
            - type: 'null'
          title: Sip Domain
        sip_username:
          anyOf:
            - type: string
            - type: 'null'
          title: Sip Username
        hipaa_enabled:
          type: boolean
          title: Hipaa Enabled
          default: false
        pci_enabled:
          type: boolean
          title: Pci Enabled
          default: false
        recording_format:
          type: string
          title: Recording Format
          default: mp4
        retention_days:
          type: integer
          title: Retention Days
          default: 90
        data_encryption_enabled:
          type: boolean
          title: Data Encryption Enabled
          default: true
        webhook_url:
          anyOf:
            - type: string
            - type: 'null'
          title: Webhook Url
        webhook_timeout_seconds:
          type: integer
          title: Webhook Timeout Seconds
          default: 20
        created_at:
          type: string
          format: date-time
          title: Created At
        updated_at:
          type: string
          format: date-time
          title: Updated At
      type: object
      required:
        - name
        - billing_plan
        - id
        - status
        - monthly_usage_cents
        - created_at
        - updated_at
      title: Tenant
      description: Tenant response model.
    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:
    HTTPBearer:
      type: http
      scheme: bearer

````