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

# Add a Compliance Configuration

> Create a configuration covering the states you name

Creates a compliance configuration for one of your entities, covering the states you name, and returns it with each state's rule resolved down to licence classes and lines of authority.

## You name states, not requirement ids

Send a `lineOfBusiness` and a list of `stateCodes`. Together those select the Turris default compliance requirement for each state, so you never handle a requirement id.

```json theme={null}
{
  "name": "P&C",
  "description": "Minimum authority for personal lines.",
  "lineOfBusiness": "P&C Personal",
  "stateCodes": ["PA", "NJ"]
}
```

`lineOfBusiness` is required, and its allowed values are published in the schema below. It is what makes the requirement lookup unambiguous: a state can have one default per line of business, so without it there would be nothing to choose between them.

## What can go wrong

| Response | When                                                                                                                                                                 |
| -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **400**  | A state appears more than once. A configuration holds at most one rule per state.                                                                                    |
| **404**  | A state has no Turris default for the line of business you chose. Nothing is created — the whole request fails rather than covering fewer states than you asked for. |
| **409**  | A configuration with this name already exists on that entity. Names are unique per entity.                                                                           |

<Note>
  **Authoring your own compliance rules is not part of this endpoint.** It attaches the Turris defaults. A rule built specifically for your agency is created in the Turris agency application, and [List Compliance Configurations](/api-reference/v2/downstream/compliance-configs/list-compliance-configs) marks those with `isTurrisDefault: false`.
</Note>

Send an `Idempotency-Key` header. See [Idempotency](/guides/idempotency).


## OpenAPI

````yaml openapi/v2.json POST /v2/downstream/compliance-configs
openapi: 3.0.0
info:
  title: Turris Public API
  description: API for managing insurance compliance data
  version: 2.0.0
  contact: {}
servers:
  - url: https://public.api.live.turrisfi.com
    description: Production
  - url: https://public.api.sandbox.turrisfi.com
    description: Sandbox
