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

# Create Broker

> Creates a new broker associated with an existing brokerage.

**Required fields:**
- `brokerageId` - ID of an existing brokerage (use GET /brokerages to find valid IDs)
- `name` - Broker name

**Optional fields:**
- `email` - Broker email address
- `defaultCommissionPercentage` - Default commission percentage (0-100)
- `addressStructured` - Structured address object
- `phone` - Primary phone number
- `workPhone` - Work phone number
- `producerNumber` - Producer number/identifier

**Required permission:** `company.broker:create`




## OpenAPI

````yaml /openapi/generated-external-api.yaml post /api/external/companies/{companyId}/brokers
openapi: 3.0.3
info:
  title: AI Insurance External API
  description: External API for AI Insurance platform
  version: 1.0.0
  contact:
    email: support@aiinsurance.io
servers:
  - url: https://app.aiinsurance.io
    description: Production
security:
  - ApiKeyAuth: []
paths:
  /api/external/companies/{companyId}/brokers:
    post:
      tags:
        - Brokers
      summary: Create Broker
      description: >
        Creates a new broker associated with an existing brokerage.


        **Required fields:**

        - `brokerageId` - ID of an existing brokerage (use GET /brokerages to
        find valid IDs)

        - `name` - Broker name


        **Optional fields:**

        - `email` - Broker email address

        - `defaultCommissionPercentage` - Default commission percentage (0-100)

        - `addressStructured` - Structured address object

        - `phone` - Primary phone number

        - `workPhone` - Work phone number

        - `producerNumber` - Producer number/identifier


        **Required permission:** `company.broker:create`
      operationId: createBroker
      parameters:
        - $ref: '#/components/parameters/companyId'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateBrokerRequest'
            examples:
              minimal:
                summary: Minimal request (required fields only)
                value:
                  brokerageId: 770e8400-e29b-41d4-a716-446655440000
                  name: John Smith
              complete:
                summary: Complete request with all fields
                value:
                  brokerageId: 770e8400-e29b-41d4-a716-446655440000
                  name: John Smith
                  email: john.smith@acmeagency.com
                  defaultCommissionPercentage: 15
                  addressStructured:
                    line1: 123 Main Street
                    line2: Suite 100
                    city: New York
                    state: NY
                    zip: '10001'
                    country: US
                  phone: +1-555-123-4567
                  workPhone: +1-555-123-4568
                  producerNumber: PRD-12345
      responses:
        '201':
          description: Broker created successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                    format: uuid
                    description: The ID of the created broker
              examples:
                success:
                  summary: Broker created
                  value:
                    id: 550e8400-e29b-41d4-a716-446655440003
        '400':
          description: Bad Request - Validation error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                missingRequiredField:
                  summary: Missing required field
                  value:
                    error:
                      code: KeyMissing
                      message: 'brokerageId: Required keys were missing'
                      details:
                        - field: brokerageId
                          message: Required keys were missing
                invalidCommissionPercentage:
                  summary: Invalid commission percentage
                  value:
                    error:
                      code: InvalidCommissionPercentage
                      message: defaultCommissionPercentage must be between 0 and 100
                brokerageNotFound:
                  summary: Brokerage not found
                  value:
                    error:
                      code: NOT_FOUND
                      message: >-
                        The specified brokerage was not found. Please verify the
                        brokerageId and try again.
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '500':
          $ref: '#/components/responses/InternalServerError'
components:
  parameters:
    companyId:
      name: companyId
      in: path
      required: true
      schema:
        type: string
        format: uuid
      description: Company identifier
  schemas:
    CreateBrokerRequest:
      type: object
      required:
        - brokerageId
        - name
      properties:
        brokerageId:
          type: string
          format: uuid
          description: >-
            ID of an existing brokerage this broker belongs to. Use GET
            /brokerages to find valid IDs, or POST /brokerages to create one
            first.
        name:
          type: string
          description: Broker name (required)
        email:
          type: string
          format: email
          description: Broker email address
        defaultCommissionPercentage:
          type: number
          minimum: 0
          maximum: 100
          description: Default commission percentage (0-100)
        addressStructured:
          $ref: '#/components/schemas/AddressStructured'
        phone:
          type: string
          description: Primary phone number
        workPhone:
          type: string
          description: Work phone number
        producerNumber:
          type: string
          description: Producer number/identifier
    ErrorResponse:
      type: object
      description: Standard error response for all external API endpoints
      required:
        - error
      properties:
        error:
          type: object
          required:
            - code
            - message
          properties:
            code:
              type: string
              description: Machine-readable error code
              example: VALIDATION_ERROR
            message:
              type: string
              description: Human-readable error message
              example: 'submissionId: Required field is missing'
            details:
              type: array
              description: Additional details for validation errors (field-level errors)
              items:
                type: object
                properties:
                  field:
                    type: string
                    description: The field that caused the error
                    example: submissionId
                  message:
                    type: string
                    description: Description of the field error
                    example: Required field is missing
    AddressStructured:
      type: object
      description: Structured address information
      properties:
        line1:
          type: string
          description: Street address line 1
        line2:
          type: string
          description: Street address line 2 (optional)
        city:
          type: string
          description: City
        state:
          type: string
          description: State or province
        zip:
          type: string
          description: ZIP or postal code
        country:
          type: string
          description: Country code
  responses:
    Unauthorized:
      description: Unauthorized - Invalid or missing API key
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            missingApiKey:
              summary: Missing API key
              value:
                error:
                  code: UNAUTHORIZED
                  message: Authorization header is required
            bearerTokenNotAllowed:
              summary: Bearer token used instead of API key
              value:
                error:
                  code: UNAUTHORIZED
                  message: External API endpoints require API key authentication
    Forbidden:
      description: Forbidden - Insufficient permissions
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            insufficientPermissions:
              summary: Insufficient permissions
              value:
                error:
                  code: FORBIDDEN
                  message: Insufficient permissions to perform this action
    InternalServerError:
      description: Internal Server Error - Unexpected error occurred
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            internalError:
              summary: Unexpected server error
              value:
                error:
                  code: INTERNAL_ERROR
                  message: An unexpected error occurred. Please try again later.
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: Authorization
      description: >-
        API key authentication. Include your API key in the Authorization
        header.

````