openapi: 3.0.3
info:
  title: 'Anteloope API'
  description: "\nUse the Anteloope API to manage consumers, accounts, payments, and payment plans through a versioned HTTP interface.\n\nThe public API is `/api/v1`. It uses HTTPS, scoped Bearer tokens, JSON:API 1.1 documents, and standard HTTP status codes.\n\n1. Obtain a Sandbox token and base URL from Anteloope Support.\n2. Send an authenticated request using the endpoint's documented fields.\n3. Move the same integration to Production with its Production token and URL.\n\nUse the endpoint reference as the source of truth for supported fields. Preserve the public identifiers returned by the API, tolerate additional response attributes, and record response status and body when diagnosing a failed integration.\n\n## Environments\n\n| Environment | Use it for | Credentials |\n| --- | --- | --- |\n| Sandbox | Build, test, and validate an integration. | Sandbox token and base URL. |\n| Production | Live account and payment activity. | Production token and base URL. |\n\nTokens are environment-specific and are not interchangeable. Anteloope Support provides the base URL and scoped token for each environment.\n\n## Authentication\n\nSend a scoped token with each authenticated request:\n\n```http\nAuthorization: Bearer {YOUR_AUTH_TOKEN}\n```\n\nStore tokens in a server-side secret manager. Do not expose them in browser code, screenshots, or source control.\n\n| Response | Meaning | Next step |\n| --- | --- | --- |\n| `401` | Token is missing or invalid. | Check the header and environment. |\n| `403` | Token lacks the endpoint ability. | Request the required scope from Support. |\n\n## Request format\n\nWrite endpoints use a JSON:API `data` envelope. Send the type in `data.type`, writable fields in `data.attributes`, and the route-matching ID in `data.id` when updating an existing record.\n\n```json\n{\n    \"data\": {\n        \"type\": \"consumers\",\n        \"attributes\": {\n            \"first_name\": \"Taylor\",\n            \"last_name\": \"Example\"\n        }\n    }\n}\n```\n\n| Convention | Rule |\n| --- | --- |\n| Field names | `snake_case` |\n| Timestamps | ISO 8601 |\n| Money | Integer minor units with a currency code |\n| Public IDs | Stable identifiers only |\n\nFlat JSON remains accepted on compatible endpoints, but new integrations should use the documented JSON:API envelope.\n\n## Idempotency\n\n`Idempotency-Key` is optional for account provisioning. Send a unique value when a network failure might cause you to retry the same account request.\n\n```http\nIdempotency-Key: account-provisioning-20260730-001\n```\n\n| Request sequence | Result |\n| --- | --- |\n| No key | The request is processed normally. |\n| Same key, same payload | The completed provisioning result is replayed. |\n| Same key, different payload | `409 Conflict`. Use a new key after resolving the mismatch. |\n\nUse the same key only to retry the same logical operation. This behavior is currently documented for account provisioning; do not assume it applies to other endpoints unless their reference explicitly says so.\n\n## Errors\n\nErrors use the JSON:API `errors` array. Validation errors include a `source.pointer` that identifies the relevant request field.\n\n```json\n{\n    \"errors\": [\n        {\n            \"status\": \"422\",\n            \"code\": \"validation_failed\",\n            \"title\": \"Validation failed\",\n            \"source\": { \"pointer\": \"/data/attributes/account_id\" }\n        }\n    ]\n}\n```\n\nCorrect the request before retrying `400`, `401`, `403`, `404`, or `422` responses. For `409`, resolve the conflict. Retry `429` and transient `5xx` responses with bounded exponential backoff and jitter.\n\n## Rate limits\n\n| Caller | Limit |\n| --- | --- |\n| Authenticated token | 600 requests per minute |\n| Unauthenticated client | 90 requests per minute |\n\nOn `429 Too Many Requests`, stop immediate retries, wait before retrying, and add random jitter. Prefer webhooks or bounded polling over tight loops.\n\n## Webhooks\n\nConfigure outbound webhook endpoints in **Organization Settings** under **Developers**. Each endpoint must use a publicly reachable HTTPS URL and subscribe only to the events your integration needs.\n\nEvery delivery is a JSON `POST` with this envelope:\n\n```json\n{\n    \"eventID\": \"b06c1ca2-2ac4-4f34-8258-bb6cc31ae284\",\n    \"type\": \"payment.updated\",\n    \"data\": {\n        \"payment\": {\n            \"id\": \"1000001\",\n            \"attributes\": {}\n        }\n    },\n    \"createdOn\": \"2026-07-30T12:00:00Z\"\n}\n```\n\nDelivery IDs and fields match the public v1 API. Deliveries are at-least-once: persist and deduplicate `eventID`, because a retry sends the original immutable payload again. Return any `2xx` status within five seconds to acknowledge receipt. Connection failures, `408`, `429`, and `5xx` responses are retried with exponential backoff for up to 24 hours.\n\nVerify each delivery with the per-endpoint signing secret, which is shown only when the endpoint is created or its secret is rotated:\n\n| Header | Description |\n| --- | --- |\n| `X-Timestamp` | ISO 8601 delivery timestamp. |\n| `X-Nonce` | Unique value generated for this attempt. |\n| `X-Webhook-ID` | The event delivery ID, equal to `eventID`. |\n| `X-Signature` | Lowercase HMAC-SHA512 of the timestamp, nonce, and webhook ID joined in that order, signed with the endpoint secret. |\n"
  version: 1.0.0
servers:
  - url: 'https://staging.anteloope.com'
tags:
  - name: Consumers
    description: ''
  - name: Accounts
    description: ''
  - name: Payments
    description: ''
  - name: 'Payment Plans'
    description: ''
  - name: 'Payment Methods'
    description: ''
  - name: Creditors
    description: ''
components:
  securitySchemes:
    default:
      type: http
      scheme: bearer
      description: 'Use the API Token provided by Anteloope Support.'
security:
  -
    default: []
