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

> Creates a new payee.

**Required fields:**
- `name` - Payee name
- `payeeType` - Type of payee (lawFirm, expert, vendor, other, financingCompany)

**Optional fields:**
- `email` - Primary email address
- `alternateEmails` - Additional email addresses
- `phoneNumber` - Phone number
- `description` - Description of the payee
- `address` - Unstructured address string
- `addressStructured` - Structured address object
- `lawFirmType` - Type of law firm (defense, plaintiff) - only for lawFirm payeeType
- `bankInfo` - Bank account information
- `taxIdNumber` - Tax identification number

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




## OpenAPI

````yaml /openapi/generated-external-api.yaml post /api/external/companies/{companyId}/payees
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}/payees:
    post:
      tags:
        - Payees
      summary: Create Payee
      description: >
        Creates a new payee.


        **Required fields:**

        - `name` - Payee name

        - `payeeType` - Type of payee (lawFirm, expert, vendor, other,
        financingCompany)


        **Optional fields:**

        - `email` - Primary email address

        - `alternateEmails` - Additional email addresses

        - `phoneNumber` - Phone number

        - `description` - Description of the payee

        - `address` - Unstructured address string

        - `addressStructured` - Structured address object

        - `lawFirmType` - Type of law firm (defense, plaintiff) - only for
        lawFirm payeeType

        - `bankInfo` - Bank account information

        - `taxIdNumber` - Tax identification number


        **Required permission:** `company.payee:create`
      operationId: createPayee
      parameters:
        - $ref: '#/components/parameters/companyId'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreatePayeeRequest'
            examples:
              minimal:
                summary: Minimal request (required fields only)
                value:
                  name: Expert Forensics Inc
                  payeeType: expert
              lawFirm:
                summary: Law firm with full details
                value:
                  name: Smith & Associates Law Firm
                  payeeType: lawFirm
                  email: contact@smithlaw.com
                  alternateEmails:
                    - billing@smithlaw.com
                  phoneNumber: +1-555-123-4567
                  description: Defense law firm specializing in insurance litigation
                  address: 123 Legal Plaza, Suite 500, New York, NY 10001
                  addressStructured:
                    streetNumber: '123'
                    streetName: Legal Plaza
                    city: New York
                    state:
                      short: NY
                      long: New York
                    postalCode: '10001'
                    country: US
                  lawFirmType: defense
                  bankInfo:
                    bankAccountNumber: '123456789'
                    bankRoutingNumber: '987654321'
                  taxIdNumber: 12-3456789
              vendor:
                summary: Vendor payee
                value:
                  name: ABC Repair Services
                  payeeType: vendor
                  email: billing@abcrepair.com
                  phoneNumber: +1-555-555-1234
      responses:
        '201':
          description: Payee created successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                    format: uuid
                    description: The ID of the created payee
              examples:
                success:
                  summary: Payee 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: 'name: Required keys were missing'
                      details:
                        - field: name
                          message: Required keys were missing
                invalidPayeeType:
                  summary: Invalid payee type
                  value:
                    error:
                      code: VALIDATION_ERROR
                      message: >-
                        payeeType must be one of: lawFirm, expert, vendor,
                        other, financingCompany
        '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:
    CreatePayeeRequest:
      type: object
      description: Request body for creating a payee
      required:
        - name
        - payeeType
      properties:
        name:
          type: string
          description: Payee name (required)
        payeeType:
          $ref: '#/components/schemas/PayeeType'
        email:
          type: string
          format: email
          description: Primary email address
        alternateEmails:
          type: array
          items:
            type: string
            format: email
          description: Additional email addresses
        phoneNumber:
          type: string
          description: Phone number
        description:
          type: string
          description: Description of the payee
        address:
          type: string
          description: Unstructured address string
        addressStructured:
          $ref: '#/components/schemas/PayeeAddressStructured'
        lawFirmType:
          $ref: '#/components/schemas/LawFirmType'
        bankInfo:
          $ref: '#/components/schemas/BankInfo'
        taxIdNumber:
          type: string
          description: Tax identification number
    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
    PayeeType:
      type: string
      description: Type of payee
      enum:
        - lawFirm
        - expert
        - vendor
        - other
        - financingCompany
    PayeeAddressStructured:
      type: object
      description: Structured address with parsed components (payee-specific format)
      properties:
        city:
          type: string
          nullable: true
          description: City name
        country:
          type: string
          nullable: true
          description: Country name or code
        county:
          type: string
          nullable: true
          description: County name
        location:
          type: object
          nullable: true
          description: Geographic coordinates
          properties:
            lat:
              type: number
              description: Latitude
            lng:
              type: number
              description: Longitude
        name:
          type: string
          nullable: true
          description: Address name or label
        neighborhood:
          type: string
          nullable: true
          description: Neighborhood name
        postalCode:
          type: string
          nullable: true
          description: Postal/ZIP code
        state:
          type: object
          nullable: true
          description: State information
          properties:
            short:
              type: string
              description: State abbreviation (e.g., "CA")
            long:
              type: string
              description: Full state name (e.g., "California")
        streetName:
          type: string
          nullable: true
          description: Street name
        streetNumber:
          type: string
          nullable: true
          description: Street number
        sublocality:
          type: string
          nullable: true
          description: Sublocality or district
        timezone:
          type: string
          nullable: true
          description: Timezone identifier
    LawFirmType:
      type: string
      description: Type of law firm (only applicable when payeeType is lawFirm)
      enum:
        - defense
        - plaintiff
    BankInfo:
      type: object
      description: Bank account information for payments
      properties:
        bankAccountNumber:
          oneOf:
            - type: string
            - type: number
          description: Bank account number
        bankRoutingNumber:
          oneOf:
            - type: string
            - type: number
          description: Bank routing number
  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.

````