security: []
tags: []
paths:
  /v2/downstream/compliance-configs:
    post:
      tags:
        - downstream/compliance-configs
      summary: Add a licence compliance configuration
      description: >-
        Creates a configuration covering the states you name, attaching the
        Turris default compliance requirement for each one, and returns it with
        those requirements resolved. The line of business plus each state code
        selects the requirement, so you never need a requirement id. A state
        with no default for that line of business returns 404 and nothing is
        created; a state listed twice returns 400. Authoring your own compliance
        rules is not part of this endpoint. Names are unique per entity.
      operationId: ComplianceConfigsController_addComplianceConfig_v2
      parameters:
        - name: idempotency-key
          in: header
          description: UUID to ensure idempotent request processing
          required: false
          schema:
            type: string
            example: 550e8400-e29b-41d4-a716-446655440000
        - name: x-idempotency-key
          in: header
          description: Alternative UUID header for idempotent request processing
          required: false
          schema:
            type: string
            example: 550e8400-e29b-41d4-a716-446655440000
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AddComplianceConfigDto'
      responses:
        '201':
          description: The configuration created
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    $ref: '#/components/schemas/DownstreamComplianceConfigResponse'
                  requestId:
                    type: string
                    description: Unique request identifier
                    example: dev-2c5e7cf2-9acf-4c8c-ab2f-b81f39d775a8
                  timestamp:
                    type: string
                    description: Response timestamp
                    example: '2025-11-12T20:49:03.293Z'
                required:
                  - data
                  - requestId
                  - timestamp
        '400':
          description: Invalid request body, or a state listed more than once
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDto'
        '401':
          description: Invalid or missing auth token
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDto'
        '403':
          description: Your organization is not entitled to the public API
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDto'
        '404':
          description: >-
            downstreamEntityId is not in your organization, or one of the states
            has no Turris default requirement for the chosen line of business
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDto'
        '409':
          description: A configuration with this name already exists
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDto'
components:
  schemas:
    AddComplianceConfigDto:
      type: object
      properties:
        name:
          type: string
          description: Configuration name. Must be unique within the entity that owns it.
          example: P&C
        description:
          type: string
          description: Free-text description
          example: Minimum authority for personal lines.
        lineOfBusiness:
          type: string
          description: >-
            The line of business this configuration governs. Together with each
            state code it selects the Turris default compliance requirement to
            attach.
          enum:
            - P&C Commercial
            - P&C Personal
            - Surplus Lines
            - Life & Health
          example: P&C Personal
        stateCodes:
          type: array
          description: >-
            The states this configuration covers. Each one attaches the Turris
            default requirement for that state and line of business. A state
            with no default for the chosen line of business returns 404, and a
            state listed twice returns 400.
          example:
            - PA
          items:
            type: string
            enum:
              - AL
              - AK
              - AZ
              - AR
              - CA
              - CO
              - CT
              - DE
              - FL
              - GA
              - HI
              - ID
              - IL
              - IN
              - IA
              - KS
              - KY
              - LA
              - ME
              - MD
              - MA
              - MI
              - MN
              - MS
              - MO
              - MT
              - NE
              - NV
              - NH
              - NJ
              - NM
              - NY
              - NC
              - ND
              - OH
              - OK
              - OR
              - PA
              - RI
              - SC
              - SD
              - TN
              - TX
              - UT
              - VT
              - VA
              - WA
              - WV
              - WI
              - WY
              - GU
              - PR
              - VI
              - DC
        downstreamEntityId:
          type: string
          description: >-
            Which of your entities owns this configuration. Defaults to your own
            organization.
          example: 6610b3d2c2e0a51b8c0d1f02
      required:
        - name
        - lineOfBusiness
        - stateCodes
    DownstreamComplianceConfigResponse:
      type: object
      properties:
        complianceConfigId:
          type: string
          description: Unique identifier of the configuration
          example: 65a1b2c3d4e5f6a7b8c9d0e9
        downstreamEntityId:
          type: string
          description: Which of your entities owns this configuration
          example: 6610b3d2c2e0a51b8c0d1f02
        name:
          type: string
          description: Configuration name, unique within your entity
          example: Personal Lines baseline
        description:
          type: string
          description: Free-text description
        lineOfBusiness:
          type: string
          description: The line of business this configuration governs
          example: Personal Lines
        states:
          description: Per-state rules, with their requirements resolved
          type: array
          items:
            $ref: '#/components/schemas/DownstreamComplianceConfigStateResponse'
        createdAt:
          type: string
          description: ISO 8601 creation timestamp
          example: '2025-01-15T10:30:00.000Z'
        updatedAt:
          type: string
          description: ISO 8601 last-update timestamp
          example: '2026-02-12T09:00:00.000Z'
      required:
        - complianceConfigId
        - downstreamEntityId
        - name
        - states
    ErrorResponseDto:
      type: object
      properties:
        statusCode:
          type: number
          description: HTTP status code
        requestId:
          type: string
          description: Unique request identifier for debugging
        errorType:
          type: string
          description: >-
            Machine-readable error classification. Branch on this rather than on
            `errorMessage`, which is prose and may change. Authentication
            failures returned by our identity provider are forwarded verbatim,
            so a 401 can carry a code outside this list; treat an unrecognised
            value as a generic failure of its HTTP status.
          enum:
            - conflict
            - contact_not_authorized
            - document_exceeds_page_limit
            - downstream_entity_member_exists
            - duplicate_external_id_error
            - duplicate_member_email
            - duplicate_producer_code_error
            - forbidden
            - gateway_timeout
            - inactive_email
            - internal_server_error
            - invalid_email
            - invalid_email_for_invites
            - invalid_organization_category
            - invalid_organization_slug
            - invalid_phone_number
            - invalid_token
            - invite_limit_reached
            - jwt_invalid
            - m2m_client_not_found
            - not_found
            - organization_already_exists
            - organization_slug_already_used
            - payment_required
            - producer_agreement_required
            - product_feature_subscription_required
            - service_unavailable
            - session_authorization_error
            - some_custom_error_string
            - throttled
            - too_many_requests
            - unauthorized
            - unauthorized_client
            - unexpected_400_stytch_error
            - unexpected_403_stytch_error
            - unexpected_404_stytch_error
            - unexpected_error
            - unexpected_stytch_error
            - unprocessable_entity
            - validation_error
          example: validation_error
        errorMessage:
          description: Array of error messages
          type: array
          items:
            type: string
        timestamp:
          type: string
          description: ISO timestamp when the error occurred
        details:
          type: object
          description: Additional error context
      required:
        - statusCode
        - requestId
        - errorType
        - errorMessage
        - timestamp
    DownstreamComplianceConfigStateResponse:
      type: object
      properties:
        stateCode:
          type: string
          description: State or territory
          enum:
            - AL
            - AK
            - AZ
            - AR
            - CA
            - CO
            - CT
            - DE
            - FL
            - GA
            - HI
            - ID
            - IL
            - IN
            - IA
            - KS
            - KY
            - LA
            - ME
            - MD
            - MA
            - MI
            - MN
            - MS
            - MO
            - MT
            - NE
            - NV
            - NH
            - NJ
            - NM
            - NY
            - NC
            - ND
            - OH
            - OK
            - OR
            - PA
            - RI
            - SC
            - SD
            - TN
            - TX
            - UT
            - VT
            - VA
            - WA
            - WV
            - WI
            - WY
            - GU
            - PR
            - VI
            - DC
          example: PA
        licenseComplianceRequirementId:
          type: string
          description: The requirement document this state points at
          example: 65a1b2c3d4e5f6a7b8c9d0e5
        isTurrisDefault:
          type: boolean
          description: >-
            True when this is a Turris-owned default; false when the rule was
            built for your agency
          example: true
        entityRequirement:
          description: What the agency entity must hold in this state
          allOf:
            - $ref: '#/components/schemas/DownstreamComplianceRequirementResponse'
        producerRequirement:
          description: What a producer must hold in this state
          allOf:
            - $ref: '#/components/schemas/DownstreamComplianceRequirementResponse'
        requiresJointAgentLicenseCompliance:
          type: boolean
          description: >-
            True when the entity and producer requirements must be satisfied
            together
          example: false
      required:
        - stateCode
        - licenseComplianceRequirementId
        - isTurrisDefault
        - entityRequirement
        - producerRequirement
        - requiresJointAgentLicenseCompliance
    DownstreamComplianceRequirementResponse:
      type: object
      properties:
        anyOf:
          description: >-
            Satisfied when ANY of these options is fully held. An empty list
            means nothing is required.
          type: array
          items:
            $ref: '#/components/schemas/DownstreamComplianceRequirementOptionResponse'
      required:
        - anyOf
    DownstreamComplianceRequirementOptionResponse:
      type: object
      properties:
        allOf:
          description: Every licence and line of authority in this option must be held
          type: array
          items:
            $ref: '#/components/schemas/DownstreamLicenseLoaResponse'
      required:
        - allOf
    DownstreamLicenseLoaResponse:
      type: object
      properties:
        stateLicenseLoaMappingId:
          type: string
          description: Identifier of the NIPR state/class/LOA mapping
          example: 65a1b2c3d4e5f6a7b8c9d0e1
        licenseClassCode:
          type: string
          description: Licence class code
          example: '135'
        licenseClassName:
          type: string
          description: Licence class name
          example: Insurance Producer
        lineOfAuthorityCode:
          type: string
          description: Line-of-authority code
          example: '16'
        lineOfAuthorityName:
          type: string
          description: Line-of-authority name
          example: Property
        isDeprecated:
          type: boolean
          description: True when NIPR has retired this mapping
          example: false
      required:
        - stateLicenseLoaMappingId

````

## Related topics

- [List Compliance Configurations](/api-reference/v2/downstream/compliance-configs/list-compliance-configs.md)
- [Tools & Integrations](/guides/tools-and-integrations.md)
- [Add a Licensed Entity](/api-reference/v2/downstream/entities/add-entity.md)