paths:
  /api/v1/consumers:
    post:
      summary: 'Create Consumer'
      operationId: createConsumer
      description: 'Creates one consumer.'
      parameters: []
      responses:
        200:
          description: 'Existing consumer matched by organization consumer ID'
          content:
            application/json:
              schema:
                type: object
                example:
                  jsonapi:
                    version: '1.1'
                  data:
                    type: consumers
                    id: 55112a2d-36d7-3446-b776-9f0663a9994a
                    attributes:
                      organization_consumer_id: customer-12345
                      first_name: Taylor
                      last_name: Example
                      email: taylor@example.com
                properties:
                  jsonapi:
                    type: object
                    properties:
                      version:
                        type: string
                        example: '1.1'
                  data:
                    type: object
                    properties:
                      type:
                        type: string
                        example: consumers
                      id:
                        type: string
                        example: 55112a2d-36d7-3446-b776-9f0663a9994a
                      attributes:
                        type: object
                        properties:
                          organization_consumer_id:
                            type: string
                            example: customer-12345
                          first_name:
                            type: string
                            example: Taylor
                          last_name:
                            type: string
                            example: Example
                          email:
                            type: string
                            example: taylor@example.com
        201:
          description: 'JSON:API success'
          content:
            application/json:
              schema:
                type: object
                example:
                  jsonapi:
                    version: '1.1'
                  data:
                    type: consumers
                    id: 55112a2d-36d7-3446-b776-9f0663a9994a
                    attributes:
                      first_name: Taylor
                      middle_name: Morgan
                      last_name: Example
                      preferred_name: Tay
                      email: taylor@example.com
                      last_4_ssn: '1234'
                      date_of_birth: '1990-01-15'
                      last_updated: '2026-01-03T09:00:00.000000Z'
                properties:
                  jsonapi:
                    type: object
                    properties:
                      version:
                        type: string
                        example: '1.1'
                  data:
                    type: object
                    properties:
                      type:
                        type: string
                        example: consumers
                      id:
                        type: string
                        example: 55112a2d-36d7-3446-b776-9f0663a9994a
                      attributes:
                        type: object
                        properties:
                          first_name:
                            type: string
                            example: Taylor
                          middle_name:
                            type: string
                            example: Morgan
                          last_name:
                            type: string
                            example: Example
                          preferred_name:
                            type: string
                            example: Tay
                          email:
                            type: string
                            example: taylor@example.com
                          last_4_ssn:
                            type: string
                            example: '1234'
                          date_of_birth:
                            type: string
                            example: '1990-01-15'
                          last_updated:
                            type: string
                            example: '2026-01-03T09:00:00.000000Z'
        400:
          description: 'Invalid JSON:API document'
          content:
            application/json:
              schema:
                type: object
                example:
                  jsonapi:
                    version: '1.1'
                  errors:
                    -
                      status: '400'
                      code: invalid_resource_document
                      title: 'Invalid resource document'
                      detail: 'The JSON:API data.attributes member must be an object.'
                      source:
                        pointer: /data/attributes
                properties:
                  jsonapi:
                    type: object
                    properties:
                      version:
                        type: string
                        example: '1.1'
                  errors:
                    type: array
                    example:
                      -
                        status: '400'
                        code: invalid_resource_document
                        title: 'Invalid resource document'
                        detail: 'The JSON:API data.attributes member must be an object.'
                        source:
                          pointer: /data/attributes
                    items:
                      type: object
                      properties:
                        status:
                          type: string
                          example: '400'
                        code:
                          type: string
                          example: invalid_resource_document
                        title:
                          type: string
                          example: 'Invalid resource document'
                        detail:
                          type: string
                          example: 'The JSON:API data.attributes member must be an object.'
                        source:
                          type: object
                          properties:
                            pointer:
                              type: string
                              example: /data/attributes
        401:
          description: 'User is not authenticated'
          content:
            application/json:
              schema:
                type: object
                example:
                  jsonapi:
                    version: '1.1'
                  errors:
                    -
                      status: '401'
                      title: Unauthenticated.
                properties:
                  jsonapi:
                    type: object
                    properties:
                      version:
                        type: string
                        example: '1.1'
                  errors:
                    type: array
                    example:
                      - status: '401'
                        title: Unauthenticated.
                    items:
                      type: object
                      properties:
                        status:
                          type: string
                          example: '401'
                        title:
                          type: string
                          example: Unauthenticated.
        403:
          description: 'User is missing create-user ability'
          content:
            application/json:
              schema:
                type: object
                example:
                  jsonapi:
                    version: '1.1'
                  errors:
                    -
                      status: '403'
                      title: 'You are not authorized to perform this action'
                properties:
                  jsonapi:
                    type: object
                    properties:
                      version:
                        type: string
                        example: '1.1'
                  errors:
                    type: array
                    example:
                      - status: '403'
                        title: 'You are not authorized to perform this action'
                    items:
                      type: object
                      properties:
                        status:
                          type: string
                          example: '403'
                        title:
                          type: string
                          example: 'You are not authorized to perform this action'
        422:
          description: 'Validation failed'
          content:
            application/json:
              schema:
                type: object
                example:
                  jsonapi:
                    version: '1.1'
                  errors:
                    -
                      status: '422'
                      code: invalid_attribute
                      title: 'Invalid consumer creation'
                      detail: 'The first name field is required.'
                      source:
                        pointer: /data/attributes/first_name
                properties:
                  jsonapi:
                    type: object
                    properties:
                      version:
                        type: string
                        example: '1.1'
                  errors:
                    type: array
                    example:
                      -
                        status: '422'
                        code: invalid_attribute
                        title: 'Invalid consumer creation'
                        detail: 'The first name field is required.'
                        source:
                          pointer: /data/attributes/first_name
                    items:
                      type: object
                      properties:
                        status:
                          type: string
                          example: '422'
                        code:
                          type: string
                          example: invalid_attribute
                        title:
                          type: string
                          example: 'Invalid consumer creation'
                        detail:
                          type: string
                          example: 'The first name field is required.'
                        source:
                          type: object
                          properties:
                            pointer:
                              type: string
                              example: /data/attributes/first_name
      tags:
        - Consumers
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                data:
                  type: object
                  description: ''

                  properties:
                    attributes:
                      type: object
                      description: 'The consumers attributes for this request.'

                      properties:
                        organization_consumer_id:
                          type: string
                          description: 'Optional Organization-scoped consumer identifier. Repeated requests with the same value return the existing consumer unchanged.'
                          example: customer-12345
                          nullable: true
                        first_name:
                          type: string
                          description: "Consumer's first name."
                          example: Taylor
                        middle_name:
                          type: string
                          description: "Optional Consumer's middle name."

                          nullable: true
                        last_name:
                          type: string
                          description: "Consumer's last name."
                          example: Example
                        preferred_name:
                          type: string
                          description: "Optional Consumer's preferred name."

                          nullable: true
                        email:
                          type: string
                          description: "Optional Consumer's email address."

                          nullable: true
                        last_4_ssn:
                          type: string
                          description: "Optional Last four digits of the consumer's SSN."

                          nullable: true
                        date_of_birth:
                          type: date
                          description: "Optional Consumer's date of birth."

                          nullable: true
                      required:
                        - first_name
                        - last_name
                    type:
                      type: string
                      description: 'The JSON:API resource type.'
                      example: consumers
                  required:
                    - attributes
                    - type
              required:
                - data
    get:
      summary: 'List Consumers'
      operationId: listConsumers
      description: "Retrieves a paginated list of consumers.\n\nUse the documented query parameters for pagination, sorting, and filtering. The response uses\nthe `consumers` resource type and places consumer fields under `data.attributes`."
      parameters:
        -
          in: query
          name: page
          description: 'Optional page number.'

          required: false
          schema:
            type: integer
            description: 'Optional page number.'

            nullable: true
        -
          in: query
          name: per_page
          description: 'Optional page size. Min 1, max 100.'

          required: false
          schema:
            type: integer
            description: 'Optional page size. Min 1, max 100.'

            nullable: true
        -
          in: query
          name: sort_by
          description: 'Optional sort field. Allowed: last_updated.'

          required: false
          schema:
            type: string
            description: 'Optional sort field. Allowed: last_updated.'

            nullable: true
        -
          in: query
          name: sort_direction
          description: 'Optional sort direction. Allowed: asc, desc.'

          required: false
          schema:
            type: string
            description: 'Optional sort direction. Allowed: asc, desc.'

            nullable: true
        -
          in: query
          name: is_active
          description: 'Optional active status filter.'
          example: true
          required: false
          schema:
            type: boolean
            description: 'Optional active status filter.'
            example: true
            nullable: true
        -
          in: query
          name: last_updated_from
          description: 'Optional start date filter (Y-m-d).'

          required: false
          schema:
            type: string
            description: 'Optional start date filter (Y-m-d).'

            nullable: true
        -
          in: query
          name: last_updated_to
          description: 'Optional end date filter (Y-m-d).'

          required: false
          schema:
            type: string
            description: 'Optional end date filter (Y-m-d).'

            nullable: true
      responses:
        200:
          description: 'JSON:API success'
          content:
            application/json:
              schema:
                type: object
                example:
                  jsonapi:
                    version: '1.1'
                  links:
                    first: 'https://state.test/api/v1/consumers?page=1'
                    last: 'https://state.test/api/v1/consumers?page=1'
                    prev: null
                    next: null
                  meta:
                    current_page: 1
                    from: 1
                    last_page: 1
                    per_page: 15
                    to: 1
                    total: 1
                  data:
                    -
                      type: consumers
                      id: 8b9cfd33-ea53-4dae-bf77-20ba1b9ef108
                      attributes:
                        first_name: John
                        middle_name: null
                        last_name: Doe
                        preferred_name: null
                        email: john.doe@example.com
                        last_4_ssn: null
                        date_of_birth: null
                        last_updated: '2026-05-20T05:35:13.000000Z'
                properties:
                  jsonapi:
                    type: object
                    properties:
                      version:
                        type: string
                        example: '1.1'
                  links:
                    type: object
                    properties:
                      first:
                        type: string
                        example: 'https://state.test/api/v1/consumers?page=1'
                      last:
                        type: string
                        example: 'https://state.test/api/v1/consumers?page=1'
                      prev:
                        type: string

                        nullable: true
                      next:
                        type: string

                        nullable: true
                  meta:
                    type: object
                    properties:
                      current_page:
                        type: integer
                        example: 1
                      from:
                        type: integer
                        example: 1
                      last_page:
                        type: integer
                        example: 1
                      per_page:
                        type: integer
                        example: 15
                      to:
                        type: integer
                        example: 1
                      total:
                        type: integer
                        example: 1
                  data:
                    type: array
                    example:
                      -
                        type: consumers
                        id: 8b9cfd33-ea53-4dae-bf77-20ba1b9ef108
                        attributes:
                          first_name: John
                          middle_name: null
                          last_name: Doe
                          preferred_name: null
                          email: john.doe@example.com
                          last_4_ssn: null
                          date_of_birth: null
                          last_updated: '2026-05-20T05:35:13.000000Z'
                    items:
                      type: object
                      properties:
                        type:
                          type: string
                          example: consumers
                        id:
                          type: string
                          example: 8b9cfd33-ea53-4dae-bf77-20ba1b9ef108
                        attributes:
                          type: object
                          properties:
                            first_name:
                              type: string
                              example: John
                            middle_name:
                              type: string

                              nullable: true
                            last_name:
                              type: string
                              example: Doe
                            preferred_name:
                              type: string

                              nullable: true
                            email:
                              type: string
                              example: john.doe@example.com
                            last_4_ssn:
                              type: string

                              nullable: true
                            date_of_birth:
                              type: string

                              nullable: true
                            last_updated:
                              type: string
                              example: '2026-05-20T05:35:13.000000Z'
        401:
          description: 'User is not authenticated'
          content:
            application/json:
              schema:
                type: object
                example:
                  error:
                    status: 401
                    message: Unauthenticated.
                properties:
                  error:
                    type: object
                    properties:
                      status:
                        type: integer
                        example: 401
                      message:
                        type: string
                        example: Unauthenticated.
        403:
          description: 'User is missing list-users ability'
          content:
            application/json:
              schema:
                type: object
                example:
                  error:
                    status: 403
                    message: 'You are not authorized to perform this action'
                properties:
                  error:
                    type: object
                    properties:
                      status:
                        type: integer
                        example: 403
                      message:
                        type: string
                        example: 'You are not authorized to perform this action'
        500:
          description: 'Server error'
          content:
            application/json:
              schema:
                type: object
                example:
                  status: false
                  message: 'An unexpected error occurred while processing your request'
                  trace: []
                properties:
                  status:
                    type: boolean
                    example: false
                  message:
                    type: string
                    example: 'An unexpected error occurred while processing your request'
                  trace:
                    type: array
                    example: []
      tags:
        - Consumers
  '/api/v1/consumers/{consumer_id|account_id}':
    get:
      summary: 'Retrieve Consumer'
      operationId: retrieveConsumer
      description: "Retrieves a single consumer.\n\nUse the path identifier to resolve either a consumer ID or an account ID. The response uses\nthe `consumers` resource type and places consumer fields under `data.attributes`."
      parameters:
        -
          in: query
          name: include
          description: 'Optional comma-separated relationships. Allowed: addresses, accounts, discounts, emails, payments, phones.'

          required: false
          schema:
            type: string
            description: 'Optional comma-separated relationships. Allowed: addresses, accounts, discounts, emails, payments, phones.'

      responses:
        200:
          description: 'JSON:API success'
          content:
            application/json:
              schema:
                type: object
                example:
                  jsonapi:
                    version: '1.1'
                  data:
                    type: consumers
                    id: 8b9cfd33-ea53-4dae-bf77-20ba1b9ef108
                    attributes:
                      first_name: Taylor
                      middle_name: null
                      last_name: Example
                      preferred_name: null
                      email: taylor.example@example.test
                      is_active: true
                      created_at: '2026-01-02T09:00:00.000000Z'
                      updated_at: '2026-01-03T09:00:00.000000Z'
                properties:
                  jsonapi:
                    type: object
                    properties:
                      version:
                        type: string
                        example: '1.1'
                  data:
                    type: object
                    properties:
                      type:
                        type: string
                        example: consumers
                      id:
                        type: string
                        example: 8b9cfd33-ea53-4dae-bf77-20ba1b9ef108
                      attributes:
                        type: object
                        properties:
                          first_name:
                            type: string
                            example: Taylor
                          middle_name:
                            type: string

                            nullable: true
                          last_name:
                            type: string
                            example: Example
                          preferred_name:
                            type: string

                            nullable: true
                          email:
                            type: string
                            example: taylor.example@example.test
                          is_active:
                            type: boolean
                            example: true
                          created_at:
                            type: string
                            example: '2026-01-02T09:00:00.000000Z'
                          updated_at:
                            type: string
                            example: '2026-01-03T09:00:00.000000Z'
        400:
          description: 'Invalid include'
          content:
            application/json:
              schema:
                type: object
                example:
                  errors:
                    -
                      status: '400'
                      code: invalid_include
                      title: 'Invalid include parameter'
                      detail: 'Supported consumer includes are: addresses, accounts, discounts, emails, payments, phones.'
                properties:
                  errors:
                    type: array
                    example:
                      - status: '400'
                        code: invalid_include
                        title: 'Invalid include parameter'
                        detail: 'Supported consumer includes are: addresses, accounts, discounts, emails, payments, phones.'
                    items:
                      type: object
                      properties:
                        status:
                          type: string
                          example: '400'
                        code:
                          type: string
                          example: invalid_include
                        title:
                          type: string
                          example: 'Invalid include parameter'
                        detail:
                          type: string
                          example: 'Supported consumer includes are: addresses, accounts, discounts, emails, payments, phones.'
        401:
          description: 'User is not authenticated'
          content:
            application/json:
              schema:
                type: object
                example:
                  error:
                    status: 401
                    message: Unauthenticated.
                properties:
                  error:
                    type: object
                    properties:
                      status:
                        type: integer
                        example: 401
                      message:
                        type: string
                        example: Unauthenticated.
        403:
          description: 'User is missing privileges'
          content:
            application/json:
              schema:
                type: object
                example:
                  error:
                    status: 403
                    message: 'You are not authorized to perform this action'
                properties:
                  error:
                    type: object
                    properties:
                      status:
                        type: integer
                        example: 403
                      message:
                        type: string
                        example: 'You are not authorized to perform this action'
      tags:
        - Consumers
    parameters:
      -
        in: path
        name: consumer_id|account_id
        description: 'Either a consumer ID or an account ID.'
        example: fddd6ee5-d8b2-33c4-a981-c5d01c293f49
        required: true
        schema:
          type: string
  '/api/v1/consumers/{consumer_id}':
    patch:
      summary: 'Update Consumer'
      operationId: updateConsumer
      description: 'Updates the editable profile fields for a consumer.'
      parameters: []
      responses:
        200:
          description: 'JSON:API success'
          content:
            application/json:
              schema:
                type: object
                example:
                  jsonapi:
                    version: '1.1'
                  data:
                    type: consumers
                    id: 55112a2d-36d7-3446-b776-9f0663a9994a
                    attributes:
                      first_name: Taylor
                      middle_name: Morgan
                      last_name: Example
                      preferred_name: Tay
                      email: taylor@example.com
                      last_4_ssn: '1234'
                      date_of_birth: '1990-01-15'
                      last_updated: '2026-01-03T09:00:00.000000Z'
                properties:
                  jsonapi:
                    type: object
                    properties:
                      version:
                        type: string
                        example: '1.1'
                  data:
                    type: object
                    properties:
                      type:
                        type: string
                        example: consumers
                      id:
                        type: string
                        example: 55112a2d-36d7-3446-b776-9f0663a9994a
                      attributes:
                        type: object
                        properties:
                          first_name:
                            type: string
                            example: Taylor
                          middle_name:
                            type: string
                            example: Morgan
                          last_name:
                            type: string
                            example: Example
                          preferred_name:
                            type: string
                            example: Tay
                          email:
                            type: string
                            example: taylor@example.com
                          last_4_ssn:
                            type: string
                            example: '1234'
                          date_of_birth:
                            type: string
                            example: '1990-01-15'
                          last_updated:
                            type: string
                            example: '2026-01-03T09:00:00.000000Z'
        400:
          description: 'Invalid JSON:API document'
          content:
            application/json:
              schema:
                type: object
                example:
                  jsonapi:
                    version: '1.1'
                  errors:
                    -
                      status: '400'
                      code: invalid_resource_document
                      title: 'Invalid resource document'
                      detail: 'The JSON:API data.attributes member must be an object.'
                      source:
                        pointer: /data/attributes
                properties:
                  jsonapi:
                    type: object
                    properties:
                      version:
                        type: string
                        example: '1.1'
                  errors:
                    type: array
                    example:
                      -
                        status: '400'
                        code: invalid_resource_document
                        title: 'Invalid resource document'
                        detail: 'The JSON:API data.attributes member must be an object.'
                        source:
                          pointer: /data/attributes
                    items:
                      type: object
                      properties:
                        status:
                          type: string
                          example: '400'
                        code:
                          type: string
                          example: invalid_resource_document
                        title:
                          type: string
                          example: 'Invalid resource document'
                        detail:
                          type: string
                          example: 'The JSON:API data.attributes member must be an object.'
                        source:
                          type: object
                          properties:
                            pointer:
                              type: string
                              example: /data/attributes
        401:
          description: 'User is not authenticated'
          content:
            application/json:
              schema:
                type: object
                example:
                  jsonapi:
                    version: '1.1'
                  errors:
                    -
                      status: '401'
                      title: Unauthenticated.
                properties:
                  jsonapi:
                    type: object
                    properties:
                      version:
                        type: string
                        example: '1.1'
                  errors:
                    type: array
                    example:
                      - status: '401'
                        title: Unauthenticated.
                    items:
                      type: object
                      properties:
                        status:
                          type: string
                          example: '401'
                        title:
                          type: string
                          example: Unauthenticated.
        403:
          description: 'User is missing update-user ability'
          content:
            application/json:
              schema:
                type: object
                example:
                  jsonapi:
                    version: '1.1'
                  errors:
                    -
                      status: '403'
                      title: 'You are not authorized to perform this action'
                properties:
                  jsonapi:
                    type: object
                    properties:
                      version:
                        type: string
                        example: '1.1'
                  errors:
                    type: array
                    example:
                      - status: '403'
                        title: 'You are not authorized to perform this action'
                    items:
                      type: object
                      properties:
                        status:
                          type: string
                          example: '403'
                        title:
                          type: string
                          example: 'You are not authorized to perform this action'
        404:
          description: 'Consumer not found'
          content:
            application/json:
              schema:
                type: object
                example:
                  jsonapi:
                    version: '1.1'
                  errors:
                    -
                      status: '404'
                      title: 'Consumer not found'
                properties:
                  jsonapi:
                    type: object
                    properties:
                      version:
                        type: string
                        example: '1.1'
                  errors:
                    type: array
                    example:
                      - status: '404'
                        title: 'Consumer not found'
                    items:
                      type: object
                      properties:
                        status:
                          type: string
                          example: '404'
                        title:
                          type: string
                          example: 'Consumer not found'
        422:
          description: 'Validation failed'
          content:
            application/json:
              schema:
                type: object
                example:
                  jsonapi:
                    version: '1.1'
                  errors:
                    -
                      status: '422'
                      code: invalid_attribute
                      title: 'Invalid consumer update'
                      detail: 'The email field must be a valid email address.'
                      source:
                        pointer: /data/attributes/email
                properties:
                  jsonapi:
                    type: object
                    properties:
                      version:
                        type: string
                        example: '1.1'
                  errors:
                    type: array
                    example:
                      -
                        status: '422'
                        code: invalid_attribute
                        title: 'Invalid consumer update'
                        detail: 'The email field must be a valid email address.'
                        source:
                          pointer: /data/attributes/email
                    items:
                      type: object
                      properties:
                        status:
                          type: string
                          example: '422'
                        code:
                          type: string
                          example: invalid_attribute
                        title:
                          type: string
                          example: 'Invalid consumer update'
                        detail:
                          type: string
                          example: 'The email field must be a valid email address.'
                        source:
                          type: object
                          properties:
                            pointer:
                              type: string
                              example: /data/attributes/email
      tags:
        - Consumers
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                data:
                  type: object
                  description: ''

                  properties:
                    attributes:
                      type: object
                      description: 'The consumers attributes for this request.'

                      properties:
                        first_name:
                          type: string
                          description: "Optional Consumer's first name."
                          example: Taylor
                          nullable: true
                        middle_name:
                          type: string
                          description: "Optional Consumer's middle name."
                          example: Morgan
                          nullable: true
                        last_name:
                          type: string
                          description: "Optional Consumer's last name."
                          example: Example
                          nullable: true
                        preferred_name:
                          type: string
                          description: "Optional Consumer's preferred name."
                          example: Tay
                          nullable: true
                        email:
                          type: string
                          description: "Optional Consumer's email address."
                          example: taylor@example.com
                          nullable: true
                        last_4_ssn:
                          type: string
                          description: "Optional Last four digits of the consumer's SSN."
                          example: '1234'
                          nullable: true
                        date_of_birth:
                          type: date
                          description: "Optional Consumer's date of birth."
                          example: '1990-01-15'
                          nullable: true
                    type:
                      type: string
                      description: 'The JSON:API resource type.'
                      example: consumers
                    id:
                      type: string
                      description: 'The resource ID from the path.'
                      example: fddd6ee5-d8b2-33c4-a981-c5d01c293f49
                  required:
                    - attributes
                    - type
                    - id
              required:
                - data
    parameters:
      -
        in: path
        name: consumer_id
        description: 'The consumer ID to update.'
        example: fddd6ee5-d8b2-33c4-a981-c5d01c293f49
        required: true
        schema:
          type: string
  '/api/v1/consumers/{consumer_id}/addresses':
    post:
      summary: 'Create Consumer Address'
      operationId: createConsumerAddress
      description: 'Creates an address for a consumer.'
      parameters: []
      responses:
        201:
          description: 'JSON:API success'
          content:
            application/json:
              schema:
                type: object
                example:
                  jsonapi:
                    version: '1.1'
                  data:
                    type: addresses
                    id: d9352b9e-9a5a-4372-af65-f75e64d81b7e
                    attributes:
                      address_1: '123 Main Street'
                      address_2: 'Suite 200'
                      city: Austin
                      state_code: TX
                      country_code: US
                      postal_code: '78701'
                      type: home
                      is_primary: true
                      updated_at: '2026-07-21T10:00:00.000000Z'
                properties:
                  jsonapi:
                    type: object
                    properties:
                      version:
                        type: string
                        example: '1.1'
                  data:
                    type: object
                    properties:
                      type:
                        type: string
                        example: addresses
                      id:
                        type: string
                        example: d9352b9e-9a5a-4372-af65-f75e64d81b7e
                      attributes:
                        type: object
                        properties:
                          address_1:
                            type: string
                            example: '123 Main Street'
                          address_2:
                            type: string
                            example: 'Suite 200'
                          city:
                            type: string
                            example: Austin
                          state_code:
                            type: string
                            example: TX
                          country_code:
                            type: string
                            example: US
                          postal_code:
                            type: string
                            example: '78701'
                          type:
                            type: string
                            example: home
                          is_primary:
                            type: boolean
                            example: true
                          updated_at:
                            type: string
                            example: '2026-07-21T10:00:00.000000Z'
        401:
          description: 'User is not authenticated'
          content:
            application/json:
              schema:
                type: object
                example:
                  jsonapi:
                    version: '1.1'
                  errors:
                    -
                      status: '401'
                      title: Unauthenticated.
                properties:
                  jsonapi:
                    type: object
                    properties:
                      version:
                        type: string
                        example: '1.1'
                  errors:
                    type: array
                    example:
                      - status: '401'
                        title: Unauthenticated.
                    items:
                      type: object
                      properties:
                        status:
                          type: string
                          example: '401'
                        title:
                          type: string
                          example: Unauthenticated.
        403:
          description: 'User is missing update-user ability'
          content:
            application/json:
              schema:
                type: object
                example:
                  jsonapi:
                    version: '1.1'
                  errors:
                    -
                      status: '403'
                      title: 'You are not authorized to perform this action'
                properties:
                  jsonapi:
                    type: object
                    properties:
                      version:
                        type: string
                        example: '1.1'
                  errors:
                    type: array
                    example:
                      - status: '403'
                        title: 'You are not authorized to perform this action'
                    items:
                      type: object
                      properties:
                        status:
                          type: string
                          example: '403'
                        title:
                          type: string
                          example: 'You are not authorized to perform this action'
        404:
          description: 'Consumer not found'
          content:
            application/json:
              schema:
                type: object
                example:
                  jsonapi:
                    version: '1.1'
                  errors:
                    -
                      status: '404'
                      title: 'Consumer not found'
                properties:
                  jsonapi:
                    type: object
                    properties:
                      version:
                        type: string
                        example: '1.1'
                  errors:
                    type: array
                    example:
                      - status: '404'
                        title: 'Consumer not found'
                    items:
                      type: object
                      properties:
                        status:
                          type: string
                          example: '404'
                        title:
                          type: string
                          example: 'Consumer not found'
        422:
          description: 'Validation failed'
          content:
            application/json:
              schema:
                type: object
                example:
                  jsonapi:
                    version: '1.1'
                  errors:
                    -
                      status: '422'
                      code: invalid_attribute
                      title: 'Invalid address creation'
                      detail: 'The address 1 field is required.'
                      source:
                        pointer: /data/attributes/address_1
                properties:
                  jsonapi:
                    type: object
                    properties:
                      version:
                        type: string
                        example: '1.1'
                  errors:
                    type: array
                    example:
                      -
                        status: '422'
                        code: invalid_attribute
                        title: 'Invalid address creation'
                        detail: 'The address 1 field is required.'
                        source:
                          pointer: /data/attributes/address_1
                    items:
                      type: object
                      properties:
                        status:
                          type: string
                          example: '422'
                        code:
                          type: string
                          example: invalid_attribute
                        title:
                          type: string
                          example: 'Invalid address creation'
                        detail:
                          type: string
                          example: 'The address 1 field is required.'
                        source:
                          type: object
                          properties:
                            pointer:
                              type: string
                              example: /data/attributes/address_1
      tags:
        - Consumers
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                data:
                  type: object
                  description: ''

                  properties:
                    attributes:
                      type: object
                      description: 'The addresses attributes for this request.'

                      properties:
                        address_1:
                          type: string
                          description: 'First address line.'
                          example: '123 Main Street'
                        address_2:
                          type: string
                          description: 'Optional second address line.'

                          nullable: true
                        city:
                          type: string
                          description: City.
                          example: Austin
                        state_code:
                          type: string
                          description: 'Optional state or province code.'

                          nullable: true
                        country_code:
                          type: string
                          description: 'Optional ISO 3166-1 alpha-2 country code.'

                          nullable: true
                        postal_code:
                          type: string
                          description: 'Postal code.'
                          example: '78701'
                        type:
                          type: string
                          description: 'Optional address type. Allowed: mailing, billing, home. Defaults to mailing.'

                        is_primary:
                          type: boolean
                          description: 'Optional primary-address flag.'

                      required:
                        - address_1
                        - city
                        - postal_code
                    type:
                      type: string
                      description: 'The JSON:API resource type.'
                      example: addresses
                    id:
                      type: string
                      description: 'The resource ID from the path.'
                      example: fddd6ee5-d8b2-33c4-a981-c5d01c293f49
                  required:
                    - attributes
                    - type
                    - id
              required:
                - data
    parameters:
      -
        in: path
        name: consumer_id
        description: 'The consumer ID.'
        example: fddd6ee5-d8b2-33c4-a981-c5d01c293f49
        required: true
        schema:
          type: string
  '/api/v1/consumers/{consumer_id}/addresses/{address_id}':
    get:
      summary: 'Retrieve Consumer Address'
      operationId: retrieveConsumerAddress
      description: 'Retrieves one consumer address.'
      parameters: []
      responses:
        200:
          description: 'JSON:API success'
          content:
            application/json:
              schema:
                type: object
                example:
                  jsonapi:
                    version: '1.1'
                  data:
                    type: addresses
                    id: d9352b9e-9a5a-4372-af65-f75e64d81b7e
                    attributes:
                      address_1: '123 Main Street'
                      address_2: 'Suite 200'
                      city: Austin
                      state_code: TX
                      country_code: US
                      postal_code: '78701'
                      type: home
                      is_primary: true
                      updated_at: '2026-07-21T10:00:00.000000Z'
                properties:
                  jsonapi:
                    type: object
                    properties:
                      version:
                        type: string
                        example: '1.1'
                  data:
                    type: object
                    properties:
                      type:
                        type: string
                        example: addresses
                      id:
                        type: string
                        example: d9352b9e-9a5a-4372-af65-f75e64d81b7e
                      attributes:
                        type: object
                        properties:
                          address_1:
                            type: string
                            example: '123 Main Street'
                          address_2:
                            type: string
                            example: 'Suite 200'
                          city:
                            type: string
                            example: Austin
                          state_code:
                            type: string
                            example: TX
                          country_code:
                            type: string
                            example: US
                          postal_code:
                            type: string
                            example: '78701'
                          type:
                            type: string
                            example: home
                          is_primary:
                            type: boolean
                            example: true
                          updated_at:
                            type: string
                            example: '2026-07-21T10:00:00.000000Z'
        401:
          description: 'User is not authenticated'
          content:
            application/json:
              schema:
                type: object
                example:
                  jsonapi:
                    version: '1.1'
                  errors:
                    -
                      status: '401'
                      title: Unauthenticated.
                properties:
                  jsonapi:
                    type: object
                    properties:
                      version:
                        type: string
                        example: '1.1'
                  errors:
                    type: array
                    example:
                      - status: '401'
                        title: Unauthenticated.
                    items:
                      type: object
                      properties:
                        status:
                          type: string
                          example: '401'
                        title:
                          type: string
                          example: Unauthenticated.
        403:
          description: 'User is missing view-user ability'
          content:
            application/json:
              schema:
                type: object
                example:
                  jsonapi:
                    version: '1.1'
                  errors:
                    -
                      status: '403'
                      title: 'You are not authorized to perform this action'
                properties:
                  jsonapi:
                    type: object
                    properties:
                      version:
                        type: string
                        example: '1.1'
                  errors:
                    type: array
                    example:
                      - status: '403'
                        title: 'You are not authorized to perform this action'
                    items:
                      type: object
                      properties:
                        status:
                          type: string
                          example: '403'
                        title:
                          type: string
                          example: 'You are not authorized to perform this action'
        404:
          description: 'Address not found'
          content:
            application/json:
              schema:
                type: object
                example:
                  jsonapi:
                    version: '1.1'
                  errors:
                    -
                      status: '404'
                      title: 'Address not found'
                properties:
                  jsonapi:
                    type: object
                    properties:
                      version:
                        type: string
                        example: '1.1'
                  errors:
                    type: array
                    example:
                      - status: '404'
                        title: 'Address not found'
                    items:
                      type: object
                      properties:
                        status:
                          type: string
                          example: '404'
                        title:
                          type: string
                          example: 'Address not found'
      tags:
        - Consumers
    patch:
      summary: 'Update Consumer Address'
      operationId: updateConsumerAddress
      description: 'Updates a consumer address.'
      parameters: []
      responses:
        200:
          description: 'JSON:API success'
          content:
            application/json:
              schema:
                type: object
                example:
                  jsonapi:
                    version: '1.1'
                  data:
                    type: addresses
                    id: d9352b9e-9a5a-4372-af65-f75e64d81b7e
                    attributes:
                      address_1: '456 Congress Avenue'
                      address_2: 'Suite 300'
                      city: Austin
                      state_code: TX
                      country_code: US
                      postal_code: '78701'
                      type: work
                      is_primary: true
                      updated_at: '2026-07-21T10:00:00.000000Z'
                properties:
                  jsonapi:
                    type: object
                    properties:
                      version:
                        type: string
                        example: '1.1'
                  data:
                    type: object
                    properties:
                      type:
                        type: string
                        example: addresses
                      id:
                        type: string
                        example: d9352b9e-9a5a-4372-af65-f75e64d81b7e
                      attributes:
                        type: object
                        properties:
                          address_1:
                            type: string
                            example: '456 Congress Avenue'
                          address_2:
                            type: string
                            example: 'Suite 300'
                          city:
                            type: string
                            example: Austin
                          state_code:
                            type: string
                            example: TX
                          country_code:
                            type: string
                            example: US
                          postal_code:
                            type: string
                            example: '78701'
                          type:
                            type: string
                            example: work
                          is_primary:
                            type: boolean
                            example: true
                          updated_at:
                            type: string
                            example: '2026-07-21T10:00:00.000000Z'
        401:
          description: 'User is not authenticated'
          content:
            application/json:
              schema:
                type: object
                example:
                  jsonapi:
                    version: '1.1'
                  errors:
                    -
                      status: '401'
                      title: Unauthenticated.
                properties:
                  jsonapi:
                    type: object
                    properties:
                      version:
                        type: string
                        example: '1.1'
                  errors:
                    type: array
                    example:
                      - status: '401'
                        title: Unauthenticated.
                    items:
                      type: object
                      properties:
                        status:
                          type: string
                          example: '401'
                        title:
                          type: string
                          example: Unauthenticated.
        403:
          description: 'User is missing update-user ability'
          content:
            application/json:
              schema:
                type: object
                example:
                  jsonapi:
                    version: '1.1'
                  errors:
                    -
                      status: '403'
                      title: 'You are not authorized to perform this action'
                properties:
                  jsonapi:
                    type: object
                    properties:
                      version:
                        type: string
                        example: '1.1'
                  errors:
                    type: array
                    example:
                      - status: '403'
                        title: 'You are not authorized to perform this action'
                    items:
                      type: object
                      properties:
                        status:
                          type: string
                          example: '403'
                        title:
                          type: string
                          example: 'You are not authorized to perform this action'
        404:
          description: 'Address not found'
          content:
            application/json:
              schema:
                type: object
                example:
                  jsonapi:
                    version: '1.1'
                  errors:
                    -
                      status: '404'
                      title: 'Address not found'
                properties:
                  jsonapi:
                    type: object
                    properties:
                      version:
                        type: string
                        example: '1.1'
                  errors:
                    type: array
                    example:
                      - status: '404'
                        title: 'Address not found'
                    items:
                      type: object
                      properties:
                        status:
                          type: string
                          example: '404'
                        title:
                          type: string
                          example: 'Address not found'
        422:
          description: 'Validation failed'
          content:
            application/json:
              schema:
                type: object
                example:
                  jsonapi:
                    version: '1.1'
                  errors:
                    -
                      status: '422'
                      code: invalid_attribute
                      title: 'Invalid address update'
                      detail: 'The city field is required.'
                      source:
                        pointer: /data/attributes/city
                properties:
                  jsonapi:
                    type: object
                    properties:
                      version:
                        type: string
                        example: '1.1'
                  errors:
                    type: array
                    example:
                      -
                        status: '422'
                        code: invalid_attribute
                        title: 'Invalid address update'
                        detail: 'The city field is required.'
                        source:
                          pointer: /data/attributes/city
                    items:
                      type: object
                      properties:
                        status:
                          type: string
                          example: '422'
                        code:
                          type: string
                          example: invalid_attribute
                        title:
                          type: string
                          example: 'Invalid address update'
                        detail:
                          type: string
                          example: 'The city field is required.'
                        source:
                          type: object
                          properties:
                            pointer:
                              type: string
                              example: /data/attributes/city
      tags:
        - Consumers
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                data:
                  type: object
                  description: ''

                  properties:
                    attributes:
                      type: object
                      description: 'The addresses attributes for this request.'

                      properties:
                        address_1:
                          type: string
                          description: 'Optional first address line.'

                        address_2:
                          type: string
                          description: 'Optional second address line.'

                          nullable: true
                        city:
                          type: string
                          description: 'Optional city.'

                        state_code:
                          type: string
                          description: 'Optional state or province code.'

                          nullable: true
                        country_code:
                          type: string
                          description: 'Optional ISO 3166-1 alpha-2 country code.'

                          nullable: true
                        postal_code:
                          type: string
                          description: 'Optional postal code.'

                        type:
                          type: string
                          description: 'Optional address type. Allowed: mailing, billing, home.'

                        is_primary:
                          type: boolean
                          description: 'Optional primary-address flag.'

                    type:
                      type: string
                      description: 'The JSON:API resource type.'
                      example: addresses
                    id:
                      type: string
                      description: 'The resource ID from the path.'
                      example: d9352b9e-9a5a-4372-af65-f75e64d81b7e
                  required:
                    - attributes
                    - type
                    - id
              required:
                - data
    delete:
      summary: 'Delete Consumer Address'
      operationId: deleteConsumerAddress
      description: 'Deletes a consumer address.'
      parameters: []
      responses:
        204:
          description: 'Address deleted'
          content:
            text/plain:
              schema:
                type: string
                example: ''
        401:
          description: 'User is not authenticated'
          content:
            application/json:
              schema:
                type: object
                example:
                  jsonapi:
                    version: '1.1'
                  errors:
                    -
                      status: '401'
                      title: Unauthenticated.
                properties:
                  jsonapi:
                    type: object
                    properties:
                      version:
                        type: string
                        example: '1.1'
                  errors:
                    type: array
                    example:
                      - status: '401'
                        title: Unauthenticated.
                    items:
                      type: object
                      properties:
                        status:
                          type: string
                          example: '401'
                        title:
                          type: string
                          example: Unauthenticated.
        403:
          description: 'User is missing update-user ability'
          content:
            application/json:
              schema:
                type: object
                example:
                  jsonapi:
                    version: '1.1'
                  errors:
                    -
                      status: '403'
                      title: 'You are not authorized to perform this action'
                properties:
                  jsonapi:
                    type: object
                    properties:
                      version:
                        type: string
                        example: '1.1'
                  errors:
                    type: array
                    example:
                      - status: '403'
                        title: 'You are not authorized to perform this action'
                    items:
                      type: object
                      properties:
                        status:
                          type: string
                          example: '403'
                        title:
                          type: string
                          example: 'You are not authorized to perform this action'
        404:
          description: 'Address not found'
          content:
            application/json:
              schema:
                type: object
                example:
                  jsonapi:
                    version: '1.1'
                  errors:
                    -
                      status: '404'
                      title: 'Address not found'
                properties:
                  jsonapi:
                    type: object
                    properties:
                      version:
                        type: string
                        example: '1.1'
                  errors:
                    type: array
                    example:
                      - status: '404'
                        title: 'Address not found'
                    items:
                      type: object
                      properties:
                        status:
                          type: string
                          example: '404'
                        title:
                          type: string
                          example: 'Address not found'
      tags:
        - Consumers
    parameters:
      -
        in: path
        name: consumer_id
        description: 'The consumer ID.'
        example: fddd6ee5-d8b2-33c4-a981-c5d01c293f49
        required: true
        schema:
          type: string
      -
        in: path
        name: address_id
        description: 'The address ID.'
        example: d9352b9e-9a5a-4372-af65-f75e64d81b7e
        required: true
        schema:
          type: string
  /api/v1/dispute/create:
    post:
      summary: 'Create a Dispute'
      operationId: createADispute
      description: "This endpoint allows a user to create a dispute for a specific debt account.\nThe request requires an account number, a reason, and a description, with an optional document upload."
      parameters: []
      responses:
        200:
          description: 'No accounts found for given account_id'
          content:
            application/json:
              schema:
                type: object
                example:
                  status: true
                  message: 'No debts found'
                  data: []
                properties:
                  status:
                    type: boolean
                    example: true
                  message:
                    type: string
                    example: 'No debts found'
                  data:
                    type: array
                    example: []
        201:
          description: 'Dispute created successfully'
          content:
            application/json:
              schema:
                type: object
                example:
                  message: 'Dispute created successfully'
                  dispute:
                    uuid: bcXXXXXX-XXXX
                    user_debt_id: 1
                    dispute_reason: not_my_debt
                    dispute_description: 'This is my testing description'
                    dispute_uploaded_file: null
                    file_path: null
                    storage_disk: null
                    dispute_status: submitted
                    admin_notes: null
                    source: api
                    updated_at: '2025-09-29T11:24:07.000000Z'
                    created_at: '2025-09-29T11:24:07.000000Z'
                    debt:
                      uuid: 2aXXXXXX-XXXX
                      import_data_file_id: 1
                      payment_plan_id: null
                      consumer_id: a1b2c3d4-e5f6-7890-abcd-ef1234567890
                      account_id: TEST1
                      client:
                        client_name: Staging
                        client_identifier: Test-1
                        created_at: '2025-09-06T02:24:46.000000Z'
                        updated_at: '2025-09-06T02:24:46.000000Z'
                        company_client_rules_count: 0
                        has_rules: false
                        company_client_rules: []
                        discounts: []
                      discount: null
                      company:
                        company_name: TPS-BHG
                        url_slug: bhg
                        status_id: 1
                        created_at: '2025-09-06T02:12:32.000000Z'
                        updated_at: '2025-09-08T16:01:21.000000Z'
                        moov_account_id: 6bXXXXXX-XXXX
                        moov_wallet_id: 7yXXXX-XXXX
                        timezone: America/New_York
                        moov_descriptor: 'TPS-BHG '
                        company_rules:
                          -
                            rule_id: 2
                            value_json: 'false'
                            created_at: '2025-03-21T20:13:59.000000Z'
                            updated_at: '2025-06-23T23:10:07.000000Z'
                            value: false
                            rule:
                              name: use_amount_due_as_max_payment
                              description: 'Use "amount due" as the max allowed payment. When false use the current account balance amount.'
                              type: boolean
                              default_value_json: 'true'
                        discounts: []
                properties:
                  message:
                    type: string
                    example: 'Dispute created successfully'
                  dispute:
                    type: object
                    properties:
                      uuid:
                        type: string
                        example: bcXXXXXX-XXXX
                      user_debt_id:
                        type: integer
                        example: 1
                      dispute_reason:
                        type: string
                        example: not_my_debt
                      dispute_description:
                        type: string
                        example: 'This is my testing description'
                      dispute_uploaded_file:
                        type: string

                        nullable: true
                      file_path:
                        type: string

                        nullable: true
                      storage_disk:
                        type: string

                        nullable: true
                      dispute_status:
                        type: string
                        example: submitted
                      admin_notes:
                        type: string

                        nullable: true
                      source:
                        type: string
                        example: api
                      updated_at:
                        type: string
                        example: '2025-09-29T11:24:07.000000Z'
                      created_at:
                        type: string
                        example: '2025-09-29T11:24:07.000000Z'
                      debt:
                        type: object
                        properties:
                          uuid:
                            type: string
                            example: 2aXXXXXX-XXXX
                          import_data_file_id:
                            type: integer
                            example: 1
                          payment_plan_id:
                            type: string

                            nullable: true
                          consumer_id:
                            type: string
                            example: a1b2c3d4-e5f6-7890-abcd-ef1234567890
                          account_id:
                            type: string
                            example: TEST1
                          client:
                            type: object
                            properties:
                              client_name:
                                type: string
                                example: Staging
                              client_identifier:
                                type: string
                                example: Test-1
                              created_at:
                                type: string
                                example: '2025-09-06T02:24:46.000000Z'
                              updated_at:
                                type: string
                                example: '2025-09-06T02:24:46.000000Z'
                              company_client_rules_count:
                                type: integer
                                example: 0
                              has_rules:
                                type: boolean
                                example: false
                              company_client_rules:
                                type: array
                                example: []
                              discounts:
                                type: array
                                example: []
                          discount:
                            type: string

                            nullable: true
                          company:
                            type: object
                            properties:
                              company_name:
                                type: string
                                example: TPS-BHG
                              url_slug:
                                type: string
                                example: bhg
                              status_id:
                                type: integer
                                example: 1
                              created_at:
                                type: string
                                example: '2025-09-06T02:12:32.000000Z'
                              updated_at:
                                type: string
                                example: '2025-09-08T16:01:21.000000Z'
                              moov_account_id:
                                type: string
                                example: 6bXXXXXX-XXXX
                              moov_wallet_id:
                                type: string
                                example: 7yXXXX-XXXX
                              timezone:
                                type: string
                                example: America/New_York
                              moov_descriptor:
                                type: string
                                example: 'TPS-BHG '
                              company_rules:
                                type: array
                                example:
                                  -
                                    rule_id: 2
                                    value_json: 'false'
                                    created_at: '2025-03-21T20:13:59.000000Z'
                                    updated_at: '2025-06-23T23:10:07.000000Z'
                                    value: false
                                    rule:
                                      name: use_amount_due_as_max_payment
                                      description: 'Use "amount due" as the max allowed payment. When false use the current account balance amount.'
                                      type: boolean
                                      default_value_json: 'true'
                                items:
                                  type: object
                                  properties:
                                    rule_id:
                                      type: integer
                                      example: 2
                                    value_json:
                                      type: string
                                      example: 'false'
                                    created_at:
                                      type: string
                                      example: '2025-03-21T20:13:59.000000Z'
                                    updated_at:
                                      type: string
                                      example: '2025-06-23T23:10:07.000000Z'
                                    value:
                                      type: boolean
                                      example: false
                                    rule:
                                      type: object
                                      properties: { name: { type: string, example: use_amount_due_as_max_payment }, description: { type: string, example: 'Use "amount due" as the max allowed payment. When false use the current account balance amount.' }, type: { type: string, example: boolean }, default_value_json: { type: string, example: 'true' } }
                              discounts:
                                type: array
                                example: []
        403:
          description: 'Unauthorized user trying to dispute debt'
          content:
            application/json:
              schema:
                type: object
                example:
                  status: false
                  message: Unauthorized
                  data: []
                properties:
                  status:
                    type: boolean
                    example: false
                  message:
                    type: string
                    example: Unauthorized
                  data:
                    type: array
                    example: []
        422:
          description: 'Validation errors'
          content:
            application/json:
              schema:
                type: object
                example:
                  status: false
                  message: 'Validation Error'
                  error:
                    - 'The account number field is required.'
                    - 'Invalid dispute reason provided.'
                properties:
                  status:
                    type: boolean
                    example: false
                  message:
                    type: string
                    example: 'Validation Error'
                  error:
                    type: array
                    example:
                      - 'The account number field is required.'
                      - 'Invalid dispute reason provided.'
                    items:
                      type: string
        500:
          description: 'Internal Server Error'
          content:
            application/json:
              schema:
                type: object
                example:
                  error:
                    status: 500
                    message: 'Internal Server Error'
                properties:
                  error:
                    type: object
                    properties:
                      status:
                        type: integer
                        example: 500
                      message:
                        type: string
                        example: 'Internal Server Error'
      tags:
        - Accounts
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                account_id:
                  type: string
                  description: 'The account ID.'
                  example: '"TEST1"'
                reason:
                  type: string
                  description: 'The reason for dispute. Allowed values: "not_my_debt", "amount_wrong", "need_info", "other".'
                  example: '"not_my_debt"'
                description:
                  type: string
                  description: 'A description providing additional details for the dispute.'
                  example: 'Neque delectus rerum et impedit.'
                document:
                  type: string
                  format: binary
                  description: 'nullable An optional document file to support the dispute.'
              required:
                - account_id
                - reason
                - description
  '/api/v1/dispute/{id}':
    put:
      summary: 'Update a Dispute'
      operationId: updateADispute
      description: "This endpoint allows a user to update the reason and description of an existing dispute.\nThe request requires the dispute ID in the URL path, along with updated reason and description fields.\n\nPUT /api/v1/dispute/{id}"
      parameters: []
      responses:
        200:
          description: ''
          content:
            application/json:
              schema:
                oneOf:
                  -
                    description: 'Dispute updated successfully'
                    type: object
                    example:
                      status: true
                      message: 'Dispute updated successfully.'
                      data: []
                    properties:
                      status:
                        type: boolean
                        example: true
                      message:
                        type: string
                        example: 'Dispute updated successfully.'
                      data:
                        type: array
                        example: []
                  -
                    description: 'No dispute found for given ID'
                    type: object
                    example:
                      status: true
                      message: 'No dispute found to update'
                      data: []
                    properties:
                      status:
                        type: boolean
                        example: true
                      message:
                        type: string
                        example: 'No dispute found to update'
                      data:
                        type: array
                        example: []
        422:
          description: 'Validation errors'
          content:
            application/json:
              schema:
                type: object
                example:
                  status: false
                  message: 'Validation errors'
                  errors:
                    - 'The reason field is required.'
                    - 'The description field is required.'
                properties:
                  status:
                    type: boolean
                    example: false
                  message:
                    type: string
                    example: 'Validation errors'
                  errors:
                    type: array
                    example:
                      - 'The reason field is required.'
                      - 'The description field is required.'
                    items:
                      type: string
        500:
          description: 'Unexpected error'
          content:
            application/json:
              schema:
                type: object
                example:
                  status: false
                  message: 'Something went wrong'
                  errors: 'Exception message here'
                properties:
                  status:
                    type: boolean
                    example: false
                  message:
                    type: string
                    example: 'Something went wrong'
                  errors:
                    type: string
                    example: 'Exception message here'
      tags:
        - Accounts
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                data:
                  type: object
                  description: ''

                  properties:
                    attributes:
                      type: object
                      description: 'The disputes attributes for this request.'

                      properties:
                        reason:
                          type: string
                          description: 'The reason for dispute. Allowed values: "not_my_debt", "amount_wrong", "need_info", "other".'
                          example: '"amount_wrong"'
                        description:
                          type: string
                          description: 'A description providing additional details for the dispute.'
                          example: '"Updated description of dispute"'
                      required:
                        - reason
                        - description
                    type:
                      type: string
                      description: 'The JSON:API resource type.'
                      example: disputes
                  required:
                    - attributes
                    - type
              required:
                - data
    parameters:
      -
        in: path
        name: id
        description: 'The ID of the dispute to be updated.'
        example: 1
        required: true
        schema:
          type: integer
  /api/v1/accounts/purl:
    get:
      summary: 'Retrieve Portal Links'
      operationId: retrievePortalLinks
      description: "Returns payment links for the provided account IDs. Use a comma-separated\n`account_ids` query parameter with GET, or a JSON array with POST.\n\n### Request size and bulk processing\n\nThis is a synchronous lookup: it returns one payment link for each supplied account\nin the same response, with no batch or job created. Send at most 1,000 account IDs per\nrequest. Use GET for short, linkable requests; URL-length limits vary by client and proxy, so\nuse POST for larger lists.\n\n### Campaign tracking\n\nAdd any of the standard UTM fields below to attribute traffic to the payment links.\nEach supplied value is copied to every returned link and URL-encoded automatically.\nOnly the documented UTM fields are included; empty values are omitted, control characters\nare removed, and values are limited to 255 characters."
      parameters:
        -
          in: query
          name: account_ids
          description: 'Comma-separated account IDs for GET requests. Maximum 1,000 IDs.'
          example: '12345678,98765432'
          required: true
          schema:
            type: string
            description: 'Comma-separated account IDs for GET requests. Maximum 1,000 IDs.'
            example: '12345678,98765432'
        -
          in: query
          name: page
          description: 'Optional page number for JSON:API responses.'

          required: false
          schema:
            type: integer
            description: 'Optional page number for JSON:API responses.'

        -
          in: query
          name: per_page
          description: 'Optional page size for JSON:API responses. Min 1, max 100.'

          required: false
          schema:
            type: integer
            description: 'Optional page size for JSON:API responses. Min 1, max 100.'

        -
          in: query
          name: utm_source
          description: 'Optional traffic source, such as a search engine, publisher, or newsletter.'

          required: false
          schema:
            type: string
            description: 'Optional traffic source, such as a search engine, publisher, or newsletter.'

        -
          in: query
          name: utm_medium
          description: 'Optional marketing medium, such as cpc, email, or social.'

          required: false
          schema:
            type: string
            description: 'Optional marketing medium, such as cpc, email, or social.'

        -
          in: query
          name: utm_campaign
          description: 'Optional campaign name used to group a promotion.'

          required: false
          schema:
            type: string
            description: 'Optional campaign name used to group a promotion.'

        -
          in: query
          name: utm_term
          description: 'Optional paid-search keyword or audience term.'

          required: false
          schema:
            type: string
            description: 'Optional paid-search keyword or audience term.'

        -
          in: query
          name: utm_content
          description: 'Optional creative, placement, or call-to-action identifier.'

          required: false
          schema:
            type: string
            description: 'Optional creative, placement, or call-to-action identifier.'

      responses:
        200:
          description: 'JSON:API success'
          content:
            application/json:
              schema:
                type: object
                example:
                  jsonapi:
                    version: '1.1'
                  links:
                    first: 'https://state.test/api/v1/accounts/purl?account_ids=12345678%2C98765432&page=1'
                    last: 'https://state.test/api/v1/accounts/purl?account_ids=12345678%2C98765432&page=1'
                    prev: null
                    next: null
                  meta:
                    current_page: 1
                    from: 1
                    last_page: 1
                    per_page: 15
                    to: 2
                    total: 2
                  data:
                    -
                      type: payment-links
                      id: '12345678'
                      attributes:
                        account_id: '12345678'
                        url: 'https://acme.example/i/Ab3dEf'
                    -
                      type: payment-links
                      id: '98765432'
                      attributes:
                        account_id: '98765432'
                        url: 'https://acme.example/i/Zx91Qa'
                properties:
                  jsonapi:
                    type: object
                    properties:
                      version:
                        type: string
                        example: '1.1'
                  links:
                    type: object
                    properties:
                      first:
                        type: string
                        example: 'https://state.test/api/v1/accounts/purl?account_ids=12345678%2C98765432&page=1'
                      last:
                        type: string
                        example: 'https://state.test/api/v1/accounts/purl?account_ids=12345678%2C98765432&page=1'
                      prev:
                        type: string

                        nullable: true
                      next:
                        type: string

                        nullable: true
                  meta:
                    type: object
                    properties:
                      current_page:
                        type: integer
                        example: 1
                      from:
                        type: integer
                        example: 1
                      last_page:
                        type: integer
                        example: 1
                      per_page:
                        type: integer
                        example: 15
                      to:
                        type: integer
                        example: 2
                      total:
                        type: integer
                        example: 2
                  data:
                    type: array
                    example:
                      -
                        type: payment-links
                        id: '12345678'
                        attributes:
                          account_id: '12345678'
                          url: 'https://acme.example/i/Ab3dEf'
                      -
                        type: payment-links
                        id: '98765432'
                        attributes:
                          account_id: '98765432'
                          url: 'https://acme.example/i/Zx91Qa'
                    items:
                      type: object
                      properties:
                        type:
                          type: string
                          example: payment-links
                        id:
                          type: string
                          example: '12345678'
                        attributes:
                          type: object
                          properties:
                            account_id:
                              type: string
                              example: '12345678'
                            url:
                              type: string
                              example: 'https://acme.example/i/Ab3dEf'
        400:
          description: 'Invalid request'
          content:
            application/json:
              schema:
                type: object
                example:
                  jsonapi:
                    version: '1.1'
                  errors:
                    -
                      status: '400'
                      title: 'Validation errors'
                properties:
                  jsonapi:
                    type: object
                    properties:
                      version:
                        type: string
                        example: '1.1'
                  errors:
                    type: array
                    example:
                      - status: '400'
                        title: 'Validation errors'
                    items:
                      type: object
                      properties:
                        status:
                          type: string
                          example: '400'
                        title:
                          type: string
                          example: 'Validation errors'
        401:
          description: 'User is not authenticated'
          content:
            application/json:
              schema:
                type: object
                example:
                  jsonapi:
                    version: '1.1'
                  errors:
                    -
                      status: '401'
                      title: Unauthenticated.
                properties:
                  jsonapi:
                    type: object
                    properties:
                      version:
                        type: string
                        example: '1.1'
                  errors:
                    type: array
                    example:
                      - status: '401'
                        title: Unauthenticated.
                    items:
                      type: object
                      properties:
                        status:
                          type: string
                          example: '401'
                        title:
                          type: string
                          example: Unauthenticated.
        403:
          description: 'User is missing privileges'
          content:
            application/json:
              schema:
                type: object
                example:
                  jsonapi:
                    version: '1.1'
                  errors:
                    -
                      status: '403'
                      title: 'You are not authorized to perform this action'
                properties:
                  jsonapi:
                    type: object
                    properties:
                      version:
                        type: string
                        example: '1.1'
                  errors:
                    type: array
                    example:
                      - status: '403'
                        title: 'You are not authorized to perform this action'
                    items:
                      type: object
                      properties:
                        status:
                          type: string
                          example: '403'
                        title:
                          type: string
                          example: 'You are not authorized to perform this action'
      tags:
        - Accounts
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                data:
                  type: object
                  description: ''

                  properties:
                    attributes:
                      type: object
                      description: 'The accounts attributes for this request.'

                      properties:
                        account_ids:
                          type: array
                          description: 'JSON array of account IDs for POST requests. Maximum 1,000 IDs.'
                          example:
                            - '12345678'
                            - '98765432'
                          items:
                            type: string
                        utm_source:
                          type: string
                          description: 'Optional traffic source, such as a search engine, publisher, or newsletter.'

                        utm_medium:
                          type: string
                          description: 'Optional marketing medium, such as cpc, email, or social.'

                        utm_campaign:
                          type: string
                          description: 'Optional campaign name used to group a promotion.'

                        utm_term:
                          type: string
                          description: 'Optional paid-search keyword or audience term.'

                        utm_content:
                          type: string
                          description: 'Optional creative, placement, or call-to-action identifier.'

                      required:
                        - account_ids
                    type:
                      type: string
                      description: 'The JSON:API resource type.'
                      example: accounts
                  required:
                    - attributes
                    - type
              required:
                - data
  /api/v1/link/embed:
    post:
      summary: 'Create Embed Link'
      operationId: createEmbedLink
      description: 'Ingest an updated batch of accounts and generate a payment link for the seed account.'
      parameters: []
      responses:
        200:
          description: Success
          content:
            application/json:
              schema:
                type: object
                example:
                  message: 'Payment link created successfully.'
                  payment_link: 'https://tenant.test/link/7d5d2b92-24d1-4e9b-946d-9d62f83c86d1'
                properties:
                  message:
                    type: string
                    example: 'Payment link created successfully.'
                  payment_link:
                    type: string
                    example: 'https://tenant.test/link/7d5d2b92-24d1-4e9b-946d-9d62f83c86d1'
        422:
          description: 'Validation failed'
          content:
            application/json:
              schema:
                type: object
                example:
                  message: 'Validation failed.'
                  errors:
                    accounts:
                      - 'The accounts field is required.'
                properties:
                  message:
                    type: string
                    example: 'Validation failed.'
                  errors:
                    type: object
                    properties:
                      accounts:
                        type: array
                        example:
                          - 'The accounts field is required.'
                        items:
                          type: string
      tags:
        - Accounts
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                data:
                  type: object
                  description: ''

                  properties:
                    attributes:
                      type: object
                      description: 'The account-imports attributes for this request.'

                      properties:
                        seed:
                          type: string
                          description: 'Seed/group identifier for all accounts in the batch.'
                          example: '400'
                        user:
                          type: string
                          description: 'Agent or submitter identifier applied to each payload if not already present.'

                          nullable: true
                        accounts:
                          type: array
                          description: 'Collection of accounts to ingest.'
                          example:
                            -
                              account: '400'
                              RecipientName: 'JOHN SMITH'
                              Address1: '6 BAD OLE PUTTY CAT'
                              Address2: ROAD
                              City: MADISON
                              State: WI
                              Zip: '12345'
                              Balance: 60.0
                              RemoveAccount: ''
                              Client: TEST
                              ClientName: 'TEST ACCOUNT'
                              ConsumerAccount: 400-1234
                              ClientModel: ''
                              ClientAccountNumber: '77700315'
                              PatientName: 'SYLVESTER CAT'
                              DueDate: 04/30/2021
                              AdmitDate: ''
                              DischargeDate: ''
                              LastName: SMITH
                              Element1: '1234'
                              TotalDue: 53
                              PaymentTypeCode: ''
                              FEE: 'N'
                              Phase: '30'
                              RPDOB: 01/01/1901
                              RPPhone: ' '
                              DBEmail: jsmith@test.com
                              EmailApproval: ''
                              AGENCYOPTOUTPROCESS: 'N'
                              InitialBal: '33.00'
                              Disposition: 3SKP
                              RPTCLTGRP: KKTST3
                              ListDate: 02/18/2021
                          items:
                            type: object
                            properties:
                              account:
                                type: string
                                description: 'The external account identifier.'
                                example: '400'
                              RecipientName:
                                type: string
                                description: 'Name of the recipient.'
                                example: 'JOHN SMITH'
                              Address1:
                                type: string
                                description: 'Address line 1.'
                                example: '6 BAD OLE PUTTY CAT'
                              Address2:
                                type: string
                                description: 'Address line 2.'

                              City:
                                type: string
                                description: City.
                                example: MADISON
                              State:
                                type: string
                                description: State.
                                example: WI
                              Zip:
                                type: string
                                description: 'Zip code.'
                                example: '12345'
                              Balance:
                                type: number
                                description: 'Current balance.'
                                example: 60.0
                              RemoveAccount:
                                type: string
                                description: 'Flag to remove account.'

                              Client:
                                type: string
                                description: 'Client identifier.'

                              ClientName:
                                type: string
                                description: 'Client name.'

                              ConsumerAccount:
                                type: string
                                description: 'Consumer account number.'

                              ClientModel:
                                type: string
                                description: 'Client model.'

                              ClientAccountNumber:
                                type: string
                                description: 'Client account number.'

                              PatientName:
                                type: string
                                description: 'Patient name.'

                              DueDate:
                                type: string
                                description: 'Due date.'

                              AdmitDate:
                                type: string
                                description: 'Admit date.'

                              DischargeDate:
                                type: string
                                description: 'Discharge date.'

                              LastName:
                                type: string
                                description: 'Last name.'

                              Element1:
                                type: string
                                description: 'Custom element 1.'

                              TotalDue:
                                type: number
                                description: 'Total due amount.'

                              PaymentTypeCode:
                                type: string
                                description: 'Payment type code.'

                              FEE:
                                type: string
                                description: 'Fee indicator.'

                              Phase:
                                type: string
                                description: Phase.

                              RPDOB:
                                type: string
                                description: 'Responsible party DOB.'

                              RPPhone:
                                type: string
                                description: 'Responsible party phone.'

                              DBEmail:
                                type: string
                                description: 'Debtor email.'

                              EmailApproval:
                                type: string
                                description: 'Email approval.'

                              AGENCYOPTOUTPROCESS:
                                type: string
                                description: 'Agency opt out process.'

                              InitialBal:
                                type: string
                                description: 'Initial balance.'

                              Disposition:
                                type: string
                                description: 'Disposition code.'

                              RPTCLTGRP:
                                type: string
                                description: 'Report client group.'

                              ListDate:
                                type: string
                                description: 'List date.'

                            required:
                              - account
                              - RecipientName
                              - Address1
                              - City
                              - State
                              - Zip
                              - Balance
                      required:
                        - seed
                        - accounts
                    type:
                      type: string
                      description: 'The JSON:API resource type.'
                      example: account-imports
                  required:
                    - attributes
                    - type
              required:
                - data
  /api/v1/accounts:
    get:
      summary: 'List Accounts'
      operationId: listAccounts
      description: "Retrieves a paginated list of account records with advanced filtering and sorting capabilities.\n\nThis endpoint is designed for efficient querying of large debt datasets with comprehensive\nfiltering options and company-scoped access control.\n\n**Key Features**:\n- **Pagination**: Efficient pagination with configurable page size (default: 15, max: 100)\n- **Sorting**: Sort by allowed debt fields (amount, date, status, etc.) in ascending or descending order\n- **Filtering**: Multiple filter criteria including status, amounts, dates, user, client\n- **Calculated Fields**: All calculated fields included (amount_due_formatted, has_open_dispute, etc.)\n\n**Pagination Parameters**:\n- `page`: Page number (default: 1)\n- `per_page`: Records per page (default: 15, max: 100)\n\n**Sorting Parameters**:\n- `sort_by`: Field to sort by (id, account_id, group_reference, amount_due, original_amount_due, client_current_balance, status, date_due, debt_open_date, created_at, updated_at) (default: `created_at`)\n- `sort_direction`: Sort direction (`asc` or `desc`, default: `desc`)\n\n**Filter Parameters**:\n- `status`: Filter by debt status (e.g., \"active\", \"paid\", \"closed\")\n- `account_id`: Filter by public account ID (partial match)\n- `consumer_id`: Filter by consumer ID\n- `creditor_identifier`: Filter by creditor identifier\n- `in_plan`: Filter debts enrolled in payment plans (true/false)\n- `in_dispute`: Filter debts with active disputes (true/false)\n- `amount_due_min`: Minimum amount due in cents\n- `amount_due_max`: Maximum amount due in cents\n- `created_at_from`: Filter debts created on or after this date (Y-m-d)\n- `created_at_to`: Filter debts created on or before this date (Y-m-d)\n- `date_due_from`: Filter debts due on or after this date (Y-m-d)\n- `date_due_to`: Filter debts due on or before this date (Y-m-d)\n- `debt_open_date_from`: Filter debts opened on or after this date (Y-m-d)\n- `debt_open_date_to`: Filter debts opened on or before this date (Y-m-d)\n\n**Multi-tenancy**: Results are automatically filtered to the authenticated user's company.\nOnly debts within your company are returned.\n\n**Performance**: This endpoint uses database indexing and optimized queries to\nhandle large datasets.\n\n**Note**: All monetary values are in cents (USD). Use calculated field `amount_due_formatted`\nfor human-readable currency format.\n\n<aside class=\"warning\">Requires 'list-debts' ability. A 403 response indicates missing privileges.</aside>"
      parameters:
        -
          in: query
          name: page
          description: 'Page number for pagination.'

          required: false
          schema:
            type: integer
            description: 'Page number for pagination.'

            nullable: true
        -
          in: query
          name: per_page
          description: 'Number of records per page (max: 100).'

          required: false
          schema:
            type: integer
            description: 'Number of records per page (max: 100).'

            nullable: true
        -
          in: query
          name: sort_by
          description: 'Field to sort by (id, account_id, group_reference, creditor_account_number, amount_due, original_amount_due, client_current_balance, status, date_due, debt_open_date, created_at, updated_at).'

          required: false
          schema:
            type: string
            description: 'Field to sort by (id, account_id, group_reference, creditor_account_number, amount_due, original_amount_due, client_current_balance, status, date_due, debt_open_date, created_at, updated_at).'

            nullable: true
        -
          in: query
          name: sort_direction
          description: 'Sort direction (asc or desc).'

          required: false
          schema:
            type: string
            description: 'Sort direction (asc or desc).'

            nullable: true
        -
          in: query
          name: status
          description: 'Filter by debt status.'
          example: active
          required: false
          schema:
            type: string
            description: 'Filter by debt status.'
            example: active
            nullable: true
        -
          in: query
          name: client_debt_id
          description: ''
          example: CD-90904901
          required: false
          schema:
            type: string
            description: ''
            example: CD-90904901
            nullable: true
        -
          in: query
          name: client_id
          description: 'Must match an existing stored value.'
          example: 8
          required: false
          schema:
            type: integer
            description: 'Must match an existing stored value.'
            example: 8
            nullable: true
        -
          in: query
          name: in_plan
          description: 'Filter debts in payment plans (true or false).'
          example: false
          required: false
          schema:
            type: boolean
            description: 'Filter debts in payment plans (true or false).'
            example: false
            nullable: true
        -
          in: query
          name: in_dispute
          description: 'Filter debts with disputes (true or false).'
          example: false
          required: false
          schema:
            type: boolean
            description: 'Filter debts with disputes (true or false).'
            example: false
            nullable: true
        -
          in: query
          name: amount_due_min
          description: 'Minimum amount due in cents.'
          example: 222121717
          required: false
          schema:
            type: integer
            description: 'Minimum amount due in cents.'
            example: 222121717
            nullable: true
        -
          in: query
          name: amount_due_max
          description: 'Maximum amount due in cents.'
          example: 222121717
          required: false
          schema:
            type: integer
            description: 'Maximum amount due in cents.'
            example: 222121717
            nullable: true
        -
          in: query
          name: created_at_from
          description: 'date Filter debts created on or after this date (Y-m-d).'
          example: '2026-07-28'
          required: false
          schema:
            type: string
            description: 'date Filter debts created on or after this date (Y-m-d).'
            example: '2026-07-28'
            nullable: true
        -
          in: query
          name: created_at_to
          description: 'date Filter debts created on or before this date (Y-m-d).'
          example: '2026-07-28'
          required: false
          schema:
            type: string
            description: 'date Filter debts created on or before this date (Y-m-d).'
            example: '2026-07-28'
            nullable: true
        -
          in: query
          name: date_due_from
          description: 'date Filter debts due on or after this date (Y-m-d).'
          example: '2026-12-10'
          required: false
          schema:
            type: string
            description: 'date Filter debts due on or after this date (Y-m-d).'
            example: '2026-12-10'
            nullable: true
        -
          in: query
          name: date_due_to
          description: 'date Filter debts due on or before this date (Y-m-d).'
          example: '2026-12-10'
          required: false
          schema:
            type: string
            description: 'date Filter debts due on or before this date (Y-m-d).'
            example: '2026-12-10'
            nullable: true
        -
          in: query
          name: debt_open_date_from
          description: 'date Filter debts opened on or after this date (Y-m-d).'
          example: '2025-05-21'
          required: false
          schema:
            type: string
            description: 'date Filter debts opened on or after this date (Y-m-d).'
            example: '2025-05-21'
            nullable: true
        -
          in: query
          name: debt_open_date_to
          description: 'date Filter debts opened on or before this date (Y-m-d).'
          example: '2025-05-21'
          required: false
          schema:
            type: string
            description: 'date Filter debts opened on or before this date (Y-m-d).'
            example: '2025-05-21'
            nullable: true
        -
          in: query
          name: account_id
          description: 'Filter by public account ID (partial match).'

          required: false
          schema:
            type: string
            description: 'Filter by public account ID (partial match).'

        -
          in: query
          name: consumer_id
          description: 'Filter by consumer ID.'
          example: fddd6ee5-d8b2-33c4-a981-c5d01c293f49
          required: false
          schema:
            type: string
            description: 'Filter by consumer ID.'
            example: fddd6ee5-d8b2-33c4-a981-c5d01c293f49
        -
          in: query
          name: creditor_identifier
          description: 'Filter by creditor identifier.'

          required: false
          schema:
            type: string
            description: 'Filter by creditor identifier.'

      responses:
        200:
          description: 'Success with paginated results'
          content:
            application/json:
              schema:
                type: object
                example:
                  status: true
                  message: 'Debts retrieved successfully'
                  data:
                    current_page: 1
                    data:
                      -
                        uuid: a1b2c3d4-e5f6-7890-abcd-ef1234567890
                        consumer_id: a1b2c3d4-e5f6-7890-abcd-ef1234567890
                        account_id: JOY34R09
                        group_id: GROUP-001
                        client_debt_id: CLIJOY612
                        amount_due: 150000
                        undiscounted_amount_due: 150000
                        original_amount_due: 200000
                        client_initial_balance: 200000
                        client_current_balance: 150000
                        amount_due_formatted: '$1,500.00'
                        remaining_amount_due: 150000
                        remaining_current_balance: 150000
                        has_open_dispute: false
                        open_dispute_status: null
                        in_plan: false
                        in_dispute: false
                        can_charge_convenience_fee: true
                        status: active
                        debt_open_date: '2024-01-15'
                        date_due: '2024-06-30'
                        created_at: '2024-01-15T10:30:00.000000Z'
                        updated_at: '2024-05-01T14:22:00.000000Z'
                    first_page_url: 'http://example.com/api/v1/debts?page=1'
                    from: 1
                    last_page: 5
                    last_page_url: 'http://example.com/api/v1/debts?page=5'
                    links:
                      -
                        url: null
                        label: '&laquo; Previous'
                        active: false
                      -
                        url: 'https://staging.anteloope.com'
                        label: '1'
                        active: true
                      -
                        url: 'https://staging.anteloope.com'
                        label: '2'
                        active: false
                    next_page_url: 'http://example.com/api/v1/debts?page=2'
                    path: 'http://example.com/api/v1/debts'
                    per_page: 15
                    prev_page_url: null
                    to: 15
                    total: 73
                properties:
                  status:
                    type: boolean
                    example: true
                  message:
                    type: string
                    example: 'Debts retrieved successfully'
                  data:
                    type: object
                    properties:
                      current_page:
                        type: integer
                        example: 1
                      data:
                        type: array
                        example:
                          - uuid: a1b2c3d4-e5f6-7890-abcd-ef1234567890
                            consumer_id: a1b2c3d4-e5f6-7890-abcd-ef1234567890
                            account_id: JOY34R09
                            group_id: GROUP-001
                            client_debt_id: CLIJOY612
                            amount_due: 150000
                            undiscounted_amount_due: 150000
                            original_amount_due: 200000
                            client_initial_balance: 200000
                            client_current_balance: 150000
                            amount_due_formatted: '$1,500.00'
                            remaining_amount_due: 150000
                            remaining_current_balance: 150000
                            has_open_dispute: false
                            open_dispute_status: null
                            in_plan: false
                            in_dispute: false
                            can_charge_convenience_fee: true
                            status: active
                            debt_open_date: '2024-01-15'
                            date_due: '2024-06-30'
                            created_at: '2024-01-15T10:30:00.000000Z'
                            updated_at: '2024-05-01T14:22:00.000000Z'
                        items:
                          type: object
                          properties:
                            uuid:
                              type: string
                              example: a1b2c3d4-e5f6-7890-abcd-ef1234567890
                            consumer_id:
                              type: string
                              example: a1b2c3d4-e5f6-7890-abcd-ef1234567890
                            account_id:
                              type: string
                              example: JOY34R09
                            group_id:
                              type: string
                              example: GROUP-001
                            client_debt_id:
                              type: string
                              example: CLIJOY612
                            amount_due:
                              type: integer
                              example: 150000
                            undiscounted_amount_due:
                              type: integer
                              example: 150000
                            original_amount_due:
                              type: integer
                              example: 200000
                            client_initial_balance:
                              type: integer
                              example: 200000
                            client_current_balance:
                              type: integer
                              example: 150000
                            amount_due_formatted:
                              type: string
                              example: '$1,500.00'
                            remaining_amount_due:
                              type: integer
                              example: 150000
                            remaining_current_balance:
                              type: integer
                              example: 150000
                            has_open_dispute:
                              type: boolean
                              example: false
                            open_dispute_status:
                              type: string

                              nullable: true
                            in_plan:
                              type: boolean
                              example: false
                            in_dispute:
                              type: boolean
                              example: false
                            can_charge_convenience_fee:
                              type: boolean
                              example: true
                            status:
                              type: string
                              example: active
                            debt_open_date:
                              type: string
                              example: '2024-01-15'
                            date_due:
                              type: string
                              example: '2024-06-30'
                            created_at:
                              type: string
                              example: '2024-01-15T10:30:00.000000Z'
                            updated_at:
                              type: string
                              example: '2024-05-01T14:22:00.000000Z'
                      first_page_url:
                        type: string
                        example: 'http://example.com/api/v1/debts?page=1'
                      from:
                        type: integer
                        example: 1
                      last_page:
                        type: integer
                        example: 5
                      last_page_url:
                        type: string
                        example: 'http://example.com/api/v1/debts?page=5'
                      links:
                        type: array
                        example:
                          - url: null
                            label: '&laquo; Previous'
                            active: false
                          - url: 'http://example.com/api/v1/debts?page=1'
                            label: '1'
                            active: true
                          - url: 'http://example.com/api/v1/debts?page=2'
                            label: '2'
                            active: false
                        items:
                          type: object
                          properties:
                            url:
                              type: string

                              nullable: true
                            label:
                              type: string
                              example: '&laquo; Previous'
                            active:
                              type: boolean
                              example: false
                      next_page_url:
                        type: string
                        example: 'http://example.com/api/v1/debts?page=2'
                      path:
                        type: string
                        example: 'http://example.com/api/v1/debts'
                      per_page:
                        type: integer
                        example: 15
                      prev_page_url:
                        type: string

                        nullable: true
                      to:
                        type: integer
                        example: 15
                      total:
                        type: integer
                        example: 73
        400:
          description: 'Validation failed'
          content:
            application/json:
              schema:
                type: object
                example:
                  status: false
                  message: 'Validation errors'
                  errors:
                    - 'Please choose a valid sort field: id, account_id, group_reference, amount_due, original_amount_due, client_current_balance, status, date_due, debt_open_date, created_at, or updated_at.'
                properties:
                  status:
                    type: boolean
                    example: false
                  message:
                    type: string
                    example: 'Validation errors'
                  errors:
                    type: array
                    example:
                      - 'Please choose a valid sort field: id, account_id, group_reference, amount_due, original_amount_due, client_current_balance, status, date_due, debt_open_date, created_at, or updated_at.'
                    items:
                      type: string
        401:
          description: 'User is not authenticated'
          content:
            application/json:
              schema:
                type: object
                example:
                  error:
                    status: 401
                    message: Unauthenticated.
                properties:
                  error:
                    type: object
                    properties:
                      status:
                        type: integer
                        example: 401
                      message:
                        type: string
                        example: Unauthenticated.
        403:
          description: "User is missing 'list-debts' ability"
          content:
            application/json:
              schema:
                type: object
                example:
                  error:
                    status: 403
                    message: 'You are not authorized to perform this action'
                properties:
                  error:
                    type: object
                    properties:
                      status:
                        type: integer
                        example: 403
                      message:
                        type: string
                        example: 'You are not authorized to perform this action'
        500:
          description: 'Server error'
          content:
            application/json:
              schema:
                type: object
                example:
                  status: false
                  message: 'An unexpected error occurred while processing your request'
                  trace: []
                properties:
                  status:
                    type: boolean
                    example: false
                  message:
                    type: string
                    example: 'An unexpected error occurred while processing your request'
                  trace:
                    type: array
                    example: []
      tags:
        - Accounts
    post:
      summary: 'Create Account'
      operationId: createAccount
      description: 'Creates an account for Consumer and Creditor. If the consumer or creditor does not exist, they will be created.'
      parameters:
        -
          in: header
          name: Idempotency-Key
          description: ''
          example: 'string optional A unique key used to safely retry the same provisioning request. When omitted, the request is processed normally without replay protection.'
          schema:
            type: string
      responses:
        201:
          description: 'Account provisioned'
          content:
            application/json:
              schema:
                type: object
                example:
                  jsonapi:
                    version: '1.1'
                  data:
                    type: accounts
                    id: ACCT-10042
                    attributes:
                      account_id: ACCT-10042
                      account_group_id: GROUP-001
                      creditor_account_id: HCP-8841
                      amount_due: 125000
                      currency: USD
                      status: active
                properties:
                  jsonapi:
                    type: object
                    properties:
                      version:
                        type: string
                        example: '1.1'
                  data:
                    type: object
                    properties:
                      type:
                        type: string
                        example: accounts
                      id:
                        type: string
                        example: ACCT-10042
                      attributes:
                        type: object
                        properties:
                          account_id:
                            type: string
                            example: ACCT-10042
                          account_group_id:
                            type: string
                            example: GROUP-001
                          creditor_account_id:
                            type: string
                            example: HCP-8841
                          amount_due:
                            type: integer
                            example: 125000
                          currency:
                            type: string
                            example: USD
                          status:
                            type: string
                            example: active
        409:
          description: 'Idempotency or creditor conflict'
          content:
            application/json:
              schema:
                type: object
                example:
                  jsonapi:
                    version: '1.1'
                  errors:
                    -
                      status: '409'
                      code: account_provisioning_conflict
                      title: 'Account provisioning conflict'
                properties:
                  jsonapi:
                    type: object
                    properties:
                      version:
                        type: string
                        example: '1.1'
                  errors:
                    type: array
                    example:
                      - status: '409'
                        code: account_provisioning_conflict
                        title: 'Account provisioning conflict'
                    items:
                      type: object
                      properties:
                        status:
                          type: string
                          example: '409'
                        code:
                          type: string
                          example: account_provisioning_conflict
                        title:
                          type: string
                          example: 'Account provisioning conflict'
      tags:
        - Accounts
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                data:
                  type: object
                  description: ''

                  properties:
                    attributes:
                      type: object
                      description: 'The accounts attributes for this request.'

                      properties:
                        account_id:
                          type: string
                          description: 'The public account ID.'
                          example: ACCT-10042
                        account_group_id:
                          type: string
                          description: 'Optional Group or seed reference.'

                        creditor_account_id:
                          type: string
                          description: 'Optional Creditor-side account ID.'

                        amount_due_cents:
                          type: integer
                          description: 'Account amount due in cents.'
                          example: 125000
                        initial_balance_cents:
                          type: integer
                          description: 'Optional Initial balance in cents. Defaults to amount_due_cents.'

                        current_balance_cents:
                          type: integer
                          description: 'Optional Current balance in cents. Defaults to amount_due_cents.'

                        status:
                          type: string
                          description: 'Account status: active, legal, or removed.'
                          example: active
                        date_due:
                          type: string
                          description: 'Must be a valid date.'

                          nullable: true
                        date_open:
                          type: date
                          description: 'Optional account opening date.'

                        allow_convenience_fee:
                          type: boolean
                          description: 'Optional Whether a convenience fee may be charged.'

                        portal_redirect:
                          type: boolean
                          description: 'Optional Whether to redirect this account to the portal.'

                        consumer:
                          type: object
                          description: ''
                          example:
                            organization_consumer_id: consumer-10042
                            first_name: Taylor
                            middle_name: Morgan
                            last_name: Example
                            preferred_name: Tay
                            email: taylor@example.com
                            last_4_ssn: '1234'
                            date_of_birth: '1990-01-15'
                            phone: '+12175550123'
                            addresses:
                              - address_1: '123 Main Street'
                                city: Springfield
                                state: IL
                                postal_code: '62701'
                                country_code: US
                          properties:
                            id:
                              type: string
                              description: 'Optional existing consumer UUID.'

                            organization_consumer_id:
                              type: string
                              description: 'Must not be greater than 255 characters.'
                              example: consumer-10042
                              nullable: true
                            first_name:
                              type: string
                              description: 'Required when consumer ID is omitted.'
                              example: Taylor
                            middle_name:
                              type: string
                              description: 'Must not be greater than 255 characters.'
                              example: Morgan
                              nullable: true
                            last_name:
                              type: string
                              description: 'Required when consumer ID is omitted.'
                              example: Example
                            preferred_name:
                              type: string
                              description: 'Must not be greater than 255 characters.'
                              example: Tay
                              nullable: true
                            email:
                              type: string
                              description: 'Must be a valid email address. Must not be greater than 255 characters.'
                              example: taylor@example.com
                              nullable: true
                            last_4_ssn:
                              type: string
                              description: 'Required when consumer ID is omitted.'
                              example: '1234'
                            date_of_birth:
                              type: date
                              description: 'Required when consumer ID is omitted.'
                              example: '1990-01-15'
                            phone:
                              type: string
                              description: 'Must not be greater than 255 characters.'
                              example: '+12175550123'
                              nullable: true
                            addresses:
                              type: array
                              description: 'Optional consumer addresses. Every supplied address is ingested.'
                              example:
                                - address_1: '123 Main Street'
                                  city: Springfield
                                  state: IL
                                  postal_code: '62701'
                                  country_code: US
                              items:
                                type: string
                        creditor:
                          type: object
                          description: ''
                          example:
                            id: HCP-ABC-001
                            name: 'Healthcare Provider ABC'
                          properties:
                            id:
                              type: string
                              description: 'Creditor ID within this organization.'
                              example: HCP-ABC-001
                            name:
                              type: string
                              description: 'Required when the creditor ID does not exist.'

                          required:
                            - id
                      required:
                        - account_id
                        - amount_due_cents
                        - status
                        - consumer
                        - creditor
                    type:
                      type: string
                      description: 'Type for this request.'
                      example: accounts
                  required:
                    - attributes
                    - type
              required:
                - data
  '/api/v1/accounts/{account_id|creditor_account_id}':
    get:
      summary: 'Retrieve Account'
      operationId: retrieveAccount
      description: 'Retrieves one account using its public account ID or creditor account number.'
      parameters: []
      responses:
        200:
          description: 'JSON:API success'
          content:
            application/json:
              schema:
                type: object
                example:
                  jsonapi:
                    version: '1.1'
                  data:
                    type: accounts
                    id: DOCS-1001
                    attributes:
                      account_id: DOCS-1001
                      account_group_id: GROUP-001
                      creditor_account_id: CLI-1001
                      amount_due: 150000
                      currency: USD
                      status: active
                      date_due: '2026-06-30'
                      in_payment_plan: false
                      in_dispute: false
                      last_updated: '2026-05-01T14:22:00.000000Z'
                properties:
                  jsonapi:
                    type: object
                    properties:
                      version:
                        type: string
                        example: '1.1'
                  data:
                    type: object
                    properties:
                      type:
                        type: string
                        example: accounts
                      id:
                        type: string
                        example: DOCS-1001
                      attributes:
                        type: object
                        properties:
                          account_id:
                            type: string
                            example: DOCS-1001
                          account_group_id:
                            type: string
                            example: GROUP-001
                          creditor_account_id:
                            type: string
                            example: CLI-1001
                          amount_due:
                            type: integer
                            example: 150000
                          currency:
                            type: string
                            example: USD
                          status:
                            type: string
                            example: active
                          date_due:
                            type: string
                            example: '2026-06-30'
                          in_payment_plan:
                            type: boolean
                            example: false
                          in_dispute:
                            type: boolean
                            example: false
                          last_updated:
                            type: string
                            example: '2026-05-01T14:22:00.000000Z'
        401:
          description: 'User is not authenticated'
          content:
            application/json:
              schema:
                type: object
                example:
                  jsonapi:
                    version: '1.1'
                  errors:
                    -
                      status: '401'
                      title: Unauthenticated.
                properties:
                  jsonapi:
                    type: object
                    properties:
                      version:
                        type: string
                        example: '1.1'
                  errors:
                    type: array
                    example:
                      - status: '401'
                        title: Unauthenticated.
                    items:
                      type: object
                      properties:
                        status:
                          type: string
                          example: '401'
                        title:
                          type: string
                          example: Unauthenticated.
        403:
          description: 'User is missing view-debts ability'
          content:
            application/json:
              schema:
                type: object
                example:
                  jsonapi:
                    version: '1.1'
                  errors:
                    -
                      status: '403'
                      title: 'You are not authorized to perform this action'
                properties:
                  jsonapi:
                    type: object
                    properties:
                      version:
                        type: string
                        example: '1.1'
                  errors:
                    type: array
                    example:
                      - status: '403'
                        title: 'You are not authorized to perform this action'
                    items:
                      type: object
                      properties:
                        status:
                          type: string
                          example: '403'
                        title:
                          type: string
                          example: 'You are not authorized to perform this action'
        404:
          description: 'Account not found'
          content:
            application/json:
              schema:
                type: object
                example:
                  jsonapi:
                    version: '1.1'
                  errors:
                    -
                      status: '404'
                      title: 'Account not found'
                      detail: 'No account was found with the provided identifier.'
                properties:
                  jsonapi:
                    type: object
                    properties:
                      version:
                        type: string
                        example: '1.1'
                  errors:
                    type: array
                    example:
                      - status: '404'
                        title: 'Account not found'
                        detail: 'No account was found with the provided identifier.'
                    items:
                      type: object
                      properties:
                        status:
                          type: string
                          example: '404'
                        title:
                          type: string
                          example: 'Account not found'
                        detail:
                          type: string
                          example: 'No account was found with the provided identifier.'
      tags:
        - Accounts
    parameters:
      -
        in: path
        name: account_id|creditor_account_id
        description: 'Either a public account ID or a creditor account ID.'
        example: DOCS-1001
        required: true
        schema:
          type: string
  '/api/v1/accounts/{id}':
    put:
      summary: 'Update Debt'
      operationId: updateDebt
      description: "Updates an existing user debt record in the system by its ID.\nThe record must already exist, and the request must pass validation rules\nfor updatable fields such as `original_balance`, `account_status`.\n\nIf the record does not exist, a 404 error will be returned.\nOn success, the updated User Debt record is returned in the response."
      parameters: []
      responses:
        200:
          description: 'Debt updated successfully'
          content:
            text/plain:
              schema:
                type: string
                example: "{\n  \"status\": true,\n  \"message\": \"Success\",\n  \"data\": {\n    \"uuid\": \"xxxx-xxxx-xxxx\",\n    \"consumer_id\": \"a1b2c3d4-e5f6-7890-abcd-ef1234567890\",\n    \"account_id\": \"EXT12345\",\n    \"amount_due\": 1500,\n    \"undiscounted_amount_due\": 2000,\n    \"client_id\": 7,\n    \"status\": \"active\",\n    ...\n  }\n}"
        400:
          description: 'Validation failed'
          content:
            text/plain:
              schema:
                type: string
                example: "{\n  \"status\": false,\n  \"message\": \"Validation Error\",\n  \"errors\": {\n    \"The original balance field is required.\",\n    \"The account status field is required.\",\n    \"The current balance field must be a number.\",\n     ...\n  }\n}"
        500:
          description: 'Unexpected error'
          content:
            application/json:
              schema:
                type: object
                example:
                  status: false
                  message: 'Something went wrong'
                  errors: 'Exception message here'
                properties:
                  status:
                    type: boolean
                    example: false
                  message:
                    type: string
                    example: 'Something went wrong'
                  errors:
                    type: string
                    example: 'Exception message here'
      tags:
        - Accounts
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                data:
                  type: object
                  description: ''

                  properties:
                    attributes:
                      type: object
                      description: 'The accounts attributes for this request.'

                      properties:
                        past_due:
                          type: numeric
                          description: 'Optional The past due amount of the debt.'

                          nullable: true
                        current_balance:
                          type: numeric
                          description: 'Optional The current balance of the debt.'

                          nullable: true
                        payment_amount:
                          type: numeric
                          description: 'Optional The payment amount applied to the debt.'

                          nullable: true
                        original_balance:
                          type: numeric
                          description: 'Required The initial total balance of the client.'

                        account_status:
                          type: string
                          description: 'Required The status of the debt. Allowed values: "Active", "Closed", "Pending".'

                        addresses:
                          type: array
                          description: 'Optional A list of addresses associated with the user.'

                          items:
                            type: string
                        phones:
                          type: array
                          description: 'Optional A list of phone numbers associated with the user.'

                          items:
                            type: string
                        emails:
                          type: array
                          description: 'Optional A list of email addresses associated with the user.'

                          items:
                            type: string
                    type:
                      type: string
                      description: 'The JSON:API resource type.'
                      example: accounts
                  required:
                    - attributes
                    - type
              required:
                - data
    parameters:
      -
        in: path
        name: id
        description: 'The ID of the User Debt to update.'
        example: 11
        required: true
        schema:
          type: integer
  /api/v1/payments:
    get:
      summary: 'List Payments'
      operationId: listPayments
      description: "Retrieves a paginated list of payments available to the authenticated organization.\n\nUse `account_id` to restrict the results to an account and its group. Other filters may be\ncombined with pagination to narrow the organization-wide collection."
      parameters:
        -
          in: query
          name: page
          description: 'Optional page number.'
          example: 1
          required: false
          schema:
            type: integer
            description: 'Optional page number.'
            example: 1
        -
          in: query
          name: per_page
          description: 'Optional page size. Min 1, max 100.'
          example: 15
          required: false
          schema:
            type: integer
            description: 'Optional page size. Min 1, max 100.'
            example: 15
        -
          in: query
          name: account_id
          description: 'Optional account ID filter. Includes payments for its account group.'
          example: '1555887746'
          required: false
          schema:
            type: string
            description: 'Optional account ID filter. Includes payments for its account group.'
            example: '1555887746'
        -
          in: query
          name: payment_id
          description: 'Filter by specific payment ID.'
          example: '14000000008'
          required: false
          schema:
            type: string
            description: 'Filter by specific payment ID.'
            example: '14000000008'
        -
          in: query
          name: processor_id
          description: 'Filter by specific payment processor ID.'
          example: 34bb6634-64db-3ceb-a6b7-e892138d9057
          required: false
          schema:
            type: string
            description: 'Filter by specific payment processor ID.'
            example: 34bb6634-64db-3ceb-a6b7-e892138d9057
        -
          in: query
          name: type
          description: "Filter by payment type. Options: 'history', 'future'."

          required: false
          schema:
            type: string
            description: "Filter by payment type. Options: 'history', 'future'."

        -
          in: query
          name: status
          description: 'Filter by payment status label. Options: Unsubmitted, Queued, Pending, Approved, Completed, Canceled, Failed, Reversed, Scheduled, Processing, Dispute Pending, Disputed, Refund Pending, Refunded, Awaiting Payment.'
          example: approved
          required: false
          schema:
            type: string
            description: 'Filter by payment status label. Options: Unsubmitted, Queued, Pending, Approved, Completed, Canceled, Failed, Reversed, Scheduled, Processing, Dispute Pending, Disputed, Refund Pending, Refunded, Awaiting Payment.'
            example: approved
        -
          in: query
          name: from
          description: 'date Filter payments on or after this date (Y-m-d).'
          example: '2026-07-03'
          required: false
          schema:
            type: string
            description: 'date Filter payments on or after this date (Y-m-d).'
            example: '2026-07-03'
        -
          in: query
          name: until
          description: 'date Filter payments on or before this date (Y-m-d).'
          example: '2026-07-03'
          required: false
          schema:
            type: string
            description: 'date Filter payments on or before this date (Y-m-d).'
            example: '2026-07-03'
      responses:
        200:
          description: 'JSON:API success'
          content:
            application/json:
              schema:
                type: object
                example:
                  jsonapi:
                    version: '1.1'
                  links:
                    first: 'https://state.test/api/v1/payments?page=1'
                    last: 'https://state.test/api/v1/payments?page=1'
                    prev: null
                    next: null
                  meta:
                    current_page: 1
                    from: 1
                    last_page: 1
                    per_page: 15
                    to: 1
                    total: 1
                  data:
                    -
                      type: payments
                      id: '1001'
                      attributes:
                        processor_id: txn_123456
                        payment_method_id: pm_123456
                        account_id: '12345678'
                        status: Completed
                        status_description: 'Payment successfully processed'
                        amount_cents: 10000
                        debt_applied_amount_cents: 10000
                        convenience_fee_amount_cents: 0
                        charged_amount_cents: 10000
                        payment_date: '2023-10-01T12:00:00Z'
                        created_date: '2023-10-01T12:00:00Z'
                        failed_date: null
                        completed_date: '2023-10-01T12:05:00Z'
                        receipt_email: user@example.com
                        in_plan: true
                        batch_id: SWEEP-001
                        utm_tracking:
                          utm_source: newsletter
                          utm_medium: email
                properties:
                  jsonapi:
                    type: object
                    properties:
                      version:
                        type: string
                        example: '1.1'
                  links:
                    type: object
                    properties:
                      first:
                        type: string
                        example: 'https://state.test/api/v1/payments?page=1'
                      last:
                        type: string
                        example: 'https://state.test/api/v1/payments?page=1'
                      prev:
                        type: string

                        nullable: true
                      next:
                        type: string

                        nullable: true
                  meta:
                    type: object
                    properties:
                      current_page:
                        type: integer
                        example: 1
                      from:
                        type: integer
                        example: 1
                      last_page:
                        type: integer
                        example: 1
                      per_page:
                        type: integer
                        example: 15
                      to:
                        type: integer
                        example: 1
                      total:
                        type: integer
                        example: 1
                  data:
                    type: array
                    example:
                      -
                        type: payments
                        id: '1001'
                        attributes:
                          processor_id: txn_123456
                          payment_method_id: pm_123456
                          account_id: '12345678'
                          status: Completed
                          status_description: 'Payment successfully processed'
                          amount_cents: 10000
                          debt_applied_amount_cents: 10000
                          convenience_fee_amount_cents: 0
                          charged_amount_cents: 10000
                          payment_date: '2023-10-01T12:00:00Z'
                          created_date: '2023-10-01T12:00:00Z'
                          failed_date: null
                          completed_date: '2023-10-01T12:05:00Z'
                          receipt_email: user@example.com
                          in_plan: true
                          batch_id: SWEEP-001
                          utm_tracking:
                            utm_source: newsletter
                            utm_medium: email
                    items:
                      type: object
                      properties:
                        type:
                          type: string
                          example: payments
                        id:
                          type: string
                          example: '1001'
                        attributes:
                          type: object
                          properties:
                            processor_id:
                              type: string
                              example: txn_123456
                            payment_method_id:
                              type: string
                              example: pm_123456
                            account_id:
                              type: string
                              example: '12345678'
                            status:
                              type: string
                              example: Completed
                            status_description:
                              type: string
                              example: 'Payment successfully processed'
                            amount_cents:
                              type: integer
                              example: 10000
                            debt_applied_amount_cents:
                              type: integer
                              example: 10000
                            convenience_fee_amount_cents:
                              type: integer
                              example: 0
                            charged_amount_cents:
                              type: integer
                              example: 10000
                            payment_date:
                              type: string
                              example: '2023-10-01T12:00:00Z'
                            created_date:
                              type: string
                              example: '2023-10-01T12:00:00Z'
                            failed_date:
                              type: string

                              nullable: true
                            completed_date:
                              type: string
                              example: '2023-10-01T12:05:00Z'
                            receipt_email:
                              type: string
                              example: user@example.com
                            in_plan:
                              type: boolean
                              example: true
                            batch_id:
                              type: string
                              example: SWEEP-001
                            utm_tracking:
                              type: object
                              properties:
                                utm_source:
                                  type: string
                                  example: newsletter
                                utm_medium:
                                  type: string
                                  example: email
        422:
          description: 'Validation failed'
          content:
            application/json:
              schema:
                type: object
                example:
                  jsonapi:
                    version: '1.1'
                  errors:
                    -
                      status: '422'
                      title: 'Validation failed'
                properties:
                  jsonapi:
                    type: object
                    properties:
                      version:
                        type: string
                        example: '1.1'
                  errors:
                    type: array
                    example:
                      - status: '422'
                        title: 'Validation failed'
                    items:
                      type: object
                      properties:
                        status:
                          type: string
                          example: '422'
                        title:
                          type: string
                          example: 'Validation failed'
      tags:
        - Payments
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                data:
                  type: object
                  description: ''

                  properties:
                    attributes:
                      type: object
                      description: 'The payments attributes for this request.'

                      properties:
                        page:
                          type: integer
                          description: 'Must be at least 1.'
                          example: 1
                          nullable: true
                        per_page:
                          type: integer
                          description: 'Must be at least 1. Must not be greater than 100.'
                          example: 15
                          nullable: true
                        account_id:
                          type: string
                          description: ''
                          example: '1555887746'
                          nullable: true
                        payment_id:
                          type: string
                          description: ''
                          example: '14000000008'
                          nullable: true
                        processor_id:
                          type: string
                          description: ''
                          example: 34bb6634-64db-3ceb-a6b7-e892138d9057
                          nullable: true
                        type:
                          type: string
                          description: ''

                          enum:
                            - history
                            - future
                          nullable: true
                        status:
                          type: string
                          description: ''
                          example: approved
                          nullable: true
                        from:
                          type: string
                          description: 'Must be a valid date.'
                          example: '2026-07-03'
                          nullable: true
                        until:
                          type: string
                          description: 'Must be a valid date.'
                          example: '2026-07-03'
                          nullable: true
                    type:
                      type: string
                      description: 'The JSON:API resource type.'
                      example: payments
                  required:
                    - attributes
                    - type
              required:
                - data
    post:
      summary: 'Create Payment'
      operationId: createPayment
      description: "Creates a one-time payment for a single debt account using an existing payment method.\n\nIf the provided account number is a seed account, the existing payment allocation logic may include grouped debts when calculating and applying the payment.\n\nFor one-time payments, full versus partial is inferred from `payment_amount_in_cents` compared with the selected debt balance."
      parameters: []
      responses:
        201:
          description: ''
          content:
            application/json:
              schema:
                oneOf:
                  -
                    description: 'Scheduled payment created'
                    type: object
                    example:
                      message: 'Payment created successfully.'
                      data:
                        uuid: d8cbb0d9-2864-4d27-85f3-77ec2f449126
                        account_id: ACC-001
                        account_ids:
                          - ACC-001
                        processor_id: null
                        numeric_id: '1001'
                        status: Scheduled
                        status_description: null
                        amount_cents: 5000
                        debt_applied_amount_cents: 5000
                        convenience_fee_amount_cents: 0
                        charged_amount_cents: 5000
                        amount_decimal: $50.00
                        payment_date: '2026-01-15'
                        created_date: '2026-01-14T10:00:00Z'
                        completed_date: null
                        receipt_email: billing@example.com
                    properties:
                      message:
                        type: string
                        example: 'Payment created successfully.'
                      data:
                        type: object
                        properties:
                          uuid:
                            type: string
                            example: d8cbb0d9-2864-4d27-85f3-77ec2f449126
                          account_id:
                            type: string
                            example: ACC-001
                          account_ids:
                            type: array
                            example:
                              - ACC-001
                            items:
                              type: string
                          processor_id:
                            type: string

                            nullable: true
                          numeric_id:
                            type: string
                            example: '1001'
                          status:
                            type: string
                            example: Scheduled
                          status_description:
                            type: string

                            nullable: true
                          amount_cents:
                            type: integer
                            example: 5000
                          debt_applied_amount_cents:
                            type: integer
                            example: 5000
                          convenience_fee_amount_cents:
                            type: integer
                            example: 0
                          charged_amount_cents:
                            type: integer
                            example: 5000
                          amount_decimal:
                            type: string
                            example: $50.00
                          payment_date:
                            type: string
                            example: '2026-01-15'
                          created_date:
                            type: string
                            example: '2026-01-14T10:00:00Z'
                          completed_date:
                            type: string

                            nullable: true
                          receipt_email:
                            type: string
                            example: billing@example.com
                  -
                    description: 'Same-day payment processed'
                    type: object
                    example:
                      message: 'Payment created successfully.'
                      data:
                        uuid: d8cbb0d9-2864-4d27-85f3-77ec2f449126
                        account_id: ACC-001
                        account_ids:
                          - ACC-001
                        processor_id: tr_123
                        numeric_id: '1001'
                        status: Completed
                        status_description: null
                        amount_cents: 5000
                        debt_applied_amount_cents: 5000
                        convenience_fee_amount_cents: 0
                        charged_amount_cents: 5000
                        amount_decimal: $50.00
                        payment_date: '2026-01-14T10:00:00Z'
                        created_date: '2026-01-14T10:00:00Z'
                        completed_date: '2026-01-14T10:00:05Z'
                        receipt_email: billing@example.com
                    properties:
                      message:
                        type: string
                        example: 'Payment created successfully.'
                      data:
                        type: object
                        properties:
                          uuid:
                            type: string
                            example: d8cbb0d9-2864-4d27-85f3-77ec2f449126
                          account_id:
                            type: string
                            example: ACC-001
                          account_ids:
                            type: array
                            example:
                              - ACC-001
                            items:
                              type: string
                          processor_id:
                            type: string
                            example: tr_123
                          numeric_id:
                            type: string
                            example: '1001'
                          status:
                            type: string
                            example: Completed
                          status_description:
                            type: string

                            nullable: true
                          amount_cents:
                            type: integer
                            example: 5000
                          debt_applied_amount_cents:
                            type: integer
                            example: 5000
                          convenience_fee_amount_cents:
                            type: integer
                            example: 0
                          charged_amount_cents:
                            type: integer
                            example: 5000
                          amount_decimal:
                            type: string
                            example: $50.00
                          payment_date:
                            type: string
                            example: '2026-01-14T10:00:00Z'
                          created_date:
                            type: string
                            example: '2026-01-14T10:00:00Z'
                          completed_date:
                            type: string
                            example: '2026-01-14T10:00:05Z'
                          receipt_email:
                            type: string
                            example: billing@example.com
                  -
                    description: 'Payment plan created'
                    type: object
                    example:
                      message: 'Payment plan created successfully.'
                      data:
                        payment_plan_uuid: 8ee7d3f2-6d49-4c9e-8d9d-29f35d5061b6
                        account_id: ACC-001
                        account_ids:
                          - ACC-001
                        status: Active
                        amount_cents: 5000
                        amount_decimal: $50.00
                        frequency: monthly
                        number_of_payments: 2
                        start_date: '2026-01-15'
                        finish_date: '2026-02-15'
                        payment_day_of_month: 15
                        payment_day_of_week: null
                        recurring_schedule_label: 'Monthly on 15th'
                        recurring_payment_amount_in_cents: 2500
                        final_payment_amount_in_cents: 2500
                        receipt_email: billing@example.com
                        payments:
                          -
                            uuid: d8cbb0d9-2864-4d27-85f3-77ec2f449126
                            account_id: ACC-001
                            account_ids:
                              - ACC-001
                            processor_id: null
                            numeric_id: '1001'
                            status: Scheduled
                            status_description: null
                            amount_cents: 2500
                            debt_applied_amount_cents: 2500
                            convenience_fee_amount_cents: 0
                            charged_amount_cents: 2500
                            amount_decimal: $25.00
                            payment_date: '2026-01-15'
                            created_date: '2026-01-14T10:00:00Z'
                            completed_date: null
                            receipt_email: billing@example.com
                          -
                            uuid: f5fbb01d-4b1e-4ccf-9c24-3982ef99d2e5
                            account_id: ACC-001
                            account_ids:
                              - ACC-001
                            processor_id: null
                            numeric_id: '1002'
                            status: Scheduled
                            status_description: null
                            amount_cents: 2500
                            debt_applied_amount_cents: 2500
                            convenience_fee_amount_cents: 0
                            charged_amount_cents: 2500
                            amount_decimal: $25.00
                            payment_date: '2026-02-15'
                            created_date: '2026-01-14T10:00:00Z'
                            completed_date: null
                            receipt_email: billing@example.com
                    properties:
                      message:
                        type: string
                        example: 'Payment plan created successfully.'
                      data:
                        type: object
                        properties:
                          payment_plan_uuid:
                            type: string
                            example: 8ee7d3f2-6d49-4c9e-8d9d-29f35d5061b6
                          account_id:
                            type: string
                            example: ACC-001
                          account_ids:
                            type: array
                            example:
                              - ACC-001
                            items:
                              type: string
                          status:
                            type: string
                            example: Active
                          amount_cents:
                            type: integer
                            example: 5000
                          amount_decimal:
                            type: string
                            example: $50.00
                          frequency:
                            type: string
                            example: monthly
                          number_of_payments:
                            type: integer
                            example: 2
                          start_date:
                            type: string
                            example: '2026-01-15'
                          finish_date:
                            type: string
                            example: '2026-02-15'
                          payment_day_of_month:
                            type: integer
                            example: 15
                          payment_day_of_week:
                            type: string

                            nullable: true
                          recurring_schedule_label:
                            type: string
                            example: 'Monthly on 15th'
                          recurring_payment_amount_in_cents:
                            type: integer
                            example: 2500
                          final_payment_amount_in_cents:
                            type: integer
                            example: 2500
                          receipt_email:
                            type: string
                            example: billing@example.com
                          payments:
                            type: array
                            example:
                              -
                                uuid: d8cbb0d9-2864-4d27-85f3-77ec2f449126
                                account_id: ACC-001
                                account_ids:
                                  - ACC-001
                                processor_id: null
                                numeric_id: '1001'
                                status: Scheduled
                                status_description: null
                                amount_cents: 2500
                                debt_applied_amount_cents: 2500
                                convenience_fee_amount_cents: 0
                                charged_amount_cents: 2500
                                amount_decimal: $25.00
                                payment_date: '2026-01-15'
                                created_date: '2026-01-14T10:00:00Z'
                                completed_date: null
                                receipt_email: billing@example.com
                              -
                                uuid: f5fbb01d-4b1e-4ccf-9c24-3982ef99d2e5
                                account_id: ACC-001
                                account_ids:
                                  - ACC-001
                                processor_id: null
                                numeric_id: '1002'
                                status: Scheduled
                                status_description: null
                                amount_cents: 2500
                                debt_applied_amount_cents: 2500
                                convenience_fee_amount_cents: 0
                                charged_amount_cents: 2500
                                amount_decimal: $25.00
                                payment_date: '2026-02-15'
                                created_date: '2026-01-14T10:00:00Z'
                                completed_date: null
                                receipt_email: billing@example.com
                            items:
                              type: object
                              properties:
                                uuid:
                                  type: string
                                  example: d8cbb0d9-2864-4d27-85f3-77ec2f449126
                                account_id:
                                  type: string
                                  example: ACC-001
                                account_ids:
                                  type: array
                                  example:
                                    - ACC-001
                                  items:
                                    type: string
                                processor_id:
                                  type: string

                                  nullable: true
                                numeric_id:
                                  type: string
                                  example: '1001'
                                status:
                                  type: string
                                  example: Scheduled
                                status_description:
                                  type: string

                                  nullable: true
                                amount_cents:
                                  type: integer
                                  example: 2500
                                debt_applied_amount_cents:
                                  type: integer
                                  example: 2500
                                convenience_fee_amount_cents:
                                  type: integer
                                  example: 0
                                charged_amount_cents:
                                  type: integer
                                  example: 2500
                                amount_decimal:
                                  type: string
                                  example: $25.00
                                payment_date:
                                  type: string
                                  example: '2026-01-15'
                                created_date:
                                  type: string
                                  example: '2026-01-14T10:00:00Z'
                                completed_date:
                                  type: string

                                  nullable: true
                                receipt_email:
                                  type: string
                                  example: billing@example.com
        404:
          description: 'Debt not found'
          content:
            application/json:
              schema:
                type: object
                example:
                  message: 'Debt not found.'
                properties:
                  message:
                    type: string
                    example: 'Debt not found.'
        409:
          description: 'Amount due conflict'
          content:
            application/json:
              schema:
                type: object
                example:
                  message: 'Payment blocked: outstanding payments exceed amount due.'
                  payment:
                    uuid: d8cbb0d9-2864-4d27-85f3-77ec2f449126
                    status: Failed
                properties:
                  message:
                    type: string
                    example: 'Payment blocked: outstanding payments exceed amount due.'
                  payment:
                    type: object
                    properties:
                      uuid:
                        type: string
                        example: d8cbb0d9-2864-4d27-85f3-77ec2f449126
                      status:
                        type: string
                        example: Failed
        422:
          description: ''
          content:
            application/json:
              schema:
                oneOf:
                  -
                    description: 'Validation failed'
                    type: object
                    example:
                      message: 'The payment amount in cents field is required.'
                      errors:
                        payment_amount_in_cents:
                          - 'The payment amount in cents field is required.'
                    properties:
                      message:
                        type: string
                        example: 'The payment amount in cents field is required.'
                      errors:
                        type: object
                        properties:
                          payment_amount_in_cents:
                            type: array
                            example:
                              - 'The payment amount in cents field is required.'
                            items:
                              type: string
                  -
                    description: 'Payment method unresolved'
                    type: object
                    example:
                      message: 'The provided payment method could not be resolved for this account.'
                    properties:
                      message:
                        type: string
                        example: 'The provided payment method could not be resolved for this account.'
        502:
          description: 'Processor unavailable'
          content:
            application/json:
              schema:
                type: object
                example:
                  message: 'The payment processor is currently unavailable. Please try again later.'
                properties:
                  message:
                    type: string
                    example: 'The payment processor is currently unavailable. Please try again later.'
      tags:
        - Payments
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                data:
                  type: object
                  description: ''

                  properties:
                    attributes:
                      type: object
                      description: 'The payments attributes for this request.'

                      properties:
                        payment_method_id:
                          type: string
                          description: 'An existing payment method ID to charge.'
                          example: 0f579d94-5145-36e1-a68c-74fb30142abf
                        payment_amount_in_cents:
                          type: integer
                          description: 'The payment amount in cents.'
                          example: 5000
                        payment_date:
                          type: date
                          description: 'optional The payment date in Y-m-d format. If omitted, the payment is processed immediately. Future dates remain scheduled.'

                          nullable: true
                        email:
                          type: string
                          description: "optional Optional receipt email override. If omitted, the debtor's email is used when available."
                          example: chirthe@example.com
                          nullable: true
                        account_id:
                          type: string
                          description: 'The account ID to pay.'
                          example: ACC-001
                        payment_plan:
                          type: object
                          description: 'optional Deprecated compatibility payload for creating a payment plan. Use POST /api/v1/payment-plans for new integrations.'

                          properties:
                            frequency:
                              type: string
                              description: 'optional Required when payment_plan is present. Allowed values depend on company rules for the selected debt.'

                            number_of_payments:
                              type: integer
                              description: 'optional Required when payment_plan is present. The total number of installments.'

                            start_date:
                              type: date
                              description: 'optional Required when payment_plan is present unless payment_date is supplied. The first installment date in Y-m-d format.'

                            payment_day_of_month:
                              type: integer
                              description: 'optional Required for monthly payment plans.'

                            payment_day_of_week:
                              type: string
                              description: 'optional Required for weekly or biweekly payment plans.'

                            recurring_payment_amount_in_cents:
                              type: integer
                              description: 'optional Optional custom recurring installment amount in cents.'

                      required:
                        - payment_method_id
                        - payment_amount_in_cents
                        - account_id
                    type:
                      type: string
                      description: 'The JSON:API resource type.'
                      example: payments
                  required:
                    - attributes
                    - type
              required:
                - data
  '/api/v1/payments/{payment_id|processor_id}':
    get:
      summary: 'Retrieve Payment'
      operationId: retrievePayment
      description: 'Retrieves one payment by its public payment ID or processor ID.'
      parameters: []
      responses:
        200:
          description: 'JSON:API success'
          content:
            application/json:
              schema:
                type: object
                example:
                  jsonapi:
                    version: '1.1'
                  data:
                    type: payments
                    id: '1001'
                    attributes:
                      processor_id: txn_123456
                      payment_method_id: pm_123456
                      account_id: '12345678'
                      status: Completed
                properties:
                  jsonapi:
                    type: object
                    properties:
                      version:
                        type: string
                        example: '1.1'
                  data:
                    type: object
                    properties:
                      type:
                        type: string
                        example: payments
                      id:
                        type: string
                        example: '1001'
                      attributes:
                        type: object
                        properties:
                          processor_id:
                            type: string
                            example: txn_123456
                          payment_method_id:
                            type: string
                            example: pm_123456
                          account_id:
                            type: string
                            example: '12345678'
                          status:
                            type: string
                            example: Completed
        404:
          description: 'Payment not found'
          content:
            application/json:
              schema:
                type: object
                example:
                  jsonapi:
                    version: '1.1'
                  errors:
                    -
                      status: '404'
                      title: 'Payment not found'
                properties:
                  jsonapi:
                    type: object
                    properties:
                      version:
                        type: string
                        example: '1.1'
                  errors:
                    type: array
                    example:
                      - status: '404'
                        title: 'Payment not found'
                    items:
                      type: object
                      properties:
                        status:
                          type: string
                          example: '404'
                        title:
                          type: string
                          example: 'Payment not found'
      tags:
        - Payments
    parameters:
      -
        in: path
        name: payment_id|processor_id
        description: 'Either a public payment ID or a processor ID.'
        example: '14000000008'
        required: true
        schema:
          type: string
  '/api/v1/payments/{identifier}/cancel':
    post:
      summary: 'Cancel Payment'
      operationId: cancelPayment
      description: "Issues a cancellation for a cancelable payment. Cancellation windows vary by payment type\nand processor state, so the processor can reject a cancellation request after its applicable\npayment window has closed."
      parameters: []
      responses:
        200:
          description: 'Payment cancellation issued'
          content:
            application/json:
              schema:
                type: object
                example:
                  jsonapi:
                    version: '1.1'
                  data:
                    type: payments
                    id: '1001'
                    attributes:
                      status: Canceled
                properties:
                  jsonapi:
                    type: object
                    properties:
                      version:
                        type: string
                        example: '1.1'
                  data:
                    type: object
                    properties:
                      type:
                        type: string
                        example: payments
                      id:
                        type: string
                        example: '1001'
                      attributes:
                        type: object
                        properties:
                          status:
                            type: string
                            example: Canceled
        403:
          description: 'Cancellation is not permitted'
          content:
            application/json:
              schema:
                type: object
                example:
                  jsonapi:
                    version: '1.1'
                  errors:
                    -
                      status: '403'
                      title: 'Payment cancellation is not permitted'
                properties:
                  jsonapi:
                    type: object
                    properties:
                      version:
                        type: string
                        example: '1.1'
                  errors:
                    type: array
                    example:
                      - status: '403'
                        title: 'Payment cancellation is not permitted'
                    items:
                      type: object
                      properties:
                        status:
                          type: string
                          example: '403'
                        title:
                          type: string
                          example: 'Payment cancellation is not permitted'
        404:
          description: 'Payment not found'
          content:
            application/json:
              schema:
                type: object
                example:
                  jsonapi:
                    version: '1.1'
                  errors:
                    -
                      status: '404'
                      title: 'Payment not found'
                properties:
                  jsonapi:
                    type: object
                    properties:
                      version:
                        type: string
                        example: '1.1'
                  errors:
                    type: array
                    example:
                      - status: '404'
                        title: 'Payment not found'
                    items:
                      type: object
                      properties:
                        status:
                          type: string
                          example: '404'
                        title:
                          type: string
                          example: 'Payment not found'
        422:
          description: 'Payment cannot be cancelled'
          content:
            application/json:
              schema:
                type: object
                example:
                  jsonapi:
                    version: '1.1'
                  errors:
                    -
                      status: '422'
                      title: 'Payment cannot be cancelled'
                properties:
                  jsonapi:
                    type: object
                    properties:
                      version:
                        type: string
                        example: '1.1'
                  errors:
                    type: array
                    example:
                      - status: '422'
                        title: 'Payment cannot be cancelled'
                    items:
                      type: object
                      properties:
                        status:
                          type: string
                          example: '422'
                        title:
                          type: string
                          example: 'Payment cannot be cancelled'
      tags:
        - Payments
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                data:
                  type: object
                  description: ''

                  properties:
                    attributes:
                      type: object
                      description: 'The payments attributes for this request.'

                      properties:
                        cancel_reason:
                          type: string
                          description: 'Reason for cancelling the payment.'
                          example: 'Consumer requested cancellation.'
                      required:
                        - cancel_reason
                    type:
                      type: string
                      description: 'Type for this request.'
                      example: payments
                  required:
                    - attributes
                    - type
              required:
                - data
    parameters:
      -
        in: path
        name: identifier
        description: 'Public payment ID or processor ID.'
        example: '1001'
        required: true
        schema:
          type: string
  /api/v1/payment-plans:
    post:
      summary: 'Create Payment Plan'
      operationId: createPaymentPlan
      description: "Creates a payment plan and its scheduled installments for one account or account group.\nNew integrations should use this endpoint instead of the deprecated `payment_plan` payload on Create Payment."
      parameters: []
      responses:
        201:
          description: 'Payment plan created'
          content:
            application/json:
              schema:
                type: object
                example:
                  jsonapi:
                    version: '1.1'
                  data:
                    type: payment-plans
                    id: 8ee7d3f2-6d49-4c9e-8d9d-29f35d5061b6
                    attributes:
                      status: Active
                      frequency: monthly
                      payment_count: 3
                      plan_total_amount_cents: 7500
                properties:
                  jsonapi:
                    type: object
                    properties:
                      version:
                        type: string
                        example: '1.1'
                  data:
                    type: object
                    properties:
                      type:
                        type: string
                        example: payment-plans
                      id:
                        type: string
                        example: 8ee7d3f2-6d49-4c9e-8d9d-29f35d5061b6
                      attributes:
                        type: object
                        properties:
                          status:
                            type: string
                            example: Active
                          frequency:
                            type: string
                            example: monthly
                          payment_count:
                            type: integer
                            example: 3
                          plan_total_amount_cents:
                            type: integer
                            example: 7500
        422:
          description: 'Validation failed'
          content:
            application/json:
              schema:
                type: object
                example:
                  jsonapi:
                    version: '1.1'
                  errors:
                    -
                      status: '422'
                      title: 'Validation failed'
                properties:
                  jsonapi:
                    type: object
                    properties:
                      version:
                        type: string
                        example: '1.1'
                  errors:
                    type: array
                    example:
                      - status: '422'
                        title: 'Validation failed'
                    items:
                      type: object
                      properties:
                        status:
                          type: string
                          example: '422'
                        title:
                          type: string
                          example: 'Validation failed'
      tags:
        - 'Payment Plans'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                data:
                  type: object
                  description: ''

                  properties:
                    attributes:
                      type: object
                      description: 'The payment-plans attributes for this request.'

                      properties:
                        payment_method_id:
                          type: string
                          description: 'Existing payment method ID.'
                          example: 0f579d94-5145-36e1-a68c-74fb30142abf
                        payment_amount_in_cents:
                          type: integer
                          description: 'Must be at least 1.'
                          example: 85
                        payment_date:
                          type: string
                          description: 'Must be a valid date.'

                          nullable: true
                        email:
                          type: string
                          description: 'Optional receipt email override.'

                        plan_selection_type:
                          type: string
                          description: 'Optional selection source: suggested or custom.'

                        account_id:
                          type: string
                          description: ''
                          example: '1555887746'
                        plan_total_amount_in_cents:
                          type: integer
                          description: 'Total amount enrolled in cents. Must equal the current eligible balance.'
                          example: 7500
                        frequency:
                          type: string
                          description: 'Plan recurrence frequency.'
                          example: monthly
                        number_of_payments:
                          type: integer
                          description: 'Number of installments.'
                          example: 3
                        start_date:
                          type: date
                          description: 'First payment date (Y-m-d).'
                          example: '2026-08-15'
                        payment_day_of_month:
                          type: integer
                          description: 'Monthly recurring day.'

                        payment_day_of_week:
                          type: string
                          description: 'Weekly or biweekly recurring weekday.'

                        recurring_payment_amount_in_cents:
                          type: integer
                          description: 'Optional recurring installment amount in cents.'

                      required:
                        - payment_method_id
                        - payment_amount_in_cents
                        - account_id
                        - plan_total_amount_in_cents
                        - frequency
                        - number_of_payments
                        - start_date
                    type:
                      type: string
                      description: 'Type for this request.'
                      example: payment-plans
                  required:
                    - attributes
                    - type
              required:
                - data
    get:
      summary: 'List Payment Plans'
      operationId: listPaymentPlans
      description: "Retrieves a paginated list of payment plans available to the authenticated organization.\nUse the filters to narrow plans by status, schedule preferences, selection source, balances, and dates."
      parameters:
        -
          in: query
          name: page
          description: 'Optional page number.'
          example: 1
          required: false
          schema:
            type: integer
            description: 'Optional page number.'
            example: 1
        -
          in: query
          name: per_page
          description: 'Optional page size. Min 1, max 100.'
          example: 15
          required: false
          schema:
            type: integer
            description: 'Optional page size. Min 1, max 100.'
            example: 15
        -
          in: query
          name: account_id
          description: 'Optional account ID filter.'
          example: '1555887746'
          required: false
          schema:
            type: string
            description: 'Optional account ID filter.'
            example: '1555887746'
        -
          in: query
          name: status
          description: 'Optional plan status. Allowed: active, completed, canceled.'
          example: active
          required: false
          schema:
            type: string
            description: 'Optional plan status. Allowed: active, completed, canceled.'
            example: active
        -
          in: query
          name: frequency
          description: 'Optional recurrence frequency. Allowed: daily, weekly, biweekly, monthly.'
          example: biweekly
          required: false
          schema:
            type: string
            description: 'Optional recurrence frequency. Allowed: daily, weekly, biweekly, monthly.'
            example: biweekly
        -
          in: query
          name: recurring_day
          description: 'Optional recurring weekday or day of month.'
          example: Thursday
          required: false
          schema:
            type: string
            description: 'Optional recurring weekday or day of month.'
            example: Thursday
        -
          in: query
          name: plan_selection_type
          description: 'Optional selection source. Allowed: suggested, custom.'
          example: suggested
          required: false
          schema:
            type: string
            description: 'Optional selection source. Allowed: suggested, custom.'
            example: suggested
        -
          in: query
          name: payment_count_min
          description: 'Optional minimum installment count.'
          example: 3
          required: false
          schema:
            type: integer
            description: 'Optional minimum installment count.'
            example: 3
        -
          in: query
          name: payment_count_max
          description: 'Optional maximum installment count.'
          example: 12
          required: false
          schema:
            type: integer
            description: 'Optional maximum installment count.'
            example: 12
        -
          in: query
          name: plan_total_amount_min
          description: 'Optional minimum plan total in cents.'
          example: 10000
          required: false
          schema:
            type: integer
            description: 'Optional minimum plan total in cents.'
            example: 10000
        -
          in: query
          name: plan_total_amount_max
          description: 'Optional maximum plan total in cents.'
          example: 100000
          required: false
          schema:
            type: integer
            description: 'Optional maximum plan total in cents.'
            example: 100000
        -
          in: query
          name: enrollment_date_from
          description: 'date Optional enrollment date start (Y-m-d).'

          required: false
          schema:
            type: string
            description: 'date Optional enrollment date start (Y-m-d).'

        -
          in: query
          name: enrollment_date_to
          description: 'date Optional enrollment date end (Y-m-d).'

          required: false
          schema:
            type: string
            description: 'date Optional enrollment date end (Y-m-d).'

        -
          in: query
          name: start_date_from
          description: 'date Optional first payment date start (Y-m-d).'

          required: false
          schema:
            type: string
            description: 'date Optional first payment date start (Y-m-d).'

        -
          in: query
          name: start_date_to
          description: 'date Optional first payment date end (Y-m-d).'

          required: false
          schema:
            type: string
            description: 'date Optional first payment date end (Y-m-d).'

        -
          in: query
          name: finish_date_from
          description: 'date Optional last payment date start (Y-m-d).'

          required: false
          schema:
            type: string
            description: 'date Optional last payment date start (Y-m-d).'

        -
          in: query
          name: finish_date_to
          description: 'date Optional last payment date end (Y-m-d).'

          required: false
          schema:
            type: string
            description: 'date Optional last payment date end (Y-m-d).'

      responses:
        200:
          description: 'JSON:API success'
          content:
            application/json:
              schema:
                type: object
                example:
                  jsonapi:
                    version: '1.1'
                  links:
                    first: 'https://state.test/api/v1/payment-plans?page=1'
                    last: 'https://state.test/api/v1/payment-plans?page=1'
                    prev: null
                    next: null
                  meta:
                    current_page: 1
                    from: 1
                    last_page: 1
                    per_page: 15
                    to: 1
                    total: 1
                  data:
                    -
                      type: payment-plans
                      id: 8ee7d3f2-6d49-4c9e-8d9d-29f35d5061b6
                      attributes:
                        status: Active
                        frequency: biweekly
                        recurring_day: Thursday
                        plan_selection_type: suggested
                        payment_count: 10
                properties:
                  jsonapi:
                    type: object
                    properties:
                      version:
                        type: string
                        example: '1.1'
                  links:
                    type: object
                    properties:
                      first:
                        type: string
                        example: 'https://state.test/api/v1/payment-plans?page=1'
                      last:
                        type: string
                        example: 'https://state.test/api/v1/payment-plans?page=1'
                      prev:
                        type: string

                        nullable: true
                      next:
                        type: string

                        nullable: true
                  meta:
                    type: object
                    properties:
                      current_page:
                        type: integer
                        example: 1
                      from:
                        type: integer
                        example: 1
                      last_page:
                        type: integer
                        example: 1
                      per_page:
                        type: integer
                        example: 15
                      to:
                        type: integer
                        example: 1
                      total:
                        type: integer
                        example: 1
                  data:
                    type: array
                    example:
                      -
                        type: payment-plans
                        id: 8ee7d3f2-6d49-4c9e-8d9d-29f35d5061b6
                        attributes:
                          status: Active
                          frequency: biweekly
                          recurring_day: Thursday
                          plan_selection_type: suggested
                          payment_count: 10
                    items:
                      type: object
                      properties:
                        type:
                          type: string
                          example: payment-plans
                        id:
                          type: string
                          example: 8ee7d3f2-6d49-4c9e-8d9d-29f35d5061b6
                        attributes:
                          type: object
                          properties:
                            status:
                              type: string
                              example: Active
                            frequency:
                              type: string
                              example: biweekly
                            recurring_day:
                              type: string
                              example: Thursday
                            plan_selection_type:
                              type: string
                              example: suggested
                            payment_count:
                              type: integer
                              example: 10
        422:
          description: 'Validation failed'
          content:
            application/json:
              schema:
                type: object
                example:
                  jsonapi:
                    version: '1.1'
                  errors:
                    -
                      status: '422'
                      title: 'Validation failed'
                properties:
                  jsonapi:
                    type: object
                    properties:
                      version:
                        type: string
                        example: '1.1'
                  errors:
                    type: array
                    example:
                      - status: '422'
                        title: 'Validation failed'
                    items:
                      type: object
                      properties:
                        status:
                          type: string
                          example: '422'
                        title:
                          type: string
                          example: 'Validation failed'
      tags:
        - 'Payment Plans'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                data:
                  type: object
                  description: ''

                  properties:
                    attributes:
                      type: object
                      description: 'The payment-plans attributes for this request.'

                      properties:
                        page:
                          type: integer
                          description: 'Must be at least 1.'
                          example: 1
                          nullable: true
                        per_page:
                          type: integer
                          description: 'Must be at least 1. Must not be greater than 100.'
                          example: 15
                          nullable: true
                        account_id:
                          type: string
                          description: 'Must not be greater than 255 characters.'
                          example: '1555887746'
                          nullable: true
                        status:
                          type: string
                          description: ''
                          example: active
                          enum:
                            - active
                            - completed
                            - canceled
                          nullable: true
                        frequency:
                          type: string
                          description: ''
                          example: biweekly
                          enum:
                            - daily
                            - weekly
                            - biweekly
                            - monthly
                          nullable: true
                        recurring_day:
                          type: string
                          description: 'Must not be greater than 16 characters.'
                          example: Thursday
                          nullable: true
                        plan_selection_type:
                          type: string
                          description: ''
                          example: suggested
                          enum:
                            - suggested
                            - custom
                          nullable: true
                        payment_count_min:
                          type: integer
                          description: 'Must be at least 1.'
                          example: 3
                          nullable: true
                        payment_count_max:
                          type: integer
                          description: 'Must be at least 1.'
                          example: 12
                          nullable: true
                        plan_total_amount_min:
                          type: integer
                          description: 'Must be at least 0.'
                          example: 10000
                          nullable: true
                        plan_total_amount_max:
                          type: integer
                          description: 'Must be at least 0.'
                          example: 100000
                          nullable: true
                        enrollment_date_from:
                          type: string
                          description: 'Must be a valid date in the format <code>Y-m-d</code>.'

                          nullable: true
                        enrollment_date_to:
                          type: string
                          description: 'Must be a valid date in the format <code>Y-m-d</code>. Must be a date after or equal to <code>enrollment_date_from</code>.'

                          nullable: true
                        start_date_from:
                          type: string
                          description: 'Must be a valid date in the format <code>Y-m-d</code>.'

                          nullable: true
                        start_date_to:
                          type: string
                          description: 'Must be a valid date in the format <code>Y-m-d</code>. Must be a date after or equal to <code>start_date_from</code>.'

                          nullable: true
                        finish_date_from:
                          type: string
                          description: 'Must be a valid date in the format <code>Y-m-d</code>.'

                          nullable: true
                        finish_date_to:
                          type: string
                          description: 'Must be a valid date in the format <code>Y-m-d</code>. Must be a date after or equal to <code>finish_date_from</code>.'

                          nullable: true
                    type:
                      type: string
                      description: 'The JSON:API resource type.'
                      example: payment-plans
                  required:
                    - attributes
                    - type
              required:
                - data
  '/api/v1/payment-plans/{payment_plan_id}/cancel':
    post:
      summary: 'Cancel Payment Plan'
      operationId: cancelPaymentPlan
      description: "Cancels an active payment plan, cancels all remaining scheduled installments, and removes\nplan status from the associated accounts. This performs the same domain operation as the\nFilament admin payment-plan cancellation action."
      parameters: []
      responses:
        200:
          description: 'Payment plan cancelled'
          content:
            application/json:
              schema:
                type: object
                example:
                  jsonapi:
                    version: '1.1'
                  data:
                    type: payment-plans
                    id: 8ee7d3f2-6d49-4c9e-8d9d-29f35d5061b6
                    attributes:
                      status: Canceled
                      status_reason: 'Consumer requested cancellation.'
                properties:
                  jsonapi:
                    type: object
                    properties:
                      version:
                        type: string
                        example: '1.1'
                  data:
                    type: object
                    properties:
                      type:
                        type: string
                        example: payment-plans
                      id:
                        type: string
                        example: 8ee7d3f2-6d49-4c9e-8d9d-29f35d5061b6
                      attributes:
                        type: object
                        properties:
                          status:
                            type: string
                            example: Canceled
                          status_reason:
                            type: string
                            example: 'Consumer requested cancellation.'
        403:
          description: 'Cancellation is not permitted'
          content:
            application/json:
              schema:
                type: object
                example:
                  jsonapi:
                    version: '1.1'
                  errors:
                    -
                      status: '403'
                      title: 'Payment plan cancellation is not permitted'
                properties:
                  jsonapi:
                    type: object
                    properties:
                      version:
                        type: string
                        example: '1.1'
                  errors:
                    type: array
                    example:
                      - status: '403'
                        title: 'Payment plan cancellation is not permitted'
                    items:
                      type: object
                      properties:
                        status:
                          type: string
                          example: '403'
                        title:
                          type: string
                          example: 'Payment plan cancellation is not permitted'
        404:
          description: 'Payment plan not found'
          content:
            application/json:
              schema:
                type: object
                example:
                  jsonapi:
                    version: '1.1'
                  errors:
                    -
                      status: '404'
                      title: 'Payment plan not found'
                properties:
                  jsonapi:
                    type: object
                    properties:
                      version:
                        type: string
                        example: '1.1'
                  errors:
                    type: array
                    example:
                      - status: '404'
                        title: 'Payment plan not found'
                    items:
                      type: object
                      properties:
                        status:
                          type: string
                          example: '404'
                        title:
                          type: string
                          example: 'Payment plan not found'
        422:
          description: 'Plan cannot be cancelled'
          content:
            application/json:
              schema:
                type: object
                example:
                  jsonapi:
                    version: '1.1'
                  errors:
                    -
                      status: '422'
                      title: 'Payment plan cannot be cancelled'
                properties:
                  jsonapi:
                    type: object
                    properties:
                      version:
                        type: string
                        example: '1.1'
                  errors:
                    type: array
                    example:
                      - status: '422'
                        title: 'Payment plan cannot be cancelled'
                    items:
                      type: object
                      properties:
                        status:
                          type: string
                          example: '422'
                        title:
                          type: string
                          example: 'Payment plan cannot be cancelled'
      tags:
        - 'Payment Plans'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                data:
                  type: object
                  description: ''

                  properties:
                    attributes:
                      type: object
                      description: 'The payment-plans attributes for this request.'

                      properties:
                        reason:
                          type: string
                          description: 'Reason for cancelling the plan.'
                          example: 'Consumer requested cancellation.'
                      required:
                        - reason
                    type:
                      type: string
                      description: 'Type for this request.'
                      example: payment-plans
                  required:
                    - attributes
                    - type
              required:
                - data
    parameters:
      -
        in: path
        name: payment_plan_id
        description: 'The public payment plan ID.'
        example: 8ee7d3f2-6d49-4c9e-8d9d-29f35d5061b6
        required: true
        schema:
          type: string
  '/api/v1/payment-plans/{payment_plan_id}':
    get:
      summary: 'Retrieve Payment Plan'
      operationId: retrievePaymentPlan
      description: "Retrieves one payment plan by its public plan ID. Include `payments` to return every\npublic payment in the plan using the same fields as payment endpoints."
      parameters:
        -
          in: query
          name: include
          description: 'Optional comma-separated relationships. Allowed: payments.'

          required: false
          schema:
            type: string
            description: 'Optional comma-separated relationships. Allowed: payments.'

      responses:
        200:
          description: 'JSON:API success'
          content:
            application/json:
              schema:
                type: object
                example:
                  jsonapi:
                    version: '1.1'
                  data:
                    type: payment-plans
                    id: 8ee7d3f2-6d49-4c9e-8d9d-29f35d5061b6
                    attributes:
                      status: Active
                      status_reason: null
                      frequency: biweekly
                      recurring_day: Thursday
                      plan_selection_type: suggested
                      payment_count: 10
                      plan_total_amount_cents: 39125
                      first_payment_amount_cents: 4000
                      recurring_payment_amount_cents: 4000
                      last_payment_amount_cents: 3125
                      paid_amount_cents: 0
                      scheduled_amount_cents: 39125
                      enrollment_date: '2026-07-20'
                      start_date: '2026-07-28'
                      finish_date: '2026-12-01'
                      balance_at_enrollment_cents: 39125
                      group_balance_at_enrollment_cents: 39125
                      outside_plan_balance_at_enrollment_cents: 0
                properties:
                  jsonapi:
                    type: object
                    properties:
                      version:
                        type: string
                        example: '1.1'
                  data:
                    type: object
                    properties:
                      type:
                        type: string
                        example: payment-plans
                      id:
                        type: string
                        example: 8ee7d3f2-6d49-4c9e-8d9d-29f35d5061b6
                      attributes:
                        type: object
                        properties:
                          status:
                            type: string
                            example: Active
                          status_reason:
                            type: string

                            nullable: true
                          frequency:
                            type: string
                            example: biweekly
                          recurring_day:
                            type: string
                            example: Thursday
                          plan_selection_type:
                            type: string
                            example: suggested
                          payment_count:
                            type: integer
                            example: 10
                          plan_total_amount_cents:
                            type: integer
                            example: 39125
                          first_payment_amount_cents:
                            type: integer
                            example: 4000
                          recurring_payment_amount_cents:
                            type: integer
                            example: 4000
                          last_payment_amount_cents:
                            type: integer
                            example: 3125
                          paid_amount_cents:
                            type: integer
                            example: 0
                          scheduled_amount_cents:
                            type: integer
                            example: 39125
                          enrollment_date:
                            type: string
                            example: '2026-07-20'
                          start_date:
                            type: string
                            example: '2026-07-28'
                          finish_date:
                            type: string
                            example: '2026-12-01'
                          balance_at_enrollment_cents:
                            type: integer
                            example: 39125
                          group_balance_at_enrollment_cents:
                            type: integer
                            example: 39125
                          outside_plan_balance_at_enrollment_cents:
                            type: integer
                            example: 0
        400:
          description: 'Invalid include'
          content:
            application/json:
              schema:
                type: object
                example:
                  jsonapi:
                    version: '1.1'
                  errors:
                    -
                      status: '400'
                      code: invalid_include
                      title: 'Invalid include parameter'
                properties:
                  jsonapi:
                    type: object
                    properties:
                      version:
                        type: string
                        example: '1.1'
                  errors:
                    type: array
                    example:
                      - status: '400'
                        code: invalid_include
                        title: 'Invalid include parameter'
                    items:
                      type: object
                      properties:
                        status:
                          type: string
                          example: '400'
                        code:
                          type: string
                          example: invalid_include
                        title:
                          type: string
                          example: 'Invalid include parameter'
        404:
          description: 'Payment plan not found'
          content:
            application/json:
              schema:
                type: object
                example:
                  jsonapi:
                    version: '1.1'
                  errors:
                    -
                      status: '404'
                      title: 'Payment plan not found'
                properties:
                  jsonapi:
                    type: object
                    properties:
                      version:
                        type: string
                        example: '1.1'
                  errors:
                    type: array
                    example:
                      - status: '404'
                        title: 'Payment plan not found'
                    items:
                      type: object
                      properties:
                        status:
                          type: string
                          example: '404'
                        title:
                          type: string
                          example: 'Payment plan not found'
      tags:
        - 'Payment Plans'
    parameters:
      -
        in: path
        name: payment_plan_id
        description: 'The public payment plan ID.'
        example: 8ee7d3f2-6d49-4c9e-8d9d-29f35d5061b6
        required: true
        schema:
          type: string
  /api/v1/payment-methods:
    get:
      summary: 'List Payment Methods'
      operationId: listPaymentMethods
      description: "Retrieves the saved payment methods for an account in the authenticated organization.\nProcessor payloads and unmasked payment details are never returned."
      parameters:
        -
          in: query
          name: account_id
          description: 'The public account ID that owns the payment methods.'
          example: ACC-001
          required: true
          schema:
            type: string
            description: 'The public account ID that owns the payment methods.'
            example: ACC-001
      responses:
        200:
          description: 'JSON:API success'
          content:
            application/json:
              schema:
                type: object
                example:
                  jsonapi:
                    version: '1.1'
                  data:
                    -
                      type: payment-methods
                      id: payment-method-001
                      attributes:
                        payment_method_id: payment-method-001
                        type: Card
                        brand: visa
                        last_four: '1234'
                        expiration: 12/28
                        is_default: true
                properties:
                  jsonapi:
                    type: object
                    properties:
                      version:
                        type: string
                        example: '1.1'
                  data:
                    type: array
                    example:
                      -
                        type: payment-methods
                        id: payment-method-001
                        attributes:
                          payment_method_id: payment-method-001
                          type: Card
                          brand: visa
                          last_four: '1234'
                          expiration: 12/28
                          is_default: true
                    items:
                      type: object
                      properties:
                        type:
                          type: string
                          example: payment-methods
                        id:
                          type: string
                          example: payment-method-001
                        attributes:
                          type: object
                          properties:
                            payment_method_id:
                              type: string
                              example: payment-method-001
                            type:
                              type: string
                              example: Card
                            brand:
                              type: string
                              example: visa
                            last_four:
                              type: string
                              example: '1234'
                            expiration:
                              type: string
                              example: 12/28
                            is_default:
                              type: boolean
                              example: true
        401:
          description: 'User is not authenticated'
          content:
            application/json:
              schema:
                type: object
                example:
                  jsonapi:
                    version: '1.1'
                  errors:
                    -
                      status: '401'
                      title: Unauthenticated.
                properties:
                  jsonapi:
                    type: object
                    properties:
                      version:
                        type: string
                        example: '1.1'
                  errors:
                    type: array
                    example:
                      - status: '401'
                        title: Unauthenticated.
                    items:
                      type: object
                      properties:
                        status:
                          type: string
                          example: '401'
                        title:
                          type: string
                          example: Unauthenticated.
        404:
          description: 'Account not found'
          content:
            application/json:
              schema:
                type: object
                example:
                  jsonapi:
                    version: '1.1'
                  errors:
                    -
                      status: '404'
                      title: 'Account not found'
                properties:
                  jsonapi:
                    type: object
                    properties:
                      version:
                        type: string
                        example: '1.1'
                  errors:
                    type: array
                    example:
                      - status: '404'
                        title: 'Account not found'
                    items:
                      type: object
                      properties:
                        status:
                          type: string
                          example: '404'
                        title:
                          type: string
                          example: 'Account not found'
        422:
          description: 'Validation failed'
          content:
            application/json:
              schema:
                type: object
                example:
                  jsonapi:
                    version: '1.1'
                  errors:
                    -
                      status: '422'
                      title: 'Validation failed'
                properties:
                  jsonapi:
                    type: object
                    properties:
                      version:
                        type: string
                        example: '1.1'
                  errors:
                    type: array
                    example:
                      - status: '422'
                        title: 'Validation failed'
                    items:
                      type: object
                      properties:
                        status:
                          type: string
                          example: '422'
                        title:
                          type: string
                          example: 'Validation failed'
      tags:
        - 'Payment Methods'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                data:
                  type: object
                  description: ''

                  properties:
                    attributes:
                      type: object
                      description: 'The payment-method-contexts attributes for this request.'

                      properties:
                        account_id:
                          type: string
                          description: 'Must not be greater than 255 characters.'
                          example: xgislyfktjnmbj
                      required:
                        - account_id
                    type:
                      type: string
                      description: 'The JSON:API resource type.'
                      example: payment-method-contexts
                  required:
                    - attributes
                    - type
              required:
                - data
  '/api/v1/payment-methods/{payment_method_id}':
    get:
      summary: 'Retrieve Payment Method'
      operationId: retrievePaymentMethod
      description: 'Retrieves one saved payment method for an account in the authenticated organization.'
      parameters:
        -
          in: query
          name: account_id
          description: 'The public account ID that owns the payment method.'
          example: ACC-001
          required: true
          schema:
            type: string
            description: 'The public account ID that owns the payment method.'
            example: ACC-001
      responses:
        200:
          description: 'JSON:API success'
          content:
            application/json:
              schema:
                type: object
                example:
                  jsonapi:
                    version: '1.1'
                  data:
                    type: payment-methods
                    id: payment-method-001
                    attributes:
                      payment_method_id: payment-method-001
                      type: Card
                      brand: visa
                      last_four: '1234'
                      expiration: 12/28
                      is_default: true
                properties:
                  jsonapi:
                    type: object
                    properties:
                      version:
                        type: string
                        example: '1.1'
                  data:
                    type: object
                    properties:
                      type:
                        type: string
                        example: payment-methods
                      id:
                        type: string
                        example: payment-method-001
                      attributes:
                        type: object
                        properties:
                          payment_method_id:
                            type: string
                            example: payment-method-001
                          type:
                            type: string
                            example: Card
                          brand:
                            type: string
                            example: visa
                          last_four:
                            type: string
                            example: '1234'
                          expiration:
                            type: string
                            example: 12/28
                          is_default:
                            type: boolean
                            example: true
        401:
          description: 'User is not authenticated'
          content:
            application/json:
              schema:
                type: object
                example:
                  jsonapi:
                    version: '1.1'
                  errors:
                    -
                      status: '401'
                      title: Unauthenticated.
                properties:
                  jsonapi:
                    type: object
                    properties:
                      version:
                        type: string
                        example: '1.1'
                  errors:
                    type: array
                    example:
                      - status: '401'
                        title: Unauthenticated.
                    items:
                      type: object
                      properties:
                        status:
                          type: string
                          example: '401'
                        title:
                          type: string
                          example: Unauthenticated.
        404:
          description: 'Payment method not found'
          content:
            application/json:
              schema:
                type: object
                example:
                  jsonapi:
                    version: '1.1'
                  errors:
                    -
                      status: '404'
                      title: 'Payment method not found'
                properties:
                  jsonapi:
                    type: object
                    properties:
                      version:
                        type: string
                        example: '1.1'
                  errors:
                    type: array
                    example:
                      - status: '404'
                        title: 'Payment method not found'
                    items:
                      type: object
                      properties:
                        status:
                          type: string
                          example: '404'
                        title:
                          type: string
                          example: 'Payment method not found'
        422:
          description: 'Validation failed'
          content:
            application/json:
              schema:
                type: object
                example:
                  jsonapi:
                    version: '1.1'
                  errors:
                    -
                      status: '422'
                      title: 'Validation failed'
                properties:
                  jsonapi:
                    type: object
                    properties:
                      version:
                        type: string
                        example: '1.1'
                  errors:
                    type: array
                    example:
                      - status: '422'
                        title: 'Validation failed'
                    items:
                      type: object
                      properties:
                        status:
                          type: string
                          example: '422'
                        title:
                          type: string
                          example: 'Validation failed'
      tags:
        - 'Payment Methods'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                data:
                  type: object
                  description: ''

                  properties:
                    attributes:
                      type: object
                      description: 'The payment-method-contexts attributes for this request.'

                      properties:
                        account_id:
                          type: string
                          description: 'Must not be greater than 255 characters.'
                          example: rbaqkkr
                      required:
                        - account_id
                    type:
                      type: string
                      description: 'The JSON:API resource type.'
                      example: payment-method-contexts
                  required:
                    - attributes
                    - type
              required:
                - data
    parameters:
      -
        in: path
        name: payment_method_id
        description: 'The public payment method ID.'
        example: 0f579d94-5145-36e1-a68c-74fb30142abf
        required: true
        schema:
          type: string
  /api/v1/payment-method/context:
    post:
      summary: 'Create Method Context'
      operationId: createMethodContext
      description: "Creates the short-lived setup credentials needed to add a payment method for a debtor.\n\nSend an `account_id` to resolve the consumer and receive the processor account details\nneeded by your payment method collection flow. The response includes the merchant account,\nthe debtor account, the account holder name, and a token limited to adding all supported\npayment method types. The token expires after 30 minutes.\n\nAnteloope does not receive or store raw card numbers, CVV, routing numbers, or bank account\nnumbers through this endpoint. Those values should be submitted directly to the payment\nprocessor using the returned token."
      parameters: []
      responses:
        200:
          description: 'Payment method context created'
          content:
            application/json:
              schema:
                type: object
                example:
                  status: true
                  message: 'Payment method context created successfully'
                  data:
                    merchant_account_id: merchant-account-id
                    account_id: debtor-account-id
                    account_holder_name: 'Jane Doe'
                    token: eyJhbGciOi...
                    token_life: 1800
                    token_scope: '/fed.read /accounts/debtor-account-id/cards.write /accounts/debtor-account-id/bank-accounts.write'
                properties:
                  status:
                    type: boolean
                    example: true
                  message:
                    type: string
                    example: 'Payment method context created successfully'
                  data:
                    type: object
                    properties:
                      merchant_account_id:
                        type: string
                        example: merchant-account-id
                      account_id:
                        type: string
                        example: debtor-account-id
                      account_holder_name:
                        type: string
                        example: 'Jane Doe'
                      token:
                        type: string
                        example: eyJhbGciOi...
                      token_life:
                        type: integer
                        example: 1800
                      token_scope:
                        type: string
                        example: '/fed.read /accounts/debtor-account-id/cards.write /accounts/debtor-account-id/bank-accounts.write'
        400:
          description: 'Validation failed'
          content:
            application/json:
              schema:
                type: object
                example:
                  status: false
                  message: 'Validation errors'
                  errors:
                    - 'Please provide a debt account ID.'
                properties:
                  status:
                    type: boolean
                    example: false
                  message:
                    type: string
                    example: 'Validation errors'
                  errors:
                    type: array
                    example:
                      - 'Please provide a debt account ID.'
                    items:
                      type: string
        401:
          description: 'User is not authenticated'
          content:
            application/json:
              schema:
                type: object
                example:
                  error:
                    status: 401
                    message: Unauthenticated.
                properties:
                  error:
                    type: object
                    properties:
                      status:
                        type: integer
                        example: 401
                      message:
                        type: string
                        example: Unauthenticated.
        403:
          description: "User is missing 'create-payment-methods' ability"
          content:
            application/json:
              schema:
                type: object
                example:
                  error:
                    status: 403
                    message: 'You are not authorized to perform this action'
                properties:
                  error:
                    type: object
                    properties:
                      status:
                        type: integer
                        example: 403
                      message:
                        type: string
                        example: 'You are not authorized to perform this action'
        404:
          description: 'Debt account not found'
          content:
            application/json:
              schema:
                type: object
                example:
                  status: false
                  message: 'Debt account not found'
                  errors:
                    - 'No account found with the provided account_id'
                properties:
                  status:
                    type: boolean
                    example: false
                  message:
                    type: string
                    example: 'Debt account not found'
                  errors:
                    type: array
                    example:
                      - 'No account found with the provided account_id'
                    items:
                      type: string
        422:
          description: 'Processor context unavailable'
          content:
            application/json:
              schema:
                type: object
                example:
                  status: false
                  message: 'Unable to create payment method context'
                  errors:
                    - 'Payment account could not be prepared.'
                properties:
                  status:
                    type: boolean
                    example: false
                  message:
                    type: string
                    example: 'Unable to create payment method context'
                  errors:
                    type: array
                    example:
                      - 'Payment account could not be prepared.'
                    items:
                      type: string
      tags:
        - 'Payment Methods'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                data:
                  type: object
                  description: ''

                  properties:
                    attributes:
                      type: object
                      description: 'The payment-method-contexts attributes for this request.'

                      properties:
                        account_id:
                          type: string
                          description: 'The account ID used to resolve the consumer who will own the new payment method.'
                          example: JOY34R09
                      required:
                        - account_id
                    type:
                      type: string
                      description: 'The JSON:API resource type.'
                      example: payment-method-contexts
                  required:
                    - attributes
                    - type
              required:
                - data
  /api/v1/creditors:
    get:
      summary: 'List Creditors'
      operationId: listCreditors
      description: 'Retrieves a paginated list of creditors available to the authenticated organization.'
      parameters:
        -
          in: query
          name: page
          description: 'Optional page number.'

          required: false
          schema:
            type: integer
            description: 'Optional page number.'

        -
          in: query
          name: per_page
          description: 'Optional page size. Min 1, max 100.'

          required: false
          schema:
            type: integer
            description: 'Optional page size. Min 1, max 100.'

        -
          in: query
          name: creditor_id
          description: 'Optional exact creditor identifier.'

          required: false
          schema:
            type: string
            description: 'Optional exact creditor identifier.'

        -
          in: query
          name: creditor_name
          description: 'Optional creditor name filter.'

          required: false
          schema:
            type: string
            description: 'Optional creditor name filter.'

        -
          in: query
          name: is_first_party_payment
          description: 'Optional first-party payment filter.'

          required: false
          schema:
            type: boolean
            description: 'Optional first-party payment filter.'

      responses:
        200:
          description: 'JSON:API success'
          content:
            application/json:
              schema:
                type: object
                example:
                  jsonapi:
                    version: '1.1'
                  data:
                    -
                      type: creditors
                      id: HCP-ABC-001
                      attributes:
                        creditor_id: HCP-ABC-001
                        creditor_name: 'Healthcare Provider ABC'
                properties:
                  jsonapi:
                    type: object
                    properties:
                      version:
                        type: string
                        example: '1.1'
                  data:
                    type: array
                    example:
                      -
                        type: creditors
                        id: HCP-ABC-001
                        attributes:
                          creditor_id: HCP-ABC-001
                          creditor_name: 'Healthcare Provider ABC'
                    items:
                      type: object
                      properties:
                        type:
                          type: string
                          example: creditors
                        id:
                          type: string
                          example: HCP-ABC-001
                        attributes:
                          type: object
                          properties:
                            creditor_id:
                              type: string
                              example: HCP-ABC-001
                            creditor_name:
                              type: string
                              example: 'Healthcare Provider ABC'
        401:
          description: 'User is not authenticated'
          content:
            application/json:
              schema:
                type: object
                example:
                  jsonapi:
                    version: '1.1'
                  errors:
                    -
                      status: '401'
                      title: Unauthenticated.
                properties:
                  jsonapi:
                    type: object
                    properties:
                      version:
                        type: string
                        example: '1.1'
                  errors:
                    type: array
                    example:
                      - status: '401'
                        title: Unauthenticated.
                    items:
                      type: object
                      properties:
                        status:
                          type: string
                          example: '401'
                        title:
                          type: string
                          example: Unauthenticated.
        403:
          description: 'User is missing view-debts ability'
          content:
            application/json:
              schema:
                type: object
                example:
                  jsonapi:
                    version: '1.1'
                  errors:
                    -
                      status: '403'
                      title: 'You are not authorized to perform this action'
                properties:
                  jsonapi:
                    type: object
                    properties:
                      version:
                        type: string
                        example: '1.1'
                  errors:
                    type: array
                    example:
                      - status: '403'
                        title: 'You are not authorized to perform this action'
                    items:
                      type: object
                      properties:
                        status:
                          type: string
                          example: '403'
                        title:
                          type: string
                          example: 'You are not authorized to perform this action'
        422:
          description: 'Validation failed'
          content:
            application/json:
              schema:
                type: object
                example:
                  jsonapi:
                    version: '1.1'
                  errors:
                    -
                      status: '422'
                      title: 'Validation failed'
                properties:
                  jsonapi:
                    type: object
                    properties:
                      version:
                        type: string
                        example: '1.1'
                  errors:
                    type: array
                    example:
                      - status: '422'
                        title: 'Validation failed'
                    items:
                      type: object
                      properties:
                        status:
                          type: string
                          example: '422'
                        title:
                          type: string
                          example: 'Validation failed'
      tags:
        - Creditors
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                data:
                  type: object
                  description: ''

                  properties:
                    attributes:
                      type: object
                      description: 'The creditors attributes for this request.'

                      properties:
                        page:
                          type: integer
                          description: 'Must be at least 1.'

                          nullable: true
                        per_page:
                          type: integer
                          description: 'Must be at least 1. Must not be greater than 100.'

                          nullable: true
                        creditor_id:
                          type: string
                          description: 'Must not be greater than 255 characters.'

                          nullable: true
                        creditor_name:
                          type: string
                          description: 'Must not be greater than 255 characters.'

                          nullable: true
                        is_first_party_payment:
                          type: string
                          description: ''

                          enum:
                            - 'true'
                            - 'false'
                            - '1'
                            - '0'
                          nullable: true
                    type:
                      type: string
                      description: 'The JSON:API resource type.'
                      example: creditors
                  required:
                    - attributes
                    - type
              required:
                - data
    post:
      summary: 'Create Creditor'
      operationId: createCreditor
      description: 'Creates a creditor within the authenticated organization.'
      parameters: []
      responses:
        201:
          description: 'Creditor created'
          content:
            application/json:
              schema:
                type: object
                example:
                  jsonapi:
                    version: '1.1'
                  data:
                    type: creditors
                    id: HCP-ABC-001
                    attributes:
                      creditor_id: HCP-ABC-001
                      creditor_name: 'Healthcare Provider ABC'
                properties:
                  jsonapi:
                    type: object
                    properties:
                      version:
                        type: string
                        example: '1.1'
                  data:
                    type: object
                    properties:
                      type:
                        type: string
                        example: creditors
                      id:
                        type: string
                        example: HCP-ABC-001
                      attributes:
                        type: object
                        properties:
                          creditor_id:
                            type: string
                            example: HCP-ABC-001
                          creditor_name:
                            type: string
                            example: 'Healthcare Provider ABC'
        401:
          description: 'User is not authenticated'
          content:
            application/json:
              schema:
                type: object
                example:
                  jsonapi:
                    version: '1.1'
                  errors:
                    -
                      status: '401'
                      title: Unauthenticated.
                properties:
                  jsonapi:
                    type: object
                    properties:
                      version:
                        type: string
                        example: '1.1'
                  errors:
                    type: array
                    example:
                      - status: '401'
                        title: Unauthenticated.
                    items:
                      type: object
                      properties:
                        status:
                          type: string
                          example: '401'
                        title:
                          type: string
                          example: Unauthenticated.
        403:
          description: 'Organization context required'
          content:
            application/json:
              schema:
                type: object
                example:
                  jsonapi:
                    version: '1.1'
                  errors:
                    -
                      status: '403'
                      title: 'Organization context required'
                properties:
                  jsonapi:
                    type: object
                    properties:
                      version:
                        type: string
                        example: '1.1'
                  errors:
                    type: array
                    example:
                      - status: '403'
                        title: 'Organization context required'
                    items:
                      type: object
                      properties:
                        status:
                          type: string
                          example: '403'
                        title:
                          type: string
                          example: 'Organization context required'
        422:
          description: 'Validation failed'
          content:
            application/json:
              schema:
                type: object
                example:
                  jsonapi:
                    version: '1.1'
                  errors:
                    -
                      status: '422'
                      title: 'Validation failed'
                properties:
                  jsonapi:
                    type: object
                    properties:
                      version:
                        type: string
                        example: '1.1'
                  errors:
                    type: array
                    example:
                      - status: '422'
                        title: 'Validation failed'
                    items:
                      type: object
                      properties:
                        status:
                          type: string
                          example: '422'
                        title:
                          type: string
                          example: 'Validation failed'
      tags:
        - Creditors
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                data:
                  type: object
                  description: ''

                  properties:
                    attributes:
                      type: object
                      description: 'The creditors attributes for this request.'

                      properties:
                        creditor_id:
                          type: string
                          description: 'Must not be greater than 255 characters.'
                          example: qpdisdculmji
                        creditor_name:
                          type: string
                          description: 'Must not be greater than 255 characters.'
                          example: nkcph
                        is_first_party_payment:
                          type: boolean
                          description: ''

                          nullable: true
                      required:
                        - creditor_id
                        - creditor_name
                    type:
                      type: string
                      description: 'The JSON:API resource type.'
                      example: creditors
                  required:
                    - attributes
                    - type
              required:
                - data
  '/api/v1/creditors/{creditor_id}':
    get:
      summary: 'Retrieve Creditor'
      operationId: retrieveCreditor
      description: 'Retrieves one creditor by its public creditor ID.'
      parameters: []
      responses:
        200:
          description: 'JSON:API success'
          content:
            application/json:
              schema:
                type: object
                example:
                  jsonapi:
                    version: '1.1'
                  data:
                    type: creditors
                    id: HCP-ABC-001
                    attributes:
                      creditor_id: HCP-ABC-001
                      creditor_name: 'Healthcare Provider ABC'
                properties:
                  jsonapi:
                    type: object
                    properties:
                      version:
                        type: string
                        example: '1.1'
                  data:
                    type: object
                    properties:
                      type:
                        type: string
                        example: creditors
                      id:
                        type: string
                        example: HCP-ABC-001
                      attributes:
                        type: object
                        properties:
                          creditor_id:
                            type: string
                            example: HCP-ABC-001
                          creditor_name:
                            type: string
                            example: 'Healthcare Provider ABC'
        401:
          description: 'User is not authenticated'
          content:
            application/json:
              schema:
                type: object
                example:
                  jsonapi:
                    version: '1.1'
                  errors:
                    -
                      status: '401'
                      title: Unauthenticated.
                properties:
                  jsonapi:
                    type: object
                    properties:
                      version:
                        type: string
                        example: '1.1'
                  errors:
                    type: array
                    example:
                      - status: '401'
                        title: Unauthenticated.
                    items:
                      type: object
                      properties:
                        status:
                          type: string
                          example: '401'
                        title:
                          type: string
                          example: Unauthenticated.
        404:
          description: 'Creditor not found'
          content:
            application/json:
              schema:
                type: object
                example:
                  jsonapi:
                    version: '1.1'
                  errors:
                    -
                      status: '404'
                      title: 'Creditor not found'
                properties:
                  jsonapi:
                    type: object
                    properties:
                      version:
                        type: string
                        example: '1.1'
                  errors:
                    type: array
                    example:
                      - status: '404'
                        title: 'Creditor not found'
                    items:
                      type: object
                      properties:
                        status:
                          type: string
                          example: '404'
                        title:
                          type: string
                          example: 'Creditor not found'
      tags:
        - Creditors
    patch:
      summary: 'Update Creditor'
      operationId: updateCreditor
      description: 'Updates editable creditor information. The public creditor ID cannot be changed.'
      parameters: []
      responses:
        200:
          description: 'Creditor updated'
          content:
            application/json:
              schema:
                type: object
                example:
                  jsonapi:
                    version: '1.1'
                  data:
                    type: creditors
                    id: HCP-ABC-001
                    attributes:
                      creditor_id: HCP-ABC-001
                      creditor_name: 'Healthcare Provider ABC'
                properties:
                  jsonapi:
                    type: object
                    properties:
                      version:
                        type: string
                        example: '1.1'
                  data:
                    type: object
                    properties:
                      type:
                        type: string
                        example: creditors
                      id:
                        type: string
                        example: HCP-ABC-001
                      attributes:
                        type: object
                        properties:
                          creditor_id:
                            type: string
                            example: HCP-ABC-001
                          creditor_name:
                            type: string
                            example: 'Healthcare Provider ABC'
        401:
          description: 'User is not authenticated'
          content:
            application/json:
              schema:
                type: object
                example:
                  jsonapi:
                    version: '1.1'
                  errors:
                    -
                      status: '401'
                      title: Unauthenticated.
                properties:
                  jsonapi:
                    type: object
                    properties:
                      version:
                        type: string
                        example: '1.1'
                  errors:
                    type: array
                    example:
                      - status: '401'
                        title: Unauthenticated.
                    items:
                      type: object
                      properties:
                        status:
                          type: string
                          example: '401'
                        title:
                          type: string
                          example: Unauthenticated.
        404:
          description: 'Creditor not found'
          content:
            application/json:
              schema:
                type: object
                example:
                  jsonapi:
                    version: '1.1'
                  errors:
                    -
                      status: '404'
                      title: 'Creditor not found'
                properties:
                  jsonapi:
                    type: object
                    properties:
                      version:
                        type: string
                        example: '1.1'
                  errors:
                    type: array
                    example:
                      - status: '404'
                        title: 'Creditor not found'
                    items:
                      type: object
                      properties:
                        status:
                          type: string
                          example: '404'
                        title:
                          type: string
                          example: 'Creditor not found'
        422:
          description: 'Validation failed'
          content:
            application/json:
              schema:
                type: object
                example:
                  jsonapi:
                    version: '1.1'
                  errors:
                    -
                      status: '422'
                      title: 'Validation failed'
                properties:
                  jsonapi:
                    type: object
                    properties:
                      version:
                        type: string
                        example: '1.1'
                  errors:
                    type: array
                    example:
                      - status: '422'
                        title: 'Validation failed'
                    items:
                      type: object
                      properties:
                        status:
                          type: string
                          example: '422'
                        title:
                          type: string
                          example: 'Validation failed'
      tags:
        - Creditors
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                data:
                  type: object
                  description: ''

                  properties:
                    attributes:
                      type: object
                      description: 'The creditors attributes for this request.'

                      properties:
                        creditor_name:
                          type: string
                          description: 'Must not be greater than 255 characters.'

                        is_first_party_payment:
                          type: boolean
                          description: ''

                    type:
                      type: string
                      description: 'The JSON:API resource type.'
                      example: creditors
                    id:
                      type: string
                      description: 'The resource ID from the path.'
                      example: HCP-ABC-001
                  required:
                    - attributes
                    - type
                    - id
              required:
                - data
    delete:
      summary: 'Delete Creditor'
      operationId: deleteCreditor
      description: 'Deletes an unused creditor. Creditors with existing accounts cannot be deleted.'
      parameters: []
      responses:
        204:
          description: 'Creditor deleted'
          content:
            application/json:
              schema:
                type: object
                example: {}
                properties: {}
        401:
          description: 'User is not authenticated'
          content:
            application/json:
              schema:
                type: object
                example:
                  jsonapi:
                    version: '1.1'
                  errors:
                    -
                      status: '401'
                      title: Unauthenticated.
                properties:
                  jsonapi:
                    type: object
                    properties:
                      version:
                        type: string
                        example: '1.1'
                  errors:
                    type: array
                    example:
                      - status: '401'
                        title: Unauthenticated.
                    items:
                      type: object
                      properties:
                        status:
                          type: string
                          example: '401'
                        title:
                          type: string
                          example: Unauthenticated.
        404:
          description: 'Creditor not found'
          content:
            application/json:
              schema:
                type: object
                example:
                  jsonapi:
                    version: '1.1'
                  errors:
                    -
                      status: '404'
                      title: 'Creditor not found'
                properties:
                  jsonapi:
                    type: object
                    properties:
                      version:
                        type: string
                        example: '1.1'
                  errors:
                    type: array
                    example:
                      - status: '404'
                        title: 'Creditor not found'
                    items:
                      type: object
                      properties:
                        status:
                          type: string
                          example: '404'
                        title:
                          type: string
                          example: 'Creditor not found'
        409:
          description: 'Creditor has accounts'
          content:
            application/json:
              schema:
                type: object
                example:
                  jsonapi:
                    version: '1.1'
                  errors:
                    -
                      status: '409'
                      title: 'Creditor has accounts'
                properties:
                  jsonapi:
                    type: object
                    properties:
                      version:
                        type: string
                        example: '1.1'
                  errors:
                    type: array
                    example:
                      - status: '409'
                        title: 'Creditor has accounts'
                    items:
                      type: object
                      properties:
                        status:
                          type: string
                          example: '409'
                        title:
                          type: string
                          example: 'Creditor has accounts'
      tags:
        - Creditors
    parameters:
      -
        in: path
        name: creditor_id
        description: 'The public creditor identifier.'
        example: HCP-ABC-001
        required: true
        schema:
          type: string
