swagger: '2.0'
info:
  title: KYC Service API Documentation
  description: KYC (Know Your Customer) Service APIs including document verification,
    identity checks, and tenant management
  contact:
    email: support@example.com
  license:
    name: BSD License
  version: v1
host: kyc.devsgraphics.com
schemes:
- http
basePath: /
consumes:
- application/json
produces:
- application/json
securityDefinitions:
  Basic:
    type: basic
security:
- Basic: []
paths:
  /v1/health/:
    get:
      operationId: v1_health_list
      description: ''
      parameters: []
      responses:
        '200':
          description: ''
      tags:
      - v1
    parameters: []
  /v1/kyc/bootstrap/tenant/:
    post:
      operationId: v1_kyc_bootstrap_tenant
      summary: Bootstrap tenant + api key + default program/policy/plan
      description: |-
        Bootstrap module:
          POST /v1/bootstrap/tenant/
      parameters:
      - name: data
        in: body
        required: true
        schema:
          $ref: '#/definitions/TenantBootstrapRequest'
      responses:
        '201':
          description: Created
      tags:
      - v1
    parameters: []
  /v1/kyc/cases/start/:
    post:
      operationId: v1_kyc_cases_start
      summary: Start KYC Case
      description: |-
        KYC Cases API (hardened)

        - POST /cases/start/
        - GET  /cases/{id}/
        - POST /cases/{id}/documents/upload/ (multipart)
        - GET  /cases/{id}/documents/
      parameters:
      - name: subject_id
        in: formData
        required: true
        type: string
        format: uuid
      - name: program_code
        in: formData
        required: true
        type: string
        format: slug
        pattern: ^[-a-zA-Z0-9_]+$
        maxLength: 60
        minLength: 1
      - name: case_type
        in: formData
        required: false
        type: string
        enum:
        - onboarding
        - rekyc
        - edd
      - name: attributes
        in: formData
        required: false
        type: string
      responses:
        '200':
          description: OK
      consumes:
      - multipart/form-data
      - application/x-www-form-urlencoded
      tags:
      - v1
    parameters: []
  /v1/kyc/cases/{id}/:
    get:
      operationId: v1_kyc_cases_read
      summary: Get Case Detail
      description: |-
        KYC Cases API (hardened)

        - POST /cases/start/
        - GET  /cases/{id}/
        - POST /cases/{id}/documents/upload/ (multipart)
        - GET  /cases/{id}/documents/
      parameters: []
      responses:
        '200':
          description: ''
          schema:
            $ref: '#/definitions/CaseDetail'
      consumes:
      - multipart/form-data
      - application/x-www-form-urlencoded
      tags:
      - v1
    parameters:
    - name: id
      in: path
      description: A UUID string identifying this kyc case.
      required: true
      type: string
      format: uuid
  /v1/kyc/cases/{id}/approve/:
    post:
      operationId: v1_kyc_cases_approve
      summary: Approve Case
      description: |-
        KYC Cases API (hardened)

        - POST /cases/start/
        - GET  /cases/{id}/
        - POST /cases/{id}/documents/upload/ (multipart)
        - GET  /cases/{id}/documents/
      parameters:
      - name: reason
        in: formData
        required: false
        type: string
      - name: notes
        in: formData
        required: false
        type: string
      responses:
        '201':
          description: ''
          schema:
            $ref: '#/definitions/CaseDecisionCreate'
      consumes:
      - multipart/form-data
      - application/x-www-form-urlencoded
      tags:
      - v1
    parameters:
    - name: id
      in: path
      description: A UUID string identifying this kyc case.
      required: true
      type: string
      format: uuid
  /v1/kyc/cases/{id}/checks/:
    get:
      operationId: v1_kyc_cases_list_checks
      summary: List Case Checks
      description: |-
        KYC Cases API (hardened)

        - POST /cases/start/
        - GET  /cases/{id}/
        - POST /cases/{id}/documents/upload/ (multipart)
        - GET  /cases/{id}/documents/
      parameters: []
      responses:
        '200':
          description: ''
          schema:
            $ref: '#/definitions/CaseDetail'
      consumes:
      - multipart/form-data
      - application/x-www-form-urlencoded
      tags:
      - v1
    parameters:
    - name: id
      in: path
      description: A UUID string identifying this kyc case.
      required: true
      type: string
      format: uuid
  /v1/kyc/cases/{id}/checks/manual-fail/:
    post:
      operationId: v1_kyc_cases_checks_manual_fail_check
      summary: Manually FAIL a check
      description: |-
        KYC Cases API (hardened)

        - POST /cases/start/
        - GET  /cases/{id}/
        - POST /cases/{id}/documents/upload/ (multipart)
        - GET  /cases/{id}/documents/
      parameters:
      - name: check_type_code
        in: formData
        required: true
        type: string
        format: slug
        pattern: ^[-a-zA-Z0-9_]+$
        maxLength: 60
        minLength: 1
      - name: notes
        in: formData
        required: false
        type: string
      - name: output
        in: formData
        required: false
        type: string
      responses:
        '201':
          description: ''
          schema:
            $ref: '#/definitions/ManualCheckResolution'
      consumes:
      - multipart/form-data
      - application/x-www-form-urlencoded
      tags:
      - v1
    parameters:
    - name: id
      in: path
      description: A UUID string identifying this kyc case.
      required: true
      type: string
      format: uuid
  /v1/kyc/cases/{id}/checks/manual-pass/:
    post:
      operationId: v1_kyc_cases_checks_manual_pass_check
      summary: Manually PASS a check
      description: |-
        KYC Cases API (hardened)

        - POST /cases/start/
        - GET  /cases/{id}/
        - POST /cases/{id}/documents/upload/ (multipart)
        - GET  /cases/{id}/documents/
      parameters:
      - name: check_type_code
        in: formData
        required: true
        type: string
        format: slug
        pattern: ^[-a-zA-Z0-9_]+$
        maxLength: 60
        minLength: 1
      - name: notes
        in: formData
        required: false
        type: string
      - name: output
        in: formData
        required: false
        type: string
      responses:
        '201':
          description: ''
          schema:
            $ref: '#/definitions/ManualCheckResolution'
      consumes:
      - multipart/form-data
      - application/x-www-form-urlencoded
      tags:
      - v1
    parameters:
    - name: id
      in: path
      description: A UUID string identifying this kyc case.
      required: true
      type: string
      format: uuid
  /v1/kyc/cases/{id}/checks/run/:
    post:
      operationId: v1_kyc_cases_checks_run_check
      summary: Run a case check (foundation)
      description: |-
        KYC Cases API (hardened)

        - POST /cases/start/
        - GET  /cases/{id}/
        - POST /cases/{id}/documents/upload/ (multipart)
        - GET  /cases/{id}/documents/
      parameters:
      - name: check_type_code
        in: formData
        required: true
        type: string
        maxLength: 80
        minLength: 1
      - name: input
        in: formData
        required: false
        type: string
        default: {}
      - name: notes
        in: formData
        required: false
        type: string
        default: ''
      - name: force
        in: formData
        required: false
        type: boolean
        default: false
      responses:
        '200':
          description: OK
      consumes:
      - multipart/form-data
      - application/x-www-form-urlencoded
      tags:
      - v1
    parameters:
    - name: id
      in: path
      description: A UUID string identifying this kyc case.
      required: true
      type: string
      format: uuid
  /v1/kyc/cases/{id}/documents/:
    get:
      operationId: v1_kyc_cases_list_documents
      summary: List Case Documents
      description: |-
        KYC Cases API (hardened)

        - POST /cases/start/
        - GET  /cases/{id}/
        - POST /cases/{id}/documents/upload/ (multipart)
        - GET  /cases/{id}/documents/
      parameters: []
      responses:
        '200':
          description: ''
          schema:
            $ref: '#/definitions/CaseDetail'
      consumes:
      - multipart/form-data
      - application/x-www-form-urlencoded
      tags:
      - v1
    parameters:
    - name: id
      in: path
      description: A UUID string identifying this kyc case.
      required: true
      type: string
      format: uuid
  /v1/kyc/cases/{id}/documents/upload/:
    post:
      operationId: v1_kyc_cases_documents_upload_document
      summary: Upload Case Document
      description: |-
        KYC Cases API (hardened)

        - POST /cases/start/
        - GET  /cases/{id}/
        - POST /cases/{id}/documents/upload/ (multipart)
        - GET  /cases/{id}/documents/
      parameters:
      - name: status
        in: formData
        required: false
        type: string
        enum:
        - draft
        - submitted
        - in_review
        - needs_changes
        - approved
        - rejected
        - expired
      - name: case_type
        in: formData
        required: false
        type: string
        enum:
        - onboarding
        - rekyc
        - edd
      - name: attributes
        in: formData
        required: false
        type: string
      - name: submitted_at
        in: formData
        required: false
        type: string
        format: date-time
        x-nullable: true
      - name: decided_at
        in: formData
        required: false
        type: string
        format: date-time
        x-nullable: true
      - name: document_type_code
        in: formData
        required: true
        type: string
      - name: file
        in: formData
        required: true
        type: file
      - name: mime_type
        in: formData
        required: false
        type: string
      responses:
        '201':
          description: ''
          schema:
            $ref: '#/definitions/CaseDetail'
      consumes:
      - multipart/form-data
      tags:
      - v1
    parameters:
    - name: id
      in: path
      description: A UUID string identifying this kyc case.
      required: true
      type: string
      format: uuid
  /v1/kyc/cases/{id}/reject/:
    post:
      operationId: v1_kyc_cases_reject
      summary: Reject Case
      description: |-
        KYC Cases API (hardened)

        - POST /cases/start/
        - GET  /cases/{id}/
        - POST /cases/{id}/documents/upload/ (multipart)
        - GET  /cases/{id}/documents/
      parameters:
      - name: reason
        in: formData
        required: false
        type: string
      - name: notes
        in: formData
        required: false
        type: string
      responses:
        '201':
          description: ''
          schema:
            $ref: '#/definitions/CaseDecisionCreate'
      consumes:
      - multipart/form-data
      - application/x-www-form-urlencoded
      tags:
      - v1
    parameters:
    - name: id
      in: path
      description: A UUID string identifying this kyc case.
      required: true
      type: string
      format: uuid
  /v1/kyc/cases/{id}/submit/:
    post:
      operationId: v1_kyc_cases_submit
      summary: Submit Case
      description: |-
        KYC Cases API (hardened)

        - POST /cases/start/
        - GET  /cases/{id}/
        - POST /cases/{id}/documents/upload/ (multipart)
        - GET  /cases/{id}/documents/
      parameters:
      - name: notes
        in: formData
        required: false
        type: string
      responses:
        '201':
          description: ''
          schema:
            $ref: '#/definitions/CaseSubmit'
      consumes:
      - multipart/form-data
      - application/x-www-form-urlencoded
      tags:
      - v1
    parameters:
    - name: id
      in: path
      description: A UUID string identifying this kyc case.
      required: true
      type: string
      format: uuid
  /v1/kyc/cases/{id}/timeline/:
    get:
      operationId: v1_kyc_cases_timeline
      summary: Get Case Timeline (audit trail)
      description: |-
        KYC Cases API (hardened)

        - POST /cases/start/
        - GET  /cases/{id}/
        - POST /cases/{id}/documents/upload/ (multipart)
        - GET  /cases/{id}/documents/
      parameters: []
      responses:
        '200':
          description: ''
          schema:
            $ref: '#/definitions/CaseDetail'
      consumes:
      - multipart/form-data
      - application/x-www-form-urlencoded
      tags:
      - v1
    parameters:
    - name: id
      in: path
      description: A UUID string identifying this kyc case.
      required: true
      type: string
      format: uuid
  /v1/kyc/check-types/:
    get:
      operationId: v1_kyc_check-types_list
      description: Tenant-scoped Check Types used by policy rules (checks_required).
      parameters: []
      responses:
        '200':
          description: ''
          schema:
            type: array
            items:
              $ref: '#/definitions/CheckTypeDetail'
      tags:
      - v1
    post:
      operationId: v1_kyc_check-types_create
      summary: Create Check Type
      description: Tenant-scoped Check Types used by policy rules (checks_required).
      parameters:
      - name: data
        in: body
        required: true
        schema:
          $ref: '#/definitions/CheckTypeCreate'
      responses:
        '201':
          description: ''
          schema:
            $ref: '#/definitions/CheckTypeDetail'
      tags:
      - v1
    parameters: []
  /v1/kyc/check-types/{id}/:
    get:
      operationId: v1_kyc_check-types_read
      description: Tenant-scoped Check Types used by policy rules (checks_required).
      parameters: []
      responses:
        '200':
          description: ''
          schema:
            $ref: '#/definitions/CheckTypeDetail'
      tags:
      - v1
    put:
      operationId: v1_kyc_check-types_update
      description: Tenant-scoped Check Types used by policy rules (checks_required).
      parameters:
      - name: data
        in: body
        required: true
        schema:
          $ref: '#/definitions/CheckTypeDetail'
      responses:
        '200':
          description: ''
          schema:
            $ref: '#/definitions/CheckTypeDetail'
      tags:
      - v1
    patch:
      operationId: v1_kyc_check-types_partial_update
      description: Tenant-scoped Check Types used by policy rules (checks_required).
      parameters:
      - name: data
        in: body
        required: true
        schema:
          $ref: '#/definitions/CheckTypeDetail'
      responses:
        '200':
          description: ''
          schema:
            $ref: '#/definitions/CheckTypeDetail'
      tags:
      - v1
    parameters:
    - name: id
      in: path
      required: true
      type: string
  /v1/kyc/checks/cases/{case_id}/checks/:
    get:
      operationId: v1_kyc_checks_cases_list_case_checks
      summary: List Case Checks
      description: |-
        Case-scoped checks API:
          - GET  /cases/{case_id}/checks/
          - POST /cases/{case_id}/checks/run/
      parameters: []
      responses:
        '200':
          description: List checks
      tags:
      - v1
    parameters:
    - name: case_id
      in: path
      required: true
      type: string
  /v1/kyc/checks/cases/{case_id}/checks/run/:
    post:
      operationId: v1_kyc_checks_cases_checks_run_check
      summary: Run a Check
      description: Creates a CheckRun and executes it (sync demo runner). Later we
        can switch execution to Celery without changing API.
      parameters:
      - name: data
        in: body
        required: true
        schema:
          $ref: '#/definitions/CheckRunStart'
      responses:
        '200':
          description: ''
          schema:
            $ref: '#/definitions/CheckRunDetail'
      tags:
      - v1
    parameters:
    - name: case_id
      in: path
      required: true
      type: string
  /v1/kyc/document-types/:
    get:
      operationId: v1_kyc_document-types_list
      description: Tenant-scoped document types referenced by policy rules.
      parameters: []
      responses:
        '200':
          description: ''
          schema:
            type: array
            items:
              $ref: '#/definitions/DocumentTypeDetail'
      tags:
      - v1
    post:
      operationId: v1_kyc_document-types_create
      summary: Create Document Type
      description: Tenant-scoped document types referenced by policy rules.
      parameters:
      - name: data
        in: body
        required: true
        schema:
          $ref: '#/definitions/DocumentTypeCreate'
      responses:
        '201':
          description: ''
          schema:
            $ref: '#/definitions/DocumentTypeDetail'
      tags:
      - v1
    parameters: []
  /v1/kyc/document-types/{id}/:
    get:
      operationId: v1_kyc_document-types_read
      description: Tenant-scoped document types referenced by policy rules.
      parameters: []
      responses:
        '200':
          description: ''
          schema:
            $ref: '#/definitions/DocumentTypeDetail'
      tags:
      - v1
    put:
      operationId: v1_kyc_document-types_update
      description: Tenant-scoped document types referenced by policy rules.
      parameters:
      - name: data
        in: body
        required: true
        schema:
          $ref: '#/definitions/DocumentTypeDetail'
      responses:
        '200':
          description: ''
          schema:
            $ref: '#/definitions/DocumentTypeDetail'
      tags:
      - v1
    patch:
      operationId: v1_kyc_document-types_partial_update
      description: Tenant-scoped document types referenced by policy rules.
      parameters:
      - name: data
        in: body
        required: true
        schema:
          $ref: '#/definitions/DocumentTypeDetail'
      responses:
        '200':
          description: ''
          schema:
            $ref: '#/definitions/DocumentTypeDetail'
      tags:
      - v1
    parameters:
    - name: id
      in: path
      required: true
      type: string
  /v1/kyc/policies/:
    get:
      operationId: v1_kyc_policies_list
      summary: List Policies
      description: Policies group policy versions. Typically one active policy per
        program (but flexible).
      parameters: []
      responses:
        '200':
          description: Policies list
      tags:
      - v1
    post:
      operationId: v1_kyc_policies_create
      summary: Create Policy
      description: Policies group policy versions. Typically one active policy per
        program (but flexible).
      parameters:
      - name: data
        in: body
        required: true
        schema:
          $ref: '#/definitions/PolicyCreate'
      responses:
        '201':
          description: Created policy
      tags:
      - v1
    parameters: []
  /v1/kyc/policy-versions/publish/:
    post:
      operationId: v1_kyc_policy-versions_publish
      summary: Create & Publish Policy Version
      description: Creates the next policy version and marks it as published (unpublishes
        previous).
      parameters:
      - name: data
        in: body
        required: true
        schema:
          $ref: '#/definitions/PolicyVersionCreate'
      responses:
        '200':
          description: Published policy version
      tags:
      - v1
    parameters: []
  /v1/kyc/privacy/case-exports/{id}/export/:
    post:
      operationId: v1_kyc_privacy_case-exports_export_case
      summary: Export case (zip)
      description: |-
        POST /cases/{id}/export/
        Returns a zip file export of a case (regulator/customer).
      parameters:
      - name: data
        in: body
        required: true
        schema:
          $ref: '#/definitions/CaseExportRequest'
      responses:
        '200':
          description: Zip file
        '404':
          description: Not found
      tags:
      - v1
    parameters:
    - name: id
      in: path
      description: A UUID string identifying this kyc case.
      required: true
      type: string
      format: uuid
  /v1/kyc/privacy/consents/:
    get:
      operationId: v1_kyc_privacy_consents_list
      description: ''
      parameters: []
      responses:
        '200':
          description: ''
          schema:
            type: array
            items:
              $ref: '#/definitions/ConsentRecord'
      tags:
      - v1
    parameters: []
  /v1/kyc/privacy/consents/create/:
    post:
      operationId: v1_kyc_privacy_consents_create_consent
      summary: Create consent record
      description: ''
      parameters:
      - name: data
        in: body
        required: true
        schema:
          $ref: '#/definitions/ConsentRecordCreate'
      responses:
        '201':
          description: ''
          schema:
            $ref: '#/definitions/ConsentRecordCreate'
      tags:
      - v1
    parameters: []
  /v1/kyc/privacy/consents/{id}/:
    get:
      operationId: v1_kyc_privacy_consents_read
      description: ''
      parameters: []
      responses:
        '200':
          description: ''
          schema:
            $ref: '#/definitions/ConsentRecord'
      tags:
      - v1
    parameters:
    - name: id
      in: path
      required: true
      type: string
  /v1/kyc/privacy/export-jobs/:
    get:
      operationId: v1_kyc_privacy_export-jobs_list
      summary: List export jobs (history)
      description: Export job history for audit and compliance.
      parameters:
      - name: case_id
        in: query
        type: string
        format: uuid
      - name: status
        in: query
        type: string
      - name: purpose
        in: query
        type: string
      - name: requested_by
        in: query
        type: string
      - name: created_from
        in: query
        type: string
        format: date-time
      - name: created_to
        in: query
        type: string
        format: date-time
      - name: limit
        in: query
        type: integer
      responses:
        '200':
          description: ''
          schema:
            type: array
            items:
              $ref: '#/definitions/DataExportJob'
      tags:
      - v1
    parameters: []
  /v1/kyc/privacy/export-jobs/{id}/:
    get:
      operationId: v1_kyc_privacy_export-jobs_read
      description: Export job history for audit and compliance.
      parameters: []
      responses:
        '200':
          description: ''
          schema:
            $ref: '#/definitions/DataExportJob'
      tags:
      - v1
    parameters:
    - name: id
      in: path
      required: true
      type: string
  /v1/kyc/privacy/retention-policies/:
    get:
      operationId: v1_kyc_privacy_retention-policies_list
      description: ''
      parameters: []
      responses:
        '200':
          description: ''
          schema:
            type: array
            items:
              $ref: '#/definitions/RetentionPolicy'
      tags:
      - v1
    parameters: []
  /v1/kyc/privacy/retention-policies/active/:
    get:
      operationId: v1_kyc_privacy_retention-policies_active
      summary: Get active retention policy for tenant
      description: ''
      parameters: []
      responses:
        '200':
          description: ''
          schema:
            type: array
            items:
              $ref: '#/definitions/RetentionPolicy'
      tags:
      - v1
    parameters: []
  /v1/kyc/privacy/retention-policies/create/:
    post:
      operationId: v1_kyc_privacy_retention-policies_create_policy
      summary: Create retention policy
      description: ''
      parameters:
      - name: data
        in: body
        required: true
        schema:
          $ref: '#/definitions/RetentionPolicyCreate'
      responses:
        '201':
          description: ''
          schema:
            $ref: '#/definitions/RetentionPolicyCreate'
      tags:
      - v1
    parameters: []
  /v1/kyc/privacy/retention-policies/{id}/:
    get:
      operationId: v1_kyc_privacy_retention-policies_read
      description: ''
      parameters: []
      responses:
        '200':
          description: ''
          schema:
            $ref: '#/definitions/RetentionPolicy'
      tags:
      - v1
    put:
      operationId: v1_kyc_privacy_retention-policies_update
      description: ''
      parameters:
      - name: data
        in: body
        required: true
        schema:
          $ref: '#/definitions/RetentionPolicy'
      responses:
        '200':
          description: ''
          schema:
            $ref: '#/definitions/RetentionPolicy'
      tags:
      - v1
    patch:
      operationId: v1_kyc_privacy_retention-policies_partial_update
      description: ''
      parameters:
      - name: data
        in: body
        required: true
        schema:
          $ref: '#/definitions/RetentionPolicy'
      responses:
        '200':
          description: ''
          schema:
            $ref: '#/definitions/RetentionPolicy'
      tags:
      - v1
    parameters:
    - name: id
      in: path
      required: true
      type: string
  /v1/kyc/programs/:
    get:
      operationId: v1_kyc_programs_list
      description: |-
        KYC Programs define onboarding contexts (wallets, loans, merchants, etc).
        Programs are tenant-scoped.
      parameters: []
      responses:
        '200':
          description: ''
          schema:
            type: array
            items:
              $ref: '#/definitions/ProgramDetail'
      tags:
      - v1
    post:
      operationId: v1_kyc_programs_create
      summary: Create Program
      description: |-
        KYC Programs define onboarding contexts (wallets, loans, merchants, etc).
        Programs are tenant-scoped.
      parameters:
      - name: data
        in: body
        required: true
        schema:
          $ref: '#/definitions/ProgramCreate'
      responses:
        '201':
          description: ''
          schema:
            $ref: '#/definitions/ProgramDetail'
      tags:
      - v1
    parameters: []
  /v1/kyc/programs/{id}/:
    get:
      operationId: v1_kyc_programs_read
      description: |-
        KYC Programs define onboarding contexts (wallets, loans, merchants, etc).
        Programs are tenant-scoped.
      parameters: []
      responses:
        '200':
          description: ''
          schema:
            $ref: '#/definitions/ProgramDetail'
      tags:
      - v1
    parameters:
    - name: id
      in: path
      required: true
      type: string
  /v1/kyc/subjects/upsert/:
    post:
      operationId: v1_kyc_subjects_upsert
      summary: Upsert Subject
      description: Create or update a subject within tenant based on external_id +
        source_system.
      parameters:
      - name: data
        in: body
        required: true
        schema:
          $ref: '#/definitions/SubjectUpsert'
      responses:
        '200':
          description: Upserted subject
          schema:
            type: object
            properties:
              success:
                type: boolean
              created:
                type: boolean
              subject:
                type: object
      tags:
      - v1
    parameters: []
  /v1/kyc/webhooks/endpoints/:
    get:
      operationId: v1_kyc_webhooks_endpoints_list
      description: ''
      parameters: []
      responses:
        '200':
          description: ''
          schema:
            type: array
            items:
              $ref: '#/definitions/WebhookEndpointDetail'
      tags:
      - v1
    post:
      operationId: v1_kyc_webhooks_endpoints_create
      summary: Create Webhook Endpoint
      description: ''
      parameters:
      - name: data
        in: body
        required: true
        schema:
          $ref: '#/definitions/WebhookEndpointCreate'
      responses:
        '201':
          description: ''
          schema:
            $ref: '#/definitions/WebhookEndpointDetail'
      tags:
      - v1
    parameters: []
  /v1/kyc/webhooks/endpoints/deliveries/:
    get:
      operationId: v1_kyc_webhooks_endpoints_deliveries
      summary: List Webhook Deliveries (Logs)
      description: ''
      parameters: []
      responses:
        '200':
          description: ''
          schema:
            type: array
            items:
              $ref: '#/definitions/WebhookEndpointDetail'
      tags:
      - v1
    parameters: []
  /v1/kyc/webhooks/endpoints/{id}/:
    get:
      operationId: v1_kyc_webhooks_endpoints_read
      description: ''
      parameters: []
      responses:
        '200':
          description: ''
          schema:
            $ref: '#/definitions/WebhookEndpointDetail'
      tags:
      - v1
    put:
      operationId: v1_kyc_webhooks_endpoints_update
      description: ''
      parameters:
      - name: data
        in: body
        required: true
        schema:
          $ref: '#/definitions/WebhookEndpointDetail'
      responses:
        '200':
          description: ''
          schema:
            $ref: '#/definitions/WebhookEndpointDetail'
      tags:
      - v1
    patch:
      operationId: v1_kyc_webhooks_endpoints_partial_update
      description: ''
      parameters:
      - name: data
        in: body
        required: true
        schema:
          $ref: '#/definitions/WebhookEndpointDetail'
      responses:
        '200':
          description: ''
          schema:
            $ref: '#/definitions/WebhookEndpointDetail'
      tags:
      - v1
    parameters:
    - name: id
      in: path
      required: true
      type: string
  /v1/whoami/:
    get:
      operationId: v1_whoami_list
      description: ''
      parameters: []
      responses:
        '200':
          description: ''
      tags:
      - v1
    parameters: []
  /v2/kyc/policy-plans-simulate/{id}/simulate/:
    post:
      operationId: v2_kyc_policy-plans-simulate_simulate
      summary: Simulate Policy Plan
      description: |-
        Standalone simulator endpoint (commercial):
        POST /policy-plans/{id}/simulate/
      parameters:
      - name: data
        in: body
        required: true
        schema:
          $ref: '#/definitions/PolicyPlanSimulateInput'
      responses:
        '200':
          description: Simulation result
          schema:
            $ref: '#/definitions/PolicyPlanSimulateOutput'
        '404':
          description: Not found
      tags:
      - v2
    parameters:
    - name: id
      in: path
      description: A UUID string identifying this policy plan.
      required: true
      type: string
      format: uuid
  /v2/kyc/policy-plans-tests/{id}/tests/:
    post:
      operationId: v2_kyc_policy-plans-tests_create_test
      summary: Create plan test case
      description: |-
        Test Packs:
        - GET  /policy-plans/{id}/tests/
        - POST /policy-plans/{id}/tests/        (create test)
        - POST /policy-plans/{id}/tests/run/    (run tests)
      parameters:
      - name: data
        in: body
        required: true
        schema:
          $ref: '#/definitions/PolicyPlanTestCaseCreate'
      responses:
        '201':
          description: ''
          schema:
            $ref: '#/definitions/PolicyPlanTestCaseCreate'
      tags:
      - v2
    parameters:
    - name: id
      in: path
      description: A UUID string identifying this policy plan.
      required: true
      type: string
      format: uuid
  /v2/kyc/policy-plans-tests/{id}/tests/run/:
    post:
      operationId: v2_kyc_policy-plans-tests_tests_run_tests
      summary: Run plan test pack
      description: |-
        Test Packs:
        - GET  /policy-plans/{id}/tests/
        - POST /policy-plans/{id}/tests/        (create test)
        - POST /policy-plans/{id}/tests/run/    (run tests)
      parameters:
      - name: data
        in: body
        required: true
        schema:
          $ref: '#/definitions/PolicyPlanRunTests'
      responses:
        '201':
          description: ''
          schema:
            $ref: '#/definitions/PolicyPlanRunTests'
      tags:
      - v2
    parameters:
    - name: id
      in: path
      description: A UUID string identifying this policy plan.
      required: true
      type: string
      format: uuid
  /v2/kyc/policy-plans/:
    get:
      operationId: v2_kyc_policy-plans_list
      description: ''
      parameters: []
      responses:
        '200':
          description: ''
          schema:
            type: array
            items:
              $ref: '#/definitions/PolicyPlan'
      tags:
      - v2
    post:
      operationId: v2_kyc_policy-plans_create
      description: ''
      parameters:
      - name: data
        in: body
        required: true
        schema:
          $ref: '#/definitions/PolicyPlan'
      responses:
        '201':
          description: ''
          schema:
            $ref: '#/definitions/PolicyPlan'
      tags:
      - v2
    parameters: []
  /v2/kyc/policy-plans/{id}/:
    get:
      operationId: v2_kyc_policy-plans_read
      description: ''
      parameters: []
      responses:
        '200':
          description: ''
          schema:
            $ref: '#/definitions/PolicyPlan'
      tags:
      - v2
    put:
      operationId: v2_kyc_policy-plans_update
      description: ''
      parameters:
      - name: data
        in: body
        required: true
        schema:
          $ref: '#/definitions/PolicyPlan'
      responses:
        '200':
          description: ''
          schema:
            $ref: '#/definitions/PolicyPlan'
      tags:
      - v2
    patch:
      operationId: v2_kyc_policy-plans_partial_update
      description: ''
      parameters:
      - name: data
        in: body
        required: true
        schema:
          $ref: '#/definitions/PolicyPlan'
      responses:
        '200':
          description: ''
          schema:
            $ref: '#/definitions/PolicyPlan'
      tags:
      - v2
    parameters:
    - name: id
      in: path
      required: true
      type: string
  /v2/kyc/policy-plans/{id}/publish/:
    post:
      operationId: v2_kyc_policy-plans_publish
      summary: Publish policy plan
      description: ''
      parameters:
      - name: data
        in: body
        required: true
        schema:
          $ref: '#/definitions/PolicyPlanPublish'
      responses:
        '201':
          description: ''
          schema:
            $ref: '#/definitions/PolicyPlanPublish'
      tags:
      - v2
    parameters:
    - name: id
      in: path
      required: true
      type: string
  /v2/kyc/policy-plans/{id}/validate/:
    post:
      operationId: v2_kyc_policy-plans_validate_config
      summary: Validate policy plan config
      description: ''
      parameters:
      - name: data
        in: body
        required: true
        schema:
          $ref: '#/definitions/PolicyPlan'
      responses:
        '201':
          description: ''
          schema:
            $ref: '#/definitions/PolicyPlan'
      tags:
      - v2
    parameters:
    - name: id
      in: path
      required: true
      type: string
  /v2/kyc/policy-versions-attach-plan/{id}/attach-plan/:
    post:
      operationId: v2_kyc_policy-versions-attach-plan_attach_plan
      summary: Attach a published Policy Plan to a Policy Version
      description: |-
        POST /policy-versions/{id}/attach-plan/
        Attaches a PUBLISHED plan to a policy version.
      parameters:
      - name: data
        in: body
        required: true
        schema:
          $ref: '#/definitions/PolicyVersionAttachPlan'
      responses:
        '200':
          description: Attached
          schema:
            type: object
        '400':
          description: Bad request
        '404':
          description: Not found
      tags:
      - v2
    parameters:
    - name: id
      in: path
      description: A UUID string identifying this kyc policy version.
      required: true
      type: string
      format: uuid
