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

> Creates a lawsuit for an event. Each event can have at most one lawsuit.
Returns 409 Conflict if a lawsuit already exists for the event.

**Required permission:** `company.event:export`




## OpenAPI

````yaml /openapi/generated-external-api.yaml post /api/external/companies/{companyId}/events/{eventId}/lawsuit
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}/events/{eventId}/lawsuit:
    post:
      tags:
        - Lawsuits
      summary: Create Lawsuit
      description: |
        Creates a lawsuit for an event. Each event can have at most one lawsuit.
        Returns 409 Conflict if a lawsuit already exists for the event.

        **Required permission:** `company.event:export`
      operationId: createLawsuit
      parameters:
        - $ref: '#/components/parameters/companyId'
        - $ref: '#/components/parameters/eventId'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateLawsuitRequest'
            examples:
              minimal:
                summary: Create with no fields
                value: {}
              withFields:
                summary: Create with case details
                value:
                  caseNumber: CASE-2026-001
                  caseName: Smith v. Jones Insurance Co.
                  lawsuitFiledDate: '2026-01-10T00:00:00.000Z'
                  venueName: District Court of Springfield
                  judgeName: Hon. Sarah Williams
      responses:
        '201':
          description: Lawsuit created
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                    format: uuid
                    description: The created lawsuit identifier
              examples:
                success:
                  summary: Lawsuit created
                  value:
                    id: 550e8400-e29b-41d4-a716-446655440001
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '409':
          description: Conflict - A lawsuit already exists for this event
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                conflict:
                  summary: Lawsuit already exists
                  value:
                    error:
                      code: Conflict
                      message: A lawsuit already exists for this event
        '500':
          $ref: '#/components/responses/InternalServerError'
components:
  parameters:
    companyId:
      name: companyId
      in: path
      required: true
      schema:
        type: string
        format: uuid
      description: Company identifier
    eventId:
      name: eventId
      in: path
      required: true
      schema:
        type: string
        format: uuid
      description: Event identifier
  schemas:
    CreateLawsuitRequest:
      type: object
      properties:
        caseNumber:
          type: string
          description: Court case number
        caseName:
          type: string
          description: Name of the case
        lawsuitFiledDate:
          type: string
          format: date-time
          description: Date lawsuit was filed (ISO 8601)
        suitServedDate:
          type: string
          format: date-time
          description: Date suit was served (ISO 8601)
        trialDate:
          type: string
          format: date-time
          description: Scheduled trial date (ISO 8601)
        venueName:
          type: string
          description: Name of the court venue
        venueAddress:
          $ref: '#/components/schemas/LawsuitAddress'
          description: Address of the court venue
        judgeName:
          type: string
          description: Name of the presiding judge
        plaintiffs:
          type: array
          items:
            type: string
          description: List of plaintiff names
        plaintiffAttorneyId:
          type: string
          format: uuid
          description: >-
            Attorney representing the plaintiff (must reference an existing
            attorney)
        plaintiffLawFirmId:
          type: string
          format: uuid
          description: >-
            Law firm representing the plaintiff (must reference an existing
            payee)
        plaintiffAddress:
          $ref: '#/components/schemas/LawsuitAddress'
          description: Address of the plaintiff
        settlementDemand:
          type: string
          description: Settlement demand amount
        settlementType:
          type: string
          description: >-
            Settlement type code (S=Settlement, N=No Settlement, L=Litigated,
            C=Closed)
        arbitrationInvolved:
          type: string
          description: Whether arbitration is involved (Yes/No)
        dateDefenseCounselAdded:
          type: string
          format: date-time
          description: Date defense counsel was added (ISO 8601)
        expertDefense:
          type: string
          description: Defense expert information
        expertPlaintiff:
          type: string
          description: Plaintiff expert information
        declaratoryJudgementFiledDate:
          type: string
          format: date-time
          description: Date declaratory judgement was filed (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
    LawsuitAddress:
      type: object
      description: Address with display value and optional structured components
      properties:
        value:
          type: string
          description: Display string for the address
        structuredValue:
          type: object
          description: Parsed address components
          properties:
            streetNumber:
              type: string
            streetName:
              type: string
            city:
              type: string
            county:
              type: string
            state:
              type: object
              properties:
                short:
                  type: string
                long:
                  type: string
            country:
              type: string
            postalCode:
              type: string
            name:
              type: string
            neighborhood:
              type: string
            sublocality:
              type: string
            location:
              type: object
              properties:
                lat:
                  type: number
                lng:
                  type: number
            timezone:
              type: string
      required:
        - value
  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.

````