> ## 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.

# Update Brokerage

> Updates an existing brokerage. Only send fields you want to change.

**Optional update fields:**
- `name` - Update brokerage name
- `commissionPaymentMethod` - Update commission handling method
- `niprBrokerageNumber` - Update NIPR number
- `email` - Update email address
- `addressStructured` - Update address
- `phone` - Update phone number
- `defaultCommissionPercentage` - Update default commission

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




## OpenAPI

````yaml /openapi/generated-external-api.yaml patch /api/external/companies/{companyId}/brokerages/{brokerageId}
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}/brokerages/{brokerageId}:
    patch:
      tags:
        - Brokerages
      summary: Update Brokerage
      description: |
        Updates an existing brokerage. Only send fields you want to change.

        **Optional update fields:**
        - `name` - Update brokerage name
        - `commissionPaymentMethod` - Update commission handling method
        - `niprBrokerageNumber` - Update NIPR number
        - `email` - Update email address
        - `addressStructured` - Update address
        - `phone` - Update phone number
        - `defaultCommissionPercentage` - Update default commission

        **Required permission:** `company.brokerage:create`
      operationId: updateBrokerage
      parameters:
        - $ref: '#/components/parameters/companyId'
        - $ref: '#/components/parameters/brokerageId'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateBrokerageRequest'
            examples:
              updateName:
                summary: Update name only
                value:
                  name: Updated Agency Name
              updateCommission:
                summary: Update commission settings
                value:
                  commissionPaymentMethod: directBill
                  defaultCommissionPercentage: 18
              updateContact:
                summary: Update contact information
                value:
                  email: newemail@agency.com
                  phone: +1-555-999-8888
                  addressStructured:
                    line1: 456 Oak Avenue
                    city: Los Angeles
                    state: CA
                    zip: '90001'
                    country: US
      responses:
        '200':
          description: Brokerage updated successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Brokerage'
              examples:
                success:
                  summary: Updated brokerage
                  value:
                    id: 550e8400-e29b-41d4-a716-446655440001
                    name: Updated Agency Name
                    commissionPaymentMethod: agencyBill
                    niprBrokerageNumber: '12345678'
                    email: contact@acmeagency.com
                    addressStructured:
                      line1: 123 Main Street
                      line2: Suite 100
                      city: New York
                      state: NY
                      zip: '10001'
                      country: US
                    phone: +1-555-123-4567
                    defaultCommissionPercentage: 15
                    createdAt: '2025-01-15T10:30:00.000Z'
                    updatedAt: '2025-01-20T09:00:00.000Z'
        '400':
          description: Bad Request - Validation error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                invalidCommissionMethod:
                  summary: Invalid commission payment method
                  value:
                    error:
                      code: VALIDATION_ERROR
                      message: >-
                        commissionPaymentMethod must be one of: agencyBill,
                        directBill, doNotHandle
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          description: Brokerage not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                brokerageNotFound:
                  summary: Brokerage not found
                  value:
                    error:
                      code: NOT_FOUND
                      message: Brokerage not found
        '500':
          $ref: '#/components/responses/InternalServerError'
components:
  parameters:
    companyId:
      name: companyId
      in: path
      required: true
      schema:
        type: string
        format: uuid
      description: Company identifier
    brokerageId:
      name: brokerageId
      in: path
      required: true
      schema:
        type: string
        format: uuid
      description: Brokerage identifier
  schemas:
    UpdateBrokerageRequest:
      type: object
      properties:
        name:
          type: string
          description: Update brokerage name
        commissionPaymentMethod:
          $ref: '#/components/schemas/CommissionPaymentMethod'
        niprBrokerageNumber:
          type: string
          description: Update NIPR brokerage number
        email:
          type: string
          format: email
          description: Update brokerage email address
        addressStructured:
          $ref: '#/components/schemas/AddressStructured'
        phone:
          type: string
          description: Update phone number
        defaultCommissionPercentage:
          type: number
          description: Update default commission percentage
    Brokerage:
      type: object
      description: A brokerage (insurance agency or broker) in the system
      properties:
        id:
          type: string
          format: uuid
          description: Brokerage identifier
        name:
          type: string
          description: Brokerage name
        commissionPaymentMethod:
          $ref: '#/components/schemas/CommissionPaymentMethod'
        niprBrokerageNumber:
          type: string
          nullable: true
          description: NIPR brokerage number
        email:
          type: string
          format: email
          nullable: true
          description: Brokerage email address
        addressStructured:
          allOf:
            - $ref: '#/components/schemas/AddressStructured'
          nullable: true
          description: Structured address information
        phone:
          type: string
          nullable: true
          description: Phone number
        defaultCommissionPercentage:
          type: number
          nullable: true
          description: Default commission percentage for this brokerage
        createdAt:
          type: string
          format: date-time
          nullable: true
          description: When the brokerage was created (ISO 8601)
        updatedAt:
          type: string
          format: date-time
          nullable: true
          description: When the brokerage was last updated (ISO 8601)
    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
    CommissionPaymentMethod:
      type: string
      description: Method for handling commission payments
      enum:
        - agencyBill
        - directBill
        - doNotHandle
    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.

````