definitions:
  TenantBootstrapTenant:
    required:
    - slug
    - name
    type: object
    properties:
      slug:
        title: Slug
        type: string
        maxLength: 80
        minLength: 1
      name:
        title: Name
        type: string
        maxLength: 150
        minLength: 1
  TenantBootstrapDefaults:
    type: object
    properties:
      program_name:
        title: Program name
        type: string
        default: Default KYC Program
        maxLength: 150
        minLength: 1
      subject_types:
        type: array
        items:
          type: string
          maxLength: 50
          minLength: 1
        default:
        - individual
        - business
      plan_name:
        title: Plan name
        type: string
        default: Default Plan v2
        maxLength: 150
        minLength: 1
      policy_version:
        title: Policy version
        type: string
        default: v1
        maxLength: 50
        minLength: 1
      tier_default:
        title: Tier default
        type: string
        default: standard
        maxLength: 50
        minLength: 1
  TenantBootstrapWebhook:
    type: object
    properties:
      enabled:
        title: Enabled
        type: boolean
        default: false
      url:
        title: Url
        type: string
        format: uri
        minLength: 1
        x-nullable: true
      events:
        type: array
        items:
          type: string
          maxLength: 100
          minLength: 1
        default:
        - case.submitted
        - case.approved
        - case.rejected
  TenantBootstrapRequest:
    required:
    - tenant
    type: object
    properties:
      tenant:
        $ref: '#/definitions/TenantBootstrapTenant'
      defaults:
        $ref: '#/definitions/TenantBootstrapDefaults'
      webhook:
        $ref: '#/definitions/TenantBootstrapWebhook'
  CaseDetail:
    type: object
    properties:
      id:
        title: Id
        type: string
        format: uuid
        readOnly: true
      tenant_id:
        title: Tenant id
        type: string
        readOnly: true
      status:
        title: Status
        type: string
        enum:
        - draft
        - submitted
        - in_review
        - needs_changes
        - approved
        - rejected
        - expired
      case_type:
        title: Case type
        type: string
        enum:
        - onboarding
        - rekyc
        - edd
      program_code:
        title: Program code
        type: string
        readOnly: true
        minLength: 1
      subject_external_id:
        title: Subject external id
        type: string
        readOnly: true
        minLength: 1
      attributes:
        title: Attributes
        type: object
      submitted_at:
        title: Submitted at
        type: string
        format: date-time
        x-nullable: true
      decided_at:
        title: Decided at
        type: string
        format: date-time
        x-nullable: true
      created_at:
        title: Created at
        type: string
        format: date-time
        readOnly: true
      updated_at:
        title: Updated at
        type: string
        format: date-time
        readOnly: true
  CaseDecisionCreate:
    type: object
    properties:
      reason:
        title: Reason
        type: string
      notes:
        title: Notes
        type: string
  ManualCheckResolution:
    required:
    - check_type_code
    type: object
    properties:
      check_type_code:
        title: Check type code
        type: string
        format: slug
        pattern: ^[-a-zA-Z0-9_]+$
        maxLength: 60
        minLength: 1
      notes:
        title: Notes
        type: string
      output:
        title: Output
        type: object
  CaseSubmit:
    type: object
    properties:
      notes:
        title: Notes
        type: string
  CheckTypeDetail:
    required:
    - code
    - name
    type: object
    properties:
      id:
        title: Id
        type: string
        format: uuid
        readOnly: true
      code:
        title: Code
        type: string
        format: slug
        pattern: ^[-a-zA-Z0-9_]+$
        maxLength: 60
        minLength: 1
      name:
        title: Name
        type: string
        maxLength: 120
        minLength: 1
      description:
        title: Description
        type: string
      is_active:
        title: Is active
        type: boolean
      config:
        title: Config
        type: object
      created_at:
        title: Created at
        type: string
        format: date-time
        readOnly: true
      updated_at:
        title: Updated at
        type: string
        format: date-time
        readOnly: true
  CheckTypeCreate:
    required:
    - code
    - name
    type: object
    properties:
      code:
        title: Code
        type: string
        format: slug
        pattern: ^[-a-zA-Z0-9_]+$
        maxLength: 60
        minLength: 1
      name:
        title: Name
        type: string
        maxLength: 120
        minLength: 1
      description:
        title: Description
        type: string
      is_active:
        title: Is active
        type: boolean
      config:
        title: Config
        type: object
  CheckRunStart:
    required:
    - check_type_code
    type: object
    properties:
      check_type_code:
        title: Check type code
        type: string
        format: slug
        pattern: ^[-a-zA-Z0-9_]+$
        maxLength: 60
        minLength: 1
      input:
        title: Input
        type: object
  CheckRunDetail:
    type: object
    properties:
      id:
        title: Id
        type: string
        format: uuid
        readOnly: true
      check_type:
        title: Check type
        type: string
        readOnly: true
        minLength: 1
      status:
        title: Status
        type: string
        enum:
        - queued
        - running
        - succeeded
        - failed
      started_at:
        title: Started at
        type: string
        format: date-time
        x-nullable: true
      finished_at:
        title: Finished at
        type: string
        format: date-time
        x-nullable: true
      input:
        title: Input
        type: object
      output:
        title: Output
        type: object
      error:
        title: Error
        type: string
      created_at:
        title: Created at
        type: string
        format: date-time
        readOnly: true
  DocumentTypeDetail:
    required:
    - code
    - name
    type: object
    properties:
      id:
        title: Id
        type: string
        format: uuid
        readOnly: true
      code:
        title: Code
        type: string
        format: slug
        pattern: ^[-a-zA-Z0-9_]+$
        maxLength: 60
        minLength: 1
      name:
        title: Name
        type: string
        maxLength: 120
        minLength: 1
      description:
        title: Description
        type: string
      is_active:
        title: Is active
        type: boolean
      created_at:
        title: Created at
        type: string
        format: date-time
        readOnly: true
      updated_at:
        title: Updated at
        type: string
        format: date-time
        readOnly: true
  DocumentTypeCreate:
    required:
    - code
    - name
    type: object
    properties:
      code:
        title: Code
        type: string
        format: slug
        pattern: ^[-a-zA-Z0-9_]+$
        maxLength: 60
        minLength: 1
      name:
        title: Name
        type: string
        maxLength: 120
        minLength: 1
      description:
        title: Description
        type: string
      is_active:
        title: Is active
        type: boolean
  PolicyCreate:
    required:
    - program_id
    type: object
    properties:
      program_id:
        title: Program id
        type: string
        format: uuid
      name:
        title: Name
        type: string
        maxLength: 120
        minLength: 1
  PolicyVersionCreate:
    required:
    - policy_id
    type: object
    properties:
      policy_id:
        title: Policy id
        type: string
        format: uuid
      rules:
        title: Rules
        type: object
  CaseExportRequest:
    type: object
    properties:
      purpose:
        title: Purpose
        type: string
        default: regulator
        maxLength: 120
        minLength: 1
      include_documents:
        title: Include documents
        type: boolean
        default: true
      include_audit:
        title: Include audit
        type: boolean
        default: true
      include_redactions:
        title: Include redactions
        type: boolean
        default: true
      mask_pii:
        title: Mask pii
        type: boolean
        default: false
  ConsentRecord:
    required:
    - subject
    - scope
    type: object
    properties:
      id:
        title: Id
        type: string
        format: uuid
        readOnly: true
      subject:
        title: Subject
        type: string
        format: uuid
      scope:
        title: Scope
        type: string
        maxLength: 120
        minLength: 1
      policy_version:
        title: Policy version
        type: string
        maxLength: 50
      consent_text:
        title: Consent text
        type: string
      channel:
        title: Channel
        type: string
        maxLength: 50
      ip_address:
        title: Ip address
        type: string
        maxLength: 64
      user_agent:
        title: User agent
        type: string
      given:
        title: Given
        type: boolean
      withdrawn_at:
        title: Withdrawn at
        type: string
        format: date-time
        x-nullable: true
      created_at:
        title: Created at
        type: string
        format: date-time
        readOnly: true
      updated_at:
        title: Updated at
        type: string
        format: date-time
        readOnly: true
  ConsentRecordCreate:
    required:
    - subject_id
    - scope
    type: object
    properties:
      subject_id:
        title: Subject id
        type: string
        format: uuid
      scope:
        title: Scope
        type: string
        maxLength: 120
        minLength: 1
      policy_version:
        title: Policy version
        type: string
        default: ''
        maxLength: 50
      consent_text:
        title: Consent text
        type: string
        default: ''
      channel:
        title: Channel
        type: string
        default: ''
        maxLength: 50
      ip_address:
        title: Ip address
        type: string
        default: ''
        maxLength: 64
      user_agent:
        title: User agent
        type: string
        default: ''
  DataExportJob:
    required:
    - case
    type: object
    properties:
      id:
        title: Id
        type: string
        format: uuid
        readOnly: true
      case:
        title: Case
        type: string
        format: uuid
      requested_by:
        title: Requested by
        type: string
        maxLength: 120
      purpose:
        title: Purpose
        type: string
        maxLength: 120
      status:
        title: Status
        type: string
        enum:
        - pending
        - ready
        - failed
      meta:
        title: Meta
        type: object
      file_path:
        title: File path
        type: string
      created_at:
        title: Created at
        type: string
        format: date-time
        readOnly: true
      updated_at:
        title: Updated at
        type: string
        format: date-time
        readOnly: true
  RetentionPolicy:
    required:
    - name
    type: object
    properties:
      id:
        title: Id
        type: string
        format: uuid
        readOnly: true
      name:
        title: Name
        type: string
        maxLength: 120
        minLength: 1
      basis:
        title: Basis
        type: string
        enum:
        - CREATED_AT
        - UPDATED_AT
      apply_to_cases:
        title: Apply to cases
        type: boolean
      apply_to_subjects:
        title: Apply to subjects
        type: boolean
      apply_to_documents:
        title: Apply to documents
        type: boolean
      redact_after_days:
        title: Redact after days
        type: integer
        maximum: 2147483647
        minimum: 1
      delete_after_days:
        title: Delete after days
        type: integer
        maximum: 2147483647
        minimum: 1
        x-nullable: true
      redact_config:
        title: Redact config
        type: object
      keep_hashes:
        title: Keep hashes
        type: boolean
      is_active:
        title: Is active
        type: boolean
      created_at:
        title: Created at
        type: string
        format: date-time
        readOnly: true
      updated_at:
        title: Updated at
        type: string
        format: date-time
        readOnly: true
  RetentionPolicyCreate:
    required:
    - name
    type: object
    properties:
      name:
        title: Name
        type: string
        maxLength: 120
        minLength: 1
      basis:
        title: Basis
        type: string
        enum:
        - CREATED_AT
        - UPDATED_AT
        default: CREATED_AT
      apply_to_cases:
        title: Apply to cases
        type: boolean
        default: true
      apply_to_subjects:
        title: Apply to subjects
        type: boolean
        default: true
      apply_to_documents:
        title: Apply to documents
        type: boolean
        default: true
      redact_after_days:
        title: Redact after days
        type: integer
        default: 90
        minimum: 1
      delete_after_days:
        title: Delete after days
        type: integer
        minimum: 1
        x-nullable: true
      redact_config:
        title: Redact config
        type: object
        default: {}
      keep_hashes:
        title: Keep hashes
        type: boolean
        default: true
      is_active:
        title: Is active
        type: boolean
        default: true
  ProgramDetail:
    required:
    - code
    - name
    - subject_type
    type: object
    properties:
      id:
        title: Id
        type: string
        format: uuid
        readOnly: true
      code:
        title: Code
        type: string
        format: slug
        pattern: ^[-a-zA-Z0-9_]+$
        maxLength: 60
        minLength: 1
      name:
        title: Name
        type: string
        maxLength: 120
        minLength: 1
      description:
        title: Description
        type: string
      subject_type:
        title: Subject type
        type: string
        enum:
        - individual
        - business
      is_active:
        title: Is active
        type: boolean
      created_at:
        title: Created at
        type: string
        format: date-time
        readOnly: true
      updated_at:
        title: Updated at
        type: string
        format: date-time
        readOnly: true
  ProgramCreate:
    required:
    - code
    - name
    - subject_type
    type: object
    properties:
      code:
        title: Code
        type: string
        format: slug
        pattern: ^[-a-zA-Z0-9_]+$
        maxLength: 60
        minLength: 1
      name:
        title: Name
        type: string
        maxLength: 120
        minLength: 1
      description:
        title: Description
        type: string
      subject_type:
        title: Subject type
        type: string
        enum:
        - individual
        - business
  SubjectUpsert:
    required:
    - subject_type
    - external_id
    type: object
    properties:
      subject_type:
        title: Subject type
        type: string
        enum:
        - individual
        - business
      external_id:
        title: External id
        type: string
        maxLength: 120
        minLength: 1
      source_system:
        title: Source system
        type: string
        maxLength: 120
      attributes:
        title: Attributes
        type: object
  WebhookEndpointDetail:
    required:
    - name
    - url
    type: object
    properties:
      id:
        title: Id
        type: string
        format: uuid
        readOnly: true
      name:
        title: Name
        type: string
        maxLength: 120
        minLength: 1
      url:
        title: Url
        type: string
        format: uri
        maxLength: 200
        minLength: 1
      is_active:
        title: Is active
        type: boolean
      events:
        title: Events
        type: object
      timeout_sec:
        title: Timeout sec
        type: integer
        maximum: 2147483647
        minimum: 0
      created_at:
        title: Created at
        type: string
        format: date-time
        readOnly: true
      updated_at:
        title: Updated at
        type: string
        format: date-time
        readOnly: true
  WebhookEndpointCreate:
    required:
    - name
    - url
    type: object
    properties:
      name:
        title: Name
        type: string
        maxLength: 120
        minLength: 1
      url:
        title: Url
        type: string
        format: uri
        minLength: 1
      is_active:
        title: Is active
        type: boolean
      events:
        type: array
        items:
          type: string
          minLength: 1
      timeout_sec:
        title: Timeout sec
        type: integer
  PolicyPlanSimulateInput:
    type: object
    properties:
      subject:
        title: Subject
        type: object
        default: {}
      case:
        title: Case
        type: object
        default: {}
      provided_docs:
        description: List of document type codes already provided, e.g. ['PASSPORT','NATIONAL_ID']
        type: array
        items:
          type: string
          minLength: 1
        default: []
      passed_checks:
        description: List of check type codes already passed, e.g. ['PEP','SANCTIONS']
        type: array
        items:
          type: string
          minLength: 1
        default: []
  PolicyPlanSimulateOutput:
    required:
    - segment_id
    - segment_name
    - tier
    - score
    - requirements_expression
    - missing_docs
    - missing_checks
    - satisfied
    type: object
    properties:
      segment_id:
        title: Segment id
        type: string
        minLength: 1
      segment_name:
        title: Segment name
        type: string
        minLength: 1
      tier:
        title: Tier
        type: string
        minLength: 1
      score:
        title: Score
        type: integer
      score_breakdown:
        type: array
        items:
          type: object
      requirements_expression:
        title: Requirements expression
        type: object
      missing_docs:
        type: array
        items:
          type: string
          minLength: 1
      missing_checks:
        type: array
        items:
          type: string
          minLength: 1
      satisfied:
        title: Satisfied
        type: boolean
  PolicyPlanTestCaseCreate:
    required:
    - name
    type: object
    properties:
      name:
        title: Name
        type: string
        maxLength: 120
        minLength: 1
      subject:
        title: Subject
        type: object
        default: {}
      case:
        title: Case
        type: object
        default: {}
      provided_docs:
        type: array
        items:
          type: string
          minLength: 1
        default: []
      passed_checks:
        type: array
        items:
          type: string
          minLength: 1
        default: []
      expected_tier:
        title: Expected tier
        type: string
        default: ''
      expected_satisfied:
        title: Expected satisfied
        type: boolean
        x-nullable: true
      expected_missing_docs:
        type: array
        items:
          type: string
          minLength: 1
        default: []
      expected_missing_checks:
        type: array
        items:
          type: string
          minLength: 1
        default: []
  PolicyPlanRunTests:
    type: object
    properties:
      only_active:
        title: Only active
        type: boolean
        default: true
  PolicyPlan:
    required:
    - name
    type: object
    properties:
      id:
        title: Id
        type: string
        format: uuid
        readOnly: true
      name:
        title: Name
        type: string
        maxLength: 120
        minLength: 1
      description:
        title: Description
        type: string
      config:
        title: Config
        type: object
      status:
        title: Status
        type: string
        enum:
        - draft
        - published
        - archived
      version:
        title: Version
        type: integer
        maximum: 2147483647
        minimum: -2147483648
      is_active:
        title: Is active
        type: boolean
      created_at:
        title: Created at
        type: string
        format: date-time
        readOnly: true
      updated_at:
        title: Updated at
        type: string
        format: date-time
        readOnly: true
  PolicyPlanPublish:
    type: object
    properties:
      publish:
        title: Publish
        type: boolean
        default: true
  PolicyVersionAttachPlan:
    required:
    - plan_id
    type: object
    properties:
      plan_id:
        title: Plan id
        description: Published PolicyPlan ID to attach to this policy version.
        type: string
        format: uuid
