components:
  schemas:
    ActiveContractsByDate:
      example:
        account_id: 1
        attachments:
        - '9999'
        contract_id: 500001
        mechanical_type:
        - digital
        term_type: label
      properties:
        account_id:
          description: Associated account ID
          type: number
        attachments:
          description: List of attachment identifiers
          items:
            type: string
          type: array
        contract_id:
          description: ID of the contract
          type: number
        mechanical_type:
          description: List of mechanical deduction types (e.g., digital, physical)
          items:
            type: string
          type: array
        term_type:
          description: Type of the term
          type: string
      required:
      - contract_id
      - term_type
      - attachments
      - mechanical_type
      title: Active Contracts By Date
      type: object
    AdjustmentToValidate:
      additionalProperties: false
      properties:
        account_id:
          minLength: 1
          type: string
        activity_month:
          minLength: 1
          type: string
        activity_year:
          minLength: 1
          type: string
        adjustment_type:
          minLength: 1
          type: string
        amount:
          type: number
        client_facing_comments:
          minLength: 1
          type: string
        contract_id:
          minLength: 1
          type: string
        currency:
          minLength: 1
          type: string
        distribution_type:
          minLength: 1
          nullable: true
          type: string
        statement_month:
          minLength: 1
          type: string
        statement_year:
          minLength: 1
          type: string
        upc:
          minLength: 1
          nullable: true
          type: string
      required:
      - account_id
      - activity_month
      - activity_year
      - adjustment_type
      - amount
      - client_facing_comments
      - contract_id
      - currency
      - statement_month
      - statement_year
      type: object
    AutoGenerationInProgressOrError:
      additionalProperties: false
      properties:
        batch_type:
          enum:
          - auto
          - manual
          - upload
          type: string
        statement_period_adjustment_file_id:
          minimum: 0
          type: integer
        statement_period_id:
          minimum: 0
          type: integer
        status:
          minLength: 1
          type: string
      required:
      - statement_period_adjustment_file_id
      - statement_period_id
      - status
      type: object
    ContractAdvanceDetail:
      example:
        advance_description: Advance Description
        advance_status: paid
        amount: 100.0
        amount_after_withholding_and_vat: 100.0
        contract_advance_id: 1
        contract_id: 1
        created_at: '2022-09-08'
        created_by: some_user_id
        currency_code: AUD
        milestone: delivery
        milestone_description: Milestone Description
        vat_amount: 20.0
        withholding_tax_amount: -20.0
      properties:
        advance_description:
          description: A description for contract advance
          type: string
        advance_status:
          description: Either 'not_qualified','qualified','approved','paid' or 'deleted'
          type: string
        amount:
          description: Advance amount
          type: number
        amount_after_withholding_and_vat:
          description: 'Amount after withholding tax and VAT, calculated as amount
            + vat_amount + withholding_tax_amount Calculation examples

            amount = 100.00 vat_amout = 20.00 withholding_tax_amount = 0.00 amount_after_withholding_and_vat
            = 100.00 + 20.00 + 0.00 = 120.00

            amount = 100.00 vat_amout = 20.00 withholding_tax_amount = -20.00 amount_after_withholding_and_vat
            = 100.00 + 20.00 + -20.00 = 100.00'
          type: number
        contract_advance_id:
          description: ID of contract_advance
          type: integer
        contract_id:
          description: ID of contract
          type: integer
        created_at:
          description: datetime the Contract Advance was created
          type: string
        created_by:
          description: User identity the Contract Advance was created by
          type: string
        currency_code:
          description: Alpha-3 iso currency code. default to account's payment currency
          type: string
        milestone:
          description: Either 'contract_execution','delivery','recoupment', 'scheduled_installment','sales_milestone'
            or'other'
          type: string
        milestone_date:
          description: This date field indicates whether or not a milestone has been
            'reached'. If this field is NULL, the milestone has not been reached and
            the advance cannot be paid.
          type: string
        milestone_description:
          description: A description for milestone
          type: string
        note:
          description: A note for advance payment
          type: string
        reference_payment_type_id:
          description: ID of the reference payment type
          type: integer
        us_source_income_rate:
          description: US source income %
          type: number
        vat_amount:
          description: VAT amount
          type: number
        withholding_tax_amount:
          description: Withholding tax amount, expected to be negative
          type: number
      required:
      - contract_id
      - contract_advance_id
      - advance_description
      - amount
      - currency_code
      - milestone
      - milestone_description
      - advance_status
      - created_at
      - created_by
      title: Contract Advance Details
      type: object
    ContractAdvancePaidDetail:
      allOf:
      - $ref: '#/components/schemas/ContractAdvanceDetail'
      - properties:
          advance_amount_payee_currency:
            description: the amount of the advance in the account payment currency
            type: number
          advance_payee_currency_code:
            description: Alpha-3 iso currency code. account's payment currency
            type: integer
          date_paid:
            description: the date on which the advance successfully marked as paid
            type: string
          statement_period_id:
            description: ID of the statement period for the Date Paid
            type: integer
        type: object
      example:
        advance_amount_payee_currency: 100.9
        advance_description: Advance Description
        advance_payee_currency_code: AUD
        advance_status: paid
        amount: 100.0
        amount_after_withholding_and_vat: 100.0
        contract_id: 1
        created_at: '2022-09-08'
        currency_code: AUD
        date_paid: '2022-09-20'
        milestone: delivery
        milestone_description: Milestone Description
        statement_period_id: 1
        vat_amount: 20.0
        withholding_tax_amount: -20.0
      title: Contract Advance Paid details
      type: object
    ContractAdvancePostBody:
      example:
        advance_description: testing one two three
        advance_status: qualified
        amount: 100.0
        currency_code: GBP
        milestone: contract_execution
        milestone_description: words
        note: This is a pretty good example of a note.
        us_source_income_rate: 10.000001
        vat_amount: 20.0
        withholding_tax_amount: -20.0
      properties:
        advance_description:
          description: description for the advance
          type: string
        advance_status:
          default: not_qualified
          description: one of 'not_qualified', 'qualified', 'approved', 'paid', 'deleted'
          type: string
        amount:
          description: currency amount of the advance
          type: number
        currency_code:
          description: ISO currency code
          type: string
        milestone:
          description: One of 'contract_execution', 'delivery', 'recoupment', 'scheduled_installment',
            'sales_milestone', 'other'
          type: string
        milestone_date:
          description: date for the milestone
          type: string
        milestone_description:
          description: description text for the milestone
          type: string
        note:
          description: extra notes to include for the advance
          type: string
        us_source_income_rate:
          description: US source income %
          type: number
        vat_amount:
          description: VAT amount
          type: number
        withholding_tax_amount:
          description: Withholding tax amount, expected to be negative
          type: number
      required:
      - advance_description
      - amount
      - currency_code
      - milestone
      - milestone_description
      - milestone_date
      title: Contract advance post body
      type: object
    ContractAdvancePutBody:
      allOf:
      - $ref: '#/components/schemas/ContractAdvancePostBody'
      - type: object
      title: Contract advance put body
      type: object
    ContractAndLifecyclePostBody:
      properties:
        contract:
          allOf:
          - $ref: '#/components/schemas/ContractPostBody'
          type: object
        contract_lifecycle:
          allOf:
          - $ref: '#/components/schemas/ContractLifecyclePostBody'
          type: object
        contract_lifecycle_schedules:
          items:
            allOf:
            - $ref: '#/components/schemas/ContractLifecycleSchedulePostBody'
            type: object
          type: array
      required:
      - contract
      - contract_lifecycle_schedules
      - contract_lifecycle
      title: ContractAndLifecycle POST request payload
      type: object
    ContractDetails:
      allOf:
      - $ref: '#/components/schemas/ContractPostBody'
      - properties:
          contract_id:
            description: ID of the contract
            type: integer
          initial_start_date:
            description: date on which the contract is first activated
            type: string
          is_excluded_from_accounting_run:
            description: whether a contract should be used during the accounting run
              calculation(by default all contracts are included)
            type: boolean
          sap_created_at:
            description: date contract data was sent to SAP
            type: string
        type: object
      example:
        account_id: 12
        contract_id: 10
        contract_name: Best Contract
        contract_type: distribution
        execution_date: None
        general_note: Best Contract general notes
        initial_start_date: '2019-06-01'
        is_excluded_from_accounting_run: false
        oa_contract_id: 123
        reference_signing_entity_id: 1
        sap_created_at: '2022-06-01'
        summary_note: Best Contract summary notes
        is_primary_contract: True
      title: Contract Details
      type: object
    ContractExclusion:
      additionalProperties: false
      example:
        contract_exclusion_id: 1
        contract_id: 1
        exclusions:
          countries:
          - USA
          - CAN
          stores:
          - '123'
          - '456'
      properties:
        contract_exclusion_id:
          description: Id of contract exclusion
          minimum: 0
          type: integer
        contract_id:
          description: Id of contract
          minimum: 0
          type: integer
        exclusions:
          allOf:
          - $ref: '#/components/schemas/Exclusions'
          description: Country/territory and store/service exclusions
      required:
      - contract_exclusion_id
      - contract_id
      title: Contract Distribution Exclusion Details
      type: object
    ContractExclusionDetails:
      example:
        contract_exclusion_id: 1
        contract_id: 1
        exclusions:
          countries:
          - USA
          - CAN
          stores:
          - '123'
          - '456'
      properties:
        contract_exclusion_id:
          description: Id of contract exclusion
          type: integer
        contract_id:
          description: Id of contract
          type: integer
        exclusions:
          allOf:
          - $ref: '#/components/schemas/ContractExclusionPostBody'
          description: Country/territory and store/service exclusions
          type: object
      title: Contract Distribution Exclusion Details
      type: object
    ContractExclusionListResponse:
      additionalProperties: false
      properties:
        items:
          items:
            $ref: '#/components/schemas/ContractExclusion'
          type: array
        total:
          type: integer
      required:
      - total
      type: object
    ContractExclusionPostBody:
      example:
        countries:
        - USA
        - CAN
        stores:
        - '123'
        - '456'
      properties:
        countries:
          items:
            description: List of country codes to be excluded from contract distribution
            type: string
          type: array
        stores:
          items:
            description: List of store_ids to be excluded from contract distribution
            type: string
          type: array
      title: Contract Exclusion POST request body
      type: object
    ContractFlowthroughDetail:
      example:
        contract_flowthrough_id: 1
        contract_id: 500000
        flowthrough_rate: 5.1
        flowthrough_status: active
        has_automatic_shutoff: true
        previous_flowthrough_status: active
        recoupment_cap: 190831
        reference_flowthrough_calculation_id: 1
        status_last_modified: 2025-02-28
        status_last_modified_by: e7d3k7bd-a66h-4151-959f-a65767ccc473
      properties:
        contract_flowthrough_id:
          description: ID of the contract_flowthrough
          type: number
        contract_id:
          description: Foreign key to contract table
          type: number
        flowthrough_rate:
          description: percentage of revenue that would be paid
          type: string
        flowthrough_status:
          description: active, shutoff, or paused
          type: string
        has_automatic_shutoff:
          description: whether to pay flowthrough. default is True
          type: boolean
        previous_flowthrough_status:
          description: active, shutoff, or paused
          type: string
        recoupment_cap:
          description: recoupment amount
          type: string
        reference_flowthrough_calculation_id:
          description: Foreign key to reference_flowthrough_calculation table
          type: number
        status_last_modified:
          description: the date when the flowthrough status is updated
          type: string
        status_last_modified_by:
          description: an identity id of the user who updated the flowthrough status.
          type: string
      required:
      - contract_flowthrough_id
      - contract_id
      - reference_flowthrough_calculation_id
      - flowthrough_rate
      - flowthrough_status
      title: Contract Flowthrough Detail
      type: object
    ContractFlowthroughPostBody:
      example:
        contract_id: 500000
        flowthrough_rate: 5.1
        has_automatic_shutoff: true
        recoupment_cap: 190831
        reference_flowthrough_calculation_id: 1
      properties:
        contract_id:
          description: Foreign key to contract table
          type: number
        flowthrough_rate:
          description: percentage of revenue that would be paid
          type: string
        has_automatic_shutoff:
          description: whether to pay flowthrough. default is True
          type: boolean
        recoupment_cap:
          description: recoupment amount
          type: string
        reference_flowthrough_calculation_id:
          description: Foreign key to reference_flowthrough_calculation table
          type: number
      required:
      - contract_id
      - reference_flowthrough_calculation_id
      - flowthrough_rate
      - has_automatic_shutoff
      title: Contract Flowthrough POST request body
      type: object
    ContractFlowthroughPutBody:
      example:
        contract_id: 500000
        flowthrough_rate: 5.1
        flowthrough_status: active
        has_automatic_shutoff: true
        recoupment_cap: 190831
        reference_flowthrough_calculation_id: 1
      properties:
        flowthrough_rate:
          description: percentage of revenue that would be paid
          type: string
        flowthrough_status:
          description: active, shutoff, or paused
          type: string
        has_automatic_shutoff:
          description: whether to pay flowthrough. default is True
          type: boolean
        recoupment_cap:
          description: recoupment amount
          type: string
        reference_flowthrough_calculation_id:
          description: Foreign key to reference_flowthrough_calculation table
          type: number
      title: Contract Flowthrough PUT request body
      type: object
    ContractLifecycleDetail:
      example:
        collection_end: None
        collection_start: None
        contract_id: 1
        contract_lifecycle_id: 1
        contract_lifecycle_schedule_id: 1
        lifecycle_status: active
        lifecycle_term_end: None
        lifecycle_term_start: '2024-07-03'
        renewal_effective: None
        termination_effective: None
        termination_notice_deadline: None
        termination_notice_received: None
      properties:
        collection_end:
          description: date field used by NR contracts only and is determined using
            the lifecycle_term_end plus the collection_start date
          type: string
        collection_start:
          description: date field used by NR contracts only and it will always be
            the day after the lifecycle_term_end
          type: string
        contract_id:
          description: Foreign key to contract table
          type: number
        contract_lifecycle_id:
          description: ID of the contract_lifecycle
          type: number
        contract_lifecycle_schedule_id:
          description: Foreign key to contract_lifecycle_schedule table
          type: number
        lifecycle_status:
          description: init, active, to_be_terminated, terminated, in_collection_period
            or inactive
          type: string
        lifecycle_term_end:
          description: contract's term end date
          type: string
        lifecycle_term_start:
          description: contract's term start date
          type: string
        renewal_effective:
          description: contract's renewal date and it is same as lifecycle_term_end
            column
          type: string
        termination_effective:
          description: date set by the user when they terminate a contract
          type: string
        termination_notice_deadline:
          description: date indicates how long before the contract ends that a client
            must inform the business that they wish to terminate a contract
          type: string
        termination_notice_received:
          description: date explicitly set by the user when they choose to terminate
            a contract
          type: string
      title: Contract Lifecycle Detail
      type: object
    ContractLifecycleIdsPostBody:
      example:
      - 1
      - 2
      - 3
      - 4
      items:
        description: ContractLifecycle ids list
        type: integer
      title: POST request body
      type: array
    ContractLifecyclePostBody:
      example:
        lifecycle_term_start: '2024-07-03'
      properties:
        lifecycle_term_start:
          description: contract's term start date
          type: string
      required:
      - lifecycle_term_start
      title: ContractLifecycle POST request payload
      type: object
    ContractLifecyclePutBody:
      example:
        lifecycle_term_start: '2024-07-03'
      properties:
        lifecycle_term_start:
          description: Contract's term start date
          type: string
      title: ContractLifecycle PUT request payload
      type: object
    ContractLifecycleScheduleDetailDataloaderResponse:
      properties:
        data:
          $ref: '#/components/schemas/ContractLifecycleScheduleDetailResponse'
      title: Contract Lifecycle Schedule Detail Dataloader Response
      type: object
    ContractLifecycleScheduleDetailResponse:
      allOf:
      - properties:
          contract_lifecycle_schedule_detail_id:
            description: ID of the contract lifecycle schedule detail
            type: integer
          period_interval:
            description: The interval of the period
            type: integer
          period_type:
            description: The type of the period
            type: string
        type: object
      example:
        contract_lifecycle_schedule_detail_id: 1
        period_interval: 1
        period_type: month
      title: Contract Lifecycle Schedule Detail GET Response
      type: object
    ContractLifecycleScheduleIdsPostBody:
      example:
      - 1
      - 2
      - 3
      - 4
      items:
        description: ContractLifecycleSchedule ids list
        type: integer
      title: POST request body
      type: array
    ContractLifecycleSchedulePostBody:
      example:
        collection_period_detail_interval: 1
        collection_period_detail_type: year
        contract_lifecycle:
          lifecycle_term_start: '2024-07-03'
        renewal_offset_detail_interval: 18
        renewal_offset_detail_type: month
        renewal_type: renew_after_certain_date
        schedule_end: '2028-06-01'
        termination_notice_detail_interval: 1
        termination_notice_detail_type: month
      properties:
        collection_period_detail_interval:
          description: This can be number of days, months or years
          type: number
        collection_period_detail_type:
          description: Either day, month or year
          type: string
        contract_lifecycle:
          allOf:
          - $ref: '#/components/schemas/ContractLifecyclePostBody'
          description: Optionally create the contract_lifecycle
          type: object
        renewal_offset_detail_interval:
          description: This can be number of days, months or years
          type: number
        renewal_offset_detail_type:
          description: Either day, month or year
          type: string
        renewal_type:
          description: Either continuously_active, renew_after_certain_date or renew_periodically
          type: string
        schedule_end:
          description: End date for contract_lifecycle_schedule and will only have
            a value when the renewal_type is "renew_after_certain_date"
          type: string
        termination_notice_detail_interval:
          description: This can be number of days, months or years
          type: number
        termination_notice_detail_type:
          description: Either day, month or year
          type: string
      required:
      - termination_notice_detail_interval
      - termination_notice_detail_type
      - renewal_type
      title: ContractLifecycleSchedule post request payload
      type: object
    ContractLifecycleSchedulePutBody:
      allOf:
      - $ref: '#/components/schemas/ContractLifecycleSchedulePostBody'
      - properties:
          contract_lifecycle_schedule_id:
            description: ID of the contract_lifecycle_schedule
            type: integer
        type: object
      example:
        collection_period_detail_interval: 1
        collection_period_detail_type: year
        contract_lifecycle_schedule_id: 1
        renewal_offset_detail_interval: 18
        renewal_offset_detail_type: month
        renewal_type: renew_after_certain_date
        schedule_end: '2028-06-01'
        termination_notice_detail_interval: 1
        termination_notice_detail_type: month
      required:
      - termination_notice_detail_interval
      - termination_notice_detail_type
      - renewal_type
      title: ContractLifecycleSchedule PUT request payload
      type: object
    ContractLifecycleScheduleResponse:
      example:
        collection_period_detail_id: 1
        contract_id: 1
        contract_lifecycle_schedule_id: 1
        renewal_offset_detail_id: 2
        renewal_type: renew_periodically
        schedule_end: '2024-07-12'
        termination_notice_detail_id: 1
      properties:
        collection_period_detail_id:
          description: Foreign key to contract_lifecycle_schedule_detail
          type: number
        contract_id:
          description: Foreign key to contract table
          type: number
        contract_lifecycle_schedule_id:
          description: ID of the contract_lifecycle_schedule
          type: number
        renewal_offset_detail_id:
          description: Foreign key to contract_lifecycle_schedule_detail
          type: number
        renewal_type:
          description: Either continuously_active, renew_after_certain_date or renew_periodically
          type: string
        schedule_end:
          description: End date for contract_lifecycle_schedule and will only have
            a value when the renewal_type is "renew_after_certain_date"
          type: string
        termination_notice_detail_id:
          description: Foreign key to contract_lifecycle_schedule_detail table
          type: number
      title: Contract Lifecycle Schedule Response
      type: object
    ContractMechanicalDeductionDetail:
      allOf:
      - $ref: '#/components/schemas/ContractMechanicalDeductionPostBody'
      - properties:
          contract_id:
            description: id of parent contract.
            type: number
          contract_mechanical_deduction_id:
            description: id of the contract_mechanical_deduction.
            type: number
        type: object
      example:
        admin_fee: '20.20'
        admin_type: business
        contract_id: 1
        contract_mechanical_deduction_id: 1
        mechanical_type:
        - digital
        - physical
        territory: USA
      required:
      - contract_mechanical_deduction_id
      - contract_id
      - territory
      - admin_fee
      - admin_type
      - mechanical_type
      title: ContractMechanicalDeduction detail
      type: object
    ContractMechanicalDeductionPostBody:
      example:
        admin_fee: '20.20'
        admin_type: business
        mechanical_type:
        - digital
        - physical
        territory: USA
      properties:
        admin_fee:
          description: The amount, if any, The Orchard deducts for distribution.
          type: number
        admin_type:
          description: The entity responsible for paying the mechanical deduction.
            One of 'business', 'customer', or 'both'.
          type: string
        mechanical_type:
          description: List of mechanical deduction types. Either 'digital' or 'physical'.
          items:
            type: string
          type: array
        territory:
          description: 3 character territory code.
          type: string
      required:
      - territory
      - admin_type
      - mechanical_type
      title: ContractMechanicalDeduction POST request payload
      type: object
    ContractMechanicalDeductionPutBody:
      example:
        admin_fee: '20.20'
        admin_type: business
        mechanical_type:
        - digital
        - physical
      properties:
        admin_fee:
          description: The amount, if any, The Orchard deducts for distribution.
          type: number
        admin_type:
          description: The entity responsible for paying the mechanical deduction.
            One of 'business', 'customer', or 'both'.
          type: string
        mechanical_type:
          description: List of mechanical deduction types. Either 'digital' or 'physical'.
          items:
            type: string
          type: array
      required:
      - admin_type
      - mechanical_type
      title: ContractMechanicalDeduction PUT request payload
      type: object
    ContractPartyDetails:
      allOf:
      - $ref: '#/components/schemas/ContractPartyPostBody'
      - properties:
          contract_party_id:
            description: id of the contract_pary
            type: integer
        type: object
      example:
        contract: 1
        contract_party_id: 1
        target_id: 1ec7c1bf-2318-4052-9406-a3e35a620bd3
        target_type: contributor
      title: ContractParty Details
      type: object
    ContractPartyPostBody:
      example:
        contract: 1
        target_id: 1ec7c1bf-2318-4052-9406-a3e35a620bd3
        target_type: contributor
      properties:
        contract_id:
          description: id of the related contract
          type: integer
        target_id:
          description: id of the related target_type
          type: string
        target_type:
          description: must be one of 'contributor', 'label'
          type: string
      title: ContractParty POST request body
      type: object
    ContractPostBody:
      example:
        account_id: 123
        contract_name: Best Contract
        contract_type: distribution
        execution_date: '2020-01-01'
        general_note: Best Contract general notes
        oa_contract_id: 123
        reference_signing_entity_id: 1
        summary_note: Best Contract summary notes
        is_primary_contract: True
      properties:
        account_id:
          description: The contract's account ID
          type: integer
        contract_id:
          description: The contract's ID (optional argument)
          type: integer
        contract_name:
          description: The contract's name
          type: string
        contract_type:
          default: distribution
          description: The type of contract being created
          enum:
          - distribution
          - legacy_distribution
          - neighbouring_rights
          type: string
        execution_date:
          description: date on which the contract was countersigned
          type: string
        general_note:
          description: General notes related to the contract
          type: string
        oa_contract_id:
          description: ID of OA contract
          type: integer
        reference_signing_entity_id:
          description: ID of related reference_signing_entity
          type: integer
        is_primary_contract:
          description: whether distribution contract is primary or not
          type: boolean
        summary_note:
          description: Summary notes related to the contract
          type: string
        term_end:
          deprecated: true
          description: The contract's term end date
          type: string
        term_start:
          deprecated: true
          description: The contract's term start date
          type: string
      required:
      - contract_name
      - contract_type
      title: Contract post body
      type: object
    ContractPutBody:
      example:
        contract_name: Best Contract
        execution_date: '2019-08-08'
        general_note: Best Contract general notes
        is_excluded_from_accounting_run: 1
        reference_signing_entity_id: 1
        sap_created_at: '2019-06-01'
        summary_note: Best Contract summary notes
        is_primary_contract: True
      properties:
        contract_name:
          description: contract's name
          type: string
        execution_date:
          description: date on which the contract was countersigned
          type: string
        general_note:
          description: General notes related to the contract
          type: string
        initial_start_date:
          description: date on which the contract is first activated
          type: string
        is_excluded_from_accounting_run:
          description: whether a contract should be used during the accounting run
            calculation(by default all contracts are included)
          type: boolean
        reference_signing_entity_id:
          description: ID of related reference_signing_entity
          type: integer
        is_primary_contract:
          description: whether distribution contract is primary or not
          type: boolean
        sap_created_at:
          description: date contract data was sent to SAP
          type: string
        summary_note:
          description: Summary notes related to the contract
          type: string
        term_end:
          deprecated: true
          description: contract's term end date
          type: string
        term_start:
          deprecated: true
          description: contract's term start date
          type: string
      title: Contract Put Body
      type: object
    ContractReserveDetail:
      example:
        condition:
          transaction_types:
          - 49
          - 50
        contract_id: 1
        contract_reserve_id: 1
        installments_in_months: 2
        reserve_rate: 1.8
        reserve_release_offset_in_months: 1
        reserve_schedule:
        - '0.500000000000'
        - '0.500000000000'
      properties:
        contract_id:
          description: The Id of the contract
          type: number
        contract_reserve_id:
          description: The Id of the contract-reserve
          type: number
        installments_in_months:
          description: The number of months that reserves taken will be divided across;
            1 - 24
          type: number
        release_schedule:
          description: List of splitted rates
          items:
            type: string
          type: array
        reserve_rate:
          description: The percentage of reserves to be held
          type: number
        reserve_release_offset_in_months:
          description: The number of months from when reserves are taken that they
            begin to be released; 1 - 24
          type: number
      title: Contract Reserve Details
      type: object
    ContractReserveDetailWithAccountId:
      allOf:
      - $ref: '#/components/schemas/ContractReserveDetail'
      - properties:
          account_id:
            description: ID of an account
            type: integer
        type: object
      example:
        account_id: 1
        condition:
          transaction_types:
          - 49
          - 50
        contract_id: 1
        contract_reserve_id: 1
        installments_in_months: 2
        reserve_rate: 1.8
        reserve_release_offset_in_months: 1
        reserve_schedule:
        - '0.500000000000'
        - '0.500000000000'
      title: Contract Reserve Details with Account Id
      type: object
    ContractReservePostBody:
      example:
        installments_in_months: 2
        reserve_rate: 1.8
        reserve_release_offset_in_months: 1
      properties:
        installments_in_months:
          description: The number of months that reserves taken will be divided across;
            1 - 24
          type: number
        release_schedule:
          description: List of splitted rates
          items:
            type: string
          type: array
        reserve_rate:
          description: The percentage of reserves to be held
          type: number
        reserve_release_offset_in_months:
          description: The number of months from when reserves are taken that they
            begin to be released; 1 - 24
          type: number
      required:
      - installments_in_months
      - reserve_rate
      - reserve_release_offset_in_months
      title: Contract Reserve POST body
      type: object
    ContractTermConditionDetail:
      allOf:
      - $ref: '#/components/schemas/ContractTermConditionPostBody'
      - properties:
          contract_term_condition_id:
            description: The contract term condition's ID
            type: integer
        type: object
      example:
        commission: 79.8
        conditions:
        - countries:
          - MEX
          - USA
        - stores:
          - 22
          - 33
        - transaction_types: []
        contract_term_condition_id: 789
        contract_term_condition_name: Condition name
        contract_term_id: 123
        priority: 1
        term_rate: 20.2
      title: Contract Term Condition Detail
      type: object
    ContractTermConditionPostBody:
      example:
        commission: 79.8
        conditions:
        - countries:
          - MEX
          - USA
        - stores:
          - 22
          - 33
        - transaction_types: []
        contract_term_condition_name: Condition name
        contract_term_id: 123
        priority: 1
        term_rate: 20.2
      properties:
        commission:
          description: Percentage at which the commission should be applied to transactions
            (sales) meeting all the conditions of the contract (the sum of commission
            and term_rate should equal to 100)
          type: number
        conditions:
          properties:
            countries:
              items:
                description: A list of three-letter iso country codes for which the
                  contract term should be applied
                type: string
              type: array
            stores:
              items:
                description: A list of store_ids for which the contract term should
                  be applied
                type: string
              type: array
            transaction_types:
              items:
                description: A list of transaction_type_ids for which the contract
                  term should be applied
                type: string
              type: array
          type: object
        contract_term_condition_name:
          description: Contract term condition name
          type: string
        contract_term_id:
          description: The ID of the parent contract term
          type: integer
        priority:
          description: Priority in which the contract_term_condition should be applied
            during an accounting run calculation. Defaults to 1.
          minimum: 1
          type: integer
        term_rate:
          description: Percentage at which the term_rate should be applied to transactions
            (sales) meeting all the conditions of the contract (the sum of commission
            and term_rate should equal to 100)
          type: number
      required:
      - contract_term_id,
      - term_rate
      title: Contract Term Condition post body
      type: object
    ContractTermDetail:
      allOf:
      - $ref: '#/components/schemas/ContractTermPostBody'
      - properties:
          contract_term_id:
            description: The contract term's ID
            type: integer
        type: object
      title: Contract Term Detail
      type: object
    ContractTermPostBody:
      example:
        attachments:
        - 10
        - 18
        attachments_relations:
          label_ids:
          - 12
          - 25
          upcs: []
        contract_id: 456
        contract_term_name: Test contract term
        is_base_term: true
        schedule_ids:
        - '1'
        - '2'
        term_type: product
      properties:
        attachments:
          items:
            description: Unique identifiers coinciding with the term_type
            type: string
          type: array
        attachments_relations:
          properties:
            label_ids:
              items:
                type: string
              type: array
            upcs:
              items:
                type: string
              type: array
          type: object
        contract_id:
          description: The ID of the parent contract
          type: integer
        contract_term_name:
          description: Name of the contract term
          type: string
        is_base_term:
          description: Whether or not the contract_term is the base term for the specified
            contract
          type: boolean
        schedule_ids:
          items:
            description: a list of schedule ids.
            type: string
          type: array
        term_type:
          description: The term type; one of 'label', 'product', 'artist', 'catalog',
            'label', 'contributor_schedule', or 'contribution_schedule'
          type: string
      required:
      - contract_id
      - term_type
      - attachments
      title: Contract Term post body
      type: object
    ContractTermPutBody:
      example:
        attachments:
        - 10
        - 18
        attachments_relations:
          label_ids:
          - 12
          - 25
          upcs:
          - 12345
          - 54321
        contract_term_name: Test contract term
        schedule_ids:
        - '1'
        - '2'
        term_type: contributor_schedule
      properties:
        attachments:
          items:
            description: Unique identifiers coinciding with the term_type
            type: string
          type: array
        attachments_relations:
          properties:
            label_ids:
              items:
                type: string
              type: array
            upcs:
              items:
                type: string
              type: array
          type: object
        contract_term_name:
          description: Name of the contract term (Updates only when existing contract
            type is 'contributor_schedule' or 'contribution_schedule')
          type: string
        schedule_ids:
          items:
            description: a list of schedule ids.
            type: string
          type: array
        term_type:
          description: The term type; one of 'label', 'product', 'artist', 'catalog',
            'label', 'contributor_schedule', or 'contribution_schedule' (Updates only
            when existing contract type is 'contributor_schedule' or 'contribution_schedule')
          type: string
      required:
      - attachments
      title: Contract Term put body
      type: object
    ContractTermScheduleDetail:
      example:
        contract_term_id: 1
        contract_term_schedule_id: 1
        schedule_id: 1
      properties:
        contract_term_id:
          description: id (fk) of the related contract_term
          type: integer
        contract_term_schedule_id:
          description: id of contract_term_schedule
          type: integer
        schedule_id:
          description: id (fk) of the related schedule
          type: integer
      required:
      - contract_term_schedule_id
      - contract_term_id
      - schedule_id
      title: ContractTermSchedule Detail
      type: object
    ContractTerminationBody:
      example:
        termination_effective: '2024-08-27'
        termination_notice_received: '2024-08-20'
      properties:
        termination_effective:
          description: date contract is terminated
          type: string
        termination_notice_received:
          description: date notice of termination was received
          type: string
      required:
      - termination_effective
      title: Terminate Contract Put Body
      type: object
    ContractTermsAttachmentsPostBody:
      example:
        attachments:
        - 10
        - 18
        term_type: product
      properties:
        attachments:
          items:
            description: Unique identifiers coinciding with the term_type
            type: string
          type: array
        term_type:
          description: The term type; one of 'label', 'product', 'artist', 'catalog',
            or 'label'
          type: string
      title: POST body to get contract terms by attachments and term_type
      type: object
    ContractVatInfoDetail:
      example:
        account_id: 789
        account_is_sba_signed: true
        client_tax_rate: 20.0
        contract_id: 123
        country_of_tax_residence: GBR
        supplier_tax_rate: 20.0
      properties:
        account_id:
          description: Account ID
          type: integer
        account_is_sba_signed:
          description: Is SBA signed
          type: boolean
        client_tax_rate:
          description: VAT Percentage for Client Accounts
          type: number
        contract_id:
          description: Contract ID
          type: integer
        country_of_tax_residence:
          description: Alpha-3 code of the country of tax residence
          type: string
        supplier_tax_rate:
          description: VAT Percentage for Supplier Accounts
          type: number
      title: Contract Vat Info Detail
      type: object
    ContractWorldWideMechanicalDeductionPostBody:
      allOf:
      - $ref: '#/components/schemas/ContractMechanicalDeductionPutBody'
      example:
        admin_fee: '20.20'
        admin_type: business
        mechanical_type:
        - digital
        - physical
      required:
      - admin_type
      - mechanical_type
      title: ContractMechanicalDeduction POST request payload for worldwide
      type: object
    ContractsDataloaderResponse:
      properties:
        data:
          $ref: '#/components/schemas/ContractsDataloaderResponse'
      title: Contracts Dataloader Response
      type: object
    DagRunTimes:
      example:
        average_run_time_seconds: 300.5
        count: 10
        dag_id: accounting_run_calculate
        max_run_time_seconds: 400.0
        median_run_time_seconds: 290.0
        min_run_time_seconds: 250.0
        p95_run_time_seconds: 390.0
      properties:
        average_run_time_seconds:
          description: average time of all the runs for the Dag in seconds
          type: number
        count:
          description: the number of runs
          type: number
        dag_id:
          description: ID of the DAG
          type: string
        max_run_time_seconds:
          description: maximum time of all the runs for the Dag in seconds
          type: number
        median_run_time_seconds:
          description: median time of all the runs for the Dag in seconds
          type: number
        min_run_time_seconds:
          description: minimum time of all the runs for the Dag in seconds
          type: number
        p95_run_time_seconds:
          description: 95th percentile time of all the runs for the Dag in seconds
          type: number
      title: Dag Run Times response
      type: object
    DataloadedContractLifecycleList:
      properties:
        data:
          $ref: '#/components/schemas/ContractLifecycleDetail'
      title: Dataloaded ContractLifecycle list schema
      type: object
    DataloadedContractLifecycleScheduleList:
      properties:
        data:
          $ref: '#/components/schemas/ContractLifecycleScheduleResponse'
      title: Dataloaded ContractLifecycleSchedule list schema
      type: object
    EarningsTransferDetail:
      additionalProperties: false
      properties:
        active:
          type: boolean
        comment:
          minLength: 1
          nullable: true
          type: string
        created_at:
          format: null
          pattern: null
          type: string
        earnings_transfer_id:
          minimum: 0
          type: integer
        from_contract_id:
          minimum: 0
          type: integer
        input:
          enum:
          - closing_balance
          - gross_revenue
          - net_revenue
          type: string
        negative:
          type: boolean
        rate_type:
          enum:
          - flat_rate
          - percent
          type: string
        to_contract_id:
          minimum: 0
          type: integer
        transfer_amount:
          type: number
        transfer_type:
          enum:
          - cross_recoup
          - reclass
          - override
          - transfer
          - nr_transfer
          type: string
        use_static_balance:
          type: boolean
      required:
      - active
      - created_at
      - earnings_transfer_id
      - from_contract_id
      - negative
      - to_contract_id
      - transfer_amount
      - transfer_type
      - use_static_balance
      type: object
    EarningsTransferPost:
      additionalProperties: false
      properties:
        active:
          type: boolean
        comment:
          minLength: 1
          nullable: true
          type: string
        from_contract_id:
          minimum: 0
          type: integer
        input:
          enum:
          - closing_balance
          - gross_revenue
          - net_revenue
          type: string
        negative:
          type: boolean
        rate_type:
          enum:
          - flat_rate
          - percent
          type: string
        to_contract_id:
          minimum: 0
          type: integer
        transfer_amount:
          type: number
        transfer_type:
          enum:
          - cross_recoup
          - reclass
          - override
          - transfer
          - nr_transfer
          type: string
        use_static_balance:
          type: boolean
      required:
      - from_contract_id
      - negative
      - to_contract_id
      - transfer_amount
      - transfer_type
      type: object
    EarningsTransferPut:
      additionalProperties: false
      properties:
        active:
          type: boolean
        comment:
          minLength: 1
          nullable: true
          type: string
        earnings_transfer_id:
          minimum: 0
          type: integer
        from_contract_id:
          minimum: 0
          type: integer
        input:
          enum:
          - closing_balance
          - gross_revenue
          - net_revenue
          type: string
        negative:
          type: boolean
        rate_type:
          enum:
          - flat_rate
          - percent
          type: string
        to_contract_id:
          minimum: 0
          type: integer
        transfer_amount:
          type: number
        transfer_type:
          enum:
          - cross_recoup
          - reclass
          - override
          - transfer
          - nr_transfer
          type: string
        use_static_balance:
          type: boolean
      required:
      - earnings_transfer_id
      type: object
    Exclusions:
      additionalProperties: false
      example:
        countries:
        - USA
        - CAN
        stores:
        - '123'
        - '456'
      properties:
        countries:
          description: List of country codes to be excluded from contract distribution
          items:
            type: string
          type: array
        stores:
          description: List of store_ids to be excluded from contract distribution
          items:
            type: string
          type: array
      required:
      - countries
      - stores
      title: Contract Exclusion POST request body
      type: object
    FileUploadConfigDetail:
      additionalProperties: false
      properties:
        allowed_file_types:
          description: List of allowed file extensions (without leading dot)
          example: &id001
          - xlsx
          - csv
          - txt
          items:
            type: string
          nullable: true
          type: array
        description:
          description: Description of this upload configuration
          example: Configuration for adjustment file uploads
          nullable: true
          type: string
        event_name:
          description: event can trigger a lambda or an Airflow DAG
          example: event for adjustment file approve
          nullable: true
          type: string
        file_upload_config_id:
          description: Unique identifier for the upload configuration
          example: 1
          minimum: 0
          type: integer
        max_file_size_bytes:
          description: Maximum allowed file size in bytes (up to 5TB)
          example: 104857600
          type: integer
        min_multipart_chunk_size_bytes:
          description: Minimum chunk size for multipart uploads (5MB - 5GB)
          example: 5242880
          nullable: true
          type: integer
        multipart_threshold_bytes:
          description: File size threshold for using multipart upload (5MB - 5GB)
          example: 104857600
          nullable: true
          type: integer
        s3_key_template:
          description: S3 key template for organizing uploaded files. Supports variables
            like {date}, {uuid}
          example: uploads/{date}/{uuid}.{ext}
          minLength: 1
          type: string
        upload_type:
          description: Type of upload this configuration applies to
          enum:
          - adjustments
          - flowthrough
          example: adjustments
          type: string
      type: object
    FileUploadConfigDetailVerbose:
      additionalProperties: false
      properties:
        allowed_file_types:
          description: List of allowed file extensions (without leading dot)
          example: *id001
          items:
            type: string
          nullable: true
          type: array
        created_at:
          description: Timestamp when the configuration was created
          example: '2025-11-24T04:35:43.396Z'
          format: null
          pattern: null
          type: string
        created_by:
          description: User identity ID of the user who created the configuration
          example: '12345'
          type: string
        deleted_at:
          description: Timestamp when the configuration was deleted (soft delete)
          example: null
          format: null
          nullable: true
          pattern: null
          type: string
        deleted_by:
          description: User identity ID of the user who deleted the configuration
          example: '67890'
          nullable: true
          type: string
        description:
          description: Description of this upload configuration
          example: Configuration for adjustment file uploads
          nullable: true
          type: string
        event_name:
          description: event can trigger a lambda or an Airflow DAG
          example: event for adjustment file approve
          nullable: true
          type: string
        file_upload_config_id:
          description: Unique identifier for the upload configuration
          example: 1
          minimum: 0
          type: integer
        last_modified:
          description: Timestamp when the configuration was last modified
          example: '2025-11-24T04:36:15.123Z'
          format: null
          pattern: null
          type: string
        last_modified_by:
          description: User identity ID of the user who last modified the configuration
          example: '12345'
          type: string
        max_file_size_bytes:
          description: Maximum allowed file size in bytes (up to 5TB)
          example: 104857600
          type: integer
        min_multipart_chunk_size_bytes:
          description: Minimum chunk size for multipart uploads (5MB - 5GB)
          example: 5242880
          nullable: true
          type: integer
        multipart_threshold_bytes:
          description: File size threshold for using multipart upload (5MB - 5GB)
          example: 104857600
          nullable: true
          type: integer
        s3_key_template:
          description: S3 key template for organizing uploaded files. Supports variables
            like {date}, {uuid}
          example: uploads/{date}/{uuid}.{ext}
          minLength: 1
          type: string
        upload_type:
          description: Type of upload this configuration applies to
          enum:
          - adjustments
          - flowthrough
          example: adjustments
          type: string
      type: object
    FileUploadConfigPost:
      additionalProperties: false
      properties:
        allowed_file_types:
          description: List of allowed file extensions (without leading dot). Null
            allows all types
          example:
          - xlsx
          - csv
          - txt
          items:
            type: string
          nullable: true
          type: array
        description:
          description: Description of this upload configuration
          example: Configuration for adjustment file uploads
          nullable: true
          type: string
        event_name:
          description: An event that can be configured to trigger a lambda or an Airflow
            DAG
          example: event for adjustment file approve
          nullable: true
          type: string
        max_file_size_bytes:
          description: Maximum allowed file size in bytes (0 to 5TB)
          example: 104857600
          type: integer
        min_multipart_chunk_size_bytes:
          description: Minimum chunk size for multipart uploads. Must be between 5MB
            and 5GB
          example: 5242880
          nullable: true
          type: integer
        multipart_threshold_bytes:
          description: File size threshold for using multipart upload. Must be between
            5MB and 5GB
          example: 104857600
          nullable: true
          type: integer
        s3_key_template:
          description: S3 key template for organizing uploaded files. Supports variables
            like {date}, {uuid}, {ext}
          example: uploads/{date}/{uuid}.{ext}
          minLength: 1
          type: string
        upload_type:
          description: Type of upload this configuration applies to
          enum:
          - adjustments
          - flowthrough
          example: adjustments
          type: string
      required:
      - s3_key_template
      - upload_type
      type: object
    FileUploadConfigPut:
      additionalProperties: false
      properties:
        allowed_file_types:
          description: List of allowed file extensions (without leading dot). Null
            allows all types
          example:
          - xlsx
          - csv
          - txt
          items:
            type: string
          nullable: true
          type: array
        description:
          description: Description of this upload configuration
          example: Updated configuration for adjustment file uploads
          nullable: true
          type: string
        event_name:
          description: An event that can be configured to trigger a lambda or an Airflow
            DAG
          example: event for adjustment file approve
          nullable: true
          type: string
        max_file_size_bytes:
          description: Maximum allowed file size in bytes (0 to 5TB)
          example: 104857600
          type: integer
        min_multipart_chunk_size_bytes:
          description: Minimum chunk size for multipart uploads. Must be between 5MB
            and 5GB
          example: 5242880
          nullable: true
          type: integer
        multipart_threshold_bytes:
          description: File size threshold for using multipart upload. Must be between
            5MB and 5GB
          example: 104857600
          nullable: true
          type: integer
        s3_key_template:
          description: S3 key template for organizing uploaded files. Supports variables
            like {date}, {uuid}, {ext}
          example: uploads/{date}/{uuid}.{ext}
          minLength: 1
          type: string
      type: object
    FileUploadDetail:
      additionalProperties: false
      properties:
        completed_at:
          description: Timestamp when upload was completed
          example: '2025-11-24T04:35:43.396Z'
          format: null
          nullable: true
          pattern: null
          type: string
        error_message:
          description: Error message if upload failed
          example: null
          nullable: true
          type: string
        expires_at:
          description: Timestamp when upload URLs expire
          example: '2025-11-24T05:35:43.396Z'
          format: null
          nullable: true
          pattern: null
          type: string
        file_key:
          description: Unique key identifying this file upload
          example: a2c96ff7-e7a0-42fd-aad1-1b8436940d35
          minLength: 1
          type: string
        file_size_bytes:
          description: Size of the file in bytes
          example: 10485760
          type: integer
        file_type:
          description: Type of file upload
          example: adjustments
          nullable: true
          type: string
        file_upload_config_id:
          description: ID of the upload configuration used
          example: 1
          minimum: 0
          type: integer
        file_upload_id:
          description: Unique identifier for the file upload
          example: 12345
          minimum: 0
          type: integer
        md5sum:
          description: MD5 hash of the file contents
          example: 414d79a12f1be626734b3b6696b52723
          nullable: true
          type: string
        mime_type:
          description: MIME type of the uploaded file
          example: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
          nullable: true
          type: string
        multipart_upload_id:
          description: S3 multipart upload ID for large files
          example: exampleMultipartUploadId123
          nullable: true
          type: string
        original_file_name:
          description: Original filename provided by the user
          example: Q4_2024_adjustments.xlsx
          minLength: 1
          type: string
        s3_bucket:
          description: S3 bucket where the file is stored
          example: qa-abacus-adjustments
          minLength: 1
          type: string
        s3_key:
          description: S3 object key path
          example: uploads/2025/11/a2c96ff7-e7a0-42fd-aad1-1b8436940d35.xlsx
          minLength: 1
          type: string
        total_parts:
          description: Total number of parts for multipart uploads
          example: 4
          type: integer
        upload_metadata:
          additionalProperties: {}
          description: Optional custom JSON object to associate with the upload
          example: &id002
            team: abacus
            user_id: '12345'
          nullable: true
          type: object
        upload_status:
          description: Current status of the upload (e.g., init, completed)
          enum:
          - init
          - scanning
          - complete
          - error
          - cancelled
          - quarantined
          example: completed
          type: string
      type: object
    FileUploadDetailVerbose:
      additionalProperties: false
      properties:
        completed_at:
          description: Timestamp when upload was completed
          example: '2025-11-24T04:35:43.396Z'
          format: null
          nullable: true
          pattern: null
          type: string
        created_at:
          description: Timestamp when the record was created
          example: '2025-11-24T04:35:43.396Z'
          format: null
          pattern: null
          type: string
        created_by:
          description: User identity ID of the user who created the record
          example: '12345'
          type: string
        deleted_at:
          description: Timestamp when the record was deleted (soft delete)
          example: null
          format: null
          nullable: true
          pattern: null
          type: string
        deleted_by:
          description: User identity ID of the user who deleted the record
          example: '67890'
          nullable: true
          type: string
        error_message:
          description: Error message if upload failed
          example: null
          nullable: true
          type: string
        expires_at:
          description: Timestamp when upload URLs expire
          example: '2025-11-24T05:35:43.396Z'
          format: null
          nullable: true
          pattern: null
          type: string
        file_key:
          description: Unique key identifying this file upload
          example: a2c96ff7-e7a0-42fd-aad1-1b8436940d35
          minLength: 1
          type: string
        file_size_bytes:
          description: Size of the file in bytes
          example: 10485760
          type: integer
        file_type:
          description: Type of file upload
          example: adjustments
          nullable: true
          type: string
        file_upload_config_id:
          description: ID of the upload configuration used
          example: 1
          minimum: 0
          type: integer
        file_upload_id:
          description: Unique identifier for the file upload
          example: 12345
          minimum: 0
          type: integer
        last_modified:
          description: Timestamp when the record was last modified
          example: '2025-11-24T04:36:15.123Z'
          format: null
          pattern: null
          type: string
        last_modified_by:
          description: User identity ID of the user who last modified the record
          example: '12345'
          type: string
        md5sum:
          description: MD5 hash of the file contents
          example: 414d79a12f1be626734b3b6696b52723
          nullable: true
          type: string
        mime_type:
          description: MIME type of the uploaded file
          example: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
          nullable: true
          type: string
        multipart_upload_id:
          description: S3 multipart upload ID for large files
          example: exampleMultipartUploadId123
          nullable: true
          type: string
        original_file_name:
          description: Original filename provided by the user
          example: Q4_2024_adjustments.xlsx
          minLength: 1
          type: string
        s3_bucket:
          description: S3 bucket where the file is stored
          example: qa-abacus-adjustments
          minLength: 1
          type: string
        s3_key:
          description: S3 object key path
          example: uploads/2025/11/a2c96ff7-e7a0-42fd-aad1-1b8436940d35.xlsx
          minLength: 1
          type: string
        total_parts:
          description: Total number of parts for multipart uploads
          example: 4
          type: integer
        upload_metadata:
          additionalProperties: {}
          description: Optional custom JSON object to associate with the upload
          example: *id002
          nullable: true
          type: object
        upload_status:
          description: Current status of the upload (e.g., init, completed)
          enum:
          - init
          - scanning
          - complete
          - error
          - cancelled
          - quarantined
          example: completed
          type: string
      type: object
    FileUploadStatusPut:
      additionalProperties: false
      properties:
        upload_status:
          description: Current status of the upload (e.g., init, completed)
          enum:
          - init
          - scanning
          - complete
          - error
          - cancelled
          - quarantined
          example: completed
          type: string
      type: object
    GDAContractDetail:
      allOf:
      - $ref: '#/components/schemas/ContractDetails'
      - $ref: '#/components/schemas/ContractExclusion'
      - $ref: '#/components/schemas/ContractTermDetail'
      - properties:
          run_controller_id:
            description: ID of run controller
            type: integer
        type: object
      title: Details of contract
      type: object
    GDAContractPostBody:
      example:
        account_id: 1
        account_name: Test Name
      properties:
        account_id:
          description: Id of an account
          type: integer
        account_name:
          description: Name of an account
          type: string
      title: POST body for creating contract from template
      type: object
    InitiateUploadRequest:
      additionalProperties: false
      properties:
        file_size_bytes:
          description: Size of the file in bytes
          example: 10485760
          type: integer
        filename:
          description: Original filename to be uploaded
          example: Q4_2024_adjustments.xlsx
          minLength: 1
          type: string
        md5sum:
          description: MD5 hash of the file contents (32 hexadecimal characters)
          example: 414d79a12f1be626734b3b6696b52723
          minLength: 1
          type: string
        metadata:
          additionalProperties: {}
          description: Optional custom JSON object to associate with the upload
          example:
            team: abacus
            user_id: '12345'
          nullable: true
          type: object
        mime_type:
          description: MIME type of the file
          example: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
          nullable: true
          type: string
        upload_type:
          description: Type of file upload
          enum:
          - adjustments
          - flowthrough
          example: adjustments
          type: string
      required:
      - file_size_bytes
      - filename
      - md5sum
      - upload_type
      type: object
    InitiateUploadResponse:
      additionalProperties: false
      properties:
        chunk_size_bytes:
          description: Size of each chunk for multipart uploads (in bytes)
          example: 5242880
          nullable: true
          type: integer
        complete_url:
          description: URL to call after completing upload (multipart uploads only)
          example: https://api.example.com/file-upload/a2c96ff7-e7a0-42fd-aad1-1b8436940d35/complete
          nullable: true
          type: string
        expires_at:
          description: ISO format datetime when the upload URLs expire
          example: '2025-11-24T05:35:43.396Z'
          type: string
        file_key:
          description: Unique key identifying this file upload
          example: a2c96ff7-e7a0-42fd-aad1-1b8436940d35
          minLength: 1
          type: string
        is_multipart:
          description: Whether this upload uses multipart upload (for large files)
          example: true
          type: boolean
        parts:
          description: List of pre-signed URLs for each part (multipart uploads only)
          example:
          - expires_at: '2025-11-24T05:35:43.396Z'
            part_number: 1
            url: https://s3.amazonaws.com/bucket/key?partNumber=1&uploadId=xyz
          - expires_at: '2025-11-24T05:35:43.396Z'
            part_number: 2
            url: https://s3.amazonaws.com/bucket/key?partNumber=2&uploadId=xyz
          items:
            $ref: '#/components/schemas/MultipartPart'
          nullable: true
          type: array
        required_headers:
          additionalProperties: {}
          description: HTTP headers that must be included in upload requests
          example:
            Content-MD5: 414d79a12f1be626734b3b6696b52723
          nullable: true
          type: object
        upload_url:
          description: Pre-signed S3 URL for single-part uploads (null for multipart)
          example: null
          nullable: true
          type: string
      type: object
    MechadminResponse:
      additionalProperties: false
      properties:
        mechadmin_digital:
          type: boolean
        mechadmin_physical:
          type: boolean
      required:
      - mechadmin_digital
      - mechadmin_physical
      type: object
    MultipartPart:
      additionalProperties: false
      properties:
        expires_at:
          description: ISO format datetime when the URL expires
          example: '2025-11-24T05:35:43.396Z'
          type: string
        part_number:
          description: Part number for this upload chunk (1-indexed)
          example: 1
          type: integer
        url:
          description: Pre-signed S3 URL for uploading this part
          example: https://s3.amazonaws.com/bucket/key?partNumber=1&uploadId=xyz&X-Amz-Signature=...
          type: string
      required:
      - expires_at
      - part_number
      - url
      type: object
    AttachmentRelations:
      description: Label scoping plus optional product/contributor relations
      additionalProperties: false
      properties:
        contributors:
          items:
            type: string
          type: array
        label_ids:
          items:
            type: string
          type: array
        upcs:
          items:
            type: string
          type: array
      type: object
    ProjectTransferTermConditionDetail:
      additionalProperties: false
      properties:
        commission:
          description: Commission rate as a string-encoded decimal (NR contracts)
          type: string
        conditions:
          properties:
            countries:
              items:
                description: Three-letter ISO country codes the condition applies to
                type: string
              type: array
            stores:
              items:
                description: Store identifiers the condition applies to
                type: string
              type: array
            transaction_types:
              items:
                description: Transaction type identifiers the condition applies to
                type: string
              type: array
          type: object
        created_at:
          format: date-time
          type: string
        created_by:
          type: string
        priority:
          description: Order in which the condition is evaluated
          minimum: 0
          type: integer
        project_transfer_term_condition_id:
          minimum: 0
          type: integer
        name:
          description: Optional human-readable name for the condition row
          nullable: true
          type: string
        project_transfer_term_id:
          minimum: 0
          type: integer
        term_rate:
          description: Rate as a string-encoded decimal
          type: string
      required:
      - commission
      - priority
      - project_transfer_term_condition_id
      - project_transfer_term_id
      - term_rate
      type: object
    ProjectTransferTermConditionInput:
      additionalProperties: false
      properties:
        commission:
          description: Commission rate as a string-encoded decimal; defaults to "0.00"
          type: string
        conditions:
          properties:
            countries:
              items:
                type: string
              type: array
            stores:
              items:
                type: string
              type: array
            transaction_types:
              items:
                type: string
              type: array
          type: object
        name:
          nullable: true
          type: string
        priority:
          minimum: 0
          type: integer
        term_rate:
          description: Rate as a string-encoded decimal
          type: string
      required:
      - priority
      - term_rate
      type: object
    ProjectTransferTermDetail:
      additionalProperties: false
      properties:
        attachments:
          description: List of UPCs/ISRCs/labelIds the term is attached to
          nullable: true
        attachment_relations:
          $ref: '#/components/schemas/AttachmentRelations'
          nullable: true
        conditions:
          items:
            $ref: '#/components/schemas/ProjectTransferTermConditionDetail'
          type: array
        contract_id:
          minimum: 0
          type: integer
        created_at:
          format: date-time
          type: string
        created_by:
          type: string
        project_transfer_term_id:
          minimum: 0
          type: integer
        job_id:
          minimum: 0
          type: integer
        name:
          description: Optional human-readable name for the term
          nullable: true
          type: string
        term_type:
          enum:
          - track
          - product
          - artist
          - catalog
          - label
          type: string
      required:
      - contract_id
      - job_id
      - project_transfer_term_id
      - term_type
      type: object
    ProjectTransferTermInput:
      additionalProperties: false
      properties:
        attachments:
          nullable: true
        attachment_relations:
          $ref: '#/components/schemas/AttachmentRelations'
          nullable: true
        conditions:
          items:
            $ref: '#/components/schemas/ProjectTransferTermConditionInput'
          type: array
        contract_id:
          minimum: 0
          type: integer
        name:
          nullable: true
          type: string
        term_type:
          enum:
          - track
          - product
          - artist
          - catalog
          - label
          type: string
      required:
      - conditions
      - contract_id
      - term_type
      type: object
    ReferenceFlowthroughCalculation:
      properties:
        flowthrough_calculation:
          description: Calculation for flowthrough
          type: string
        flowthrough_calculation_description:
          description: Description of flowthrough calculation
          type: string
        flowthrough_calculation_name:
          description: Name of the flowthrough calculation
          type: string
        flowthrough_claculation_example:
          description: Example of flowthrough calculation
          type: string
        reference_flowthrough_calculation_id:
          description: ID of the reference flowthrough calculation
          type: integer
      title: Reference Flowthrough Calculation
      type: object
    ReferenceMechanicalRateDetail:
      example:
        base_rate: '0.1240'
        country_code: USA
        effective_start_date: '2004-01-01T00:00:00.000000'
        minute_rate: '0.0238'
        reference_mechanical_rate_id: 1
        ringtone_rate: '0.2400'
      properties:
        base_rate:
          description: base mechanical rate.
          type: string
        country_code:
          description: 3 character country code.
          type: string
        effective_start_date:
          description: start date of the mechanical rate.
          type: string
        minute_rate:
          description: per minute mechanical rate.
          type: string
        reference_mechanical_rate_id:
          description: id of the reference_mechanical_rate.
          type: number
        ringtone_rate:
          description: ringtone rate.
          type: string
      required:
      - reference_mechanical_rate_id
      - country_code
      - base_rate
      - minute_rate
      - ringtone_rate
      - effective_start_date
      title: ReferenceMechanicalRate detail
      type: object
    ReferencePaymentEntityDetail:
      example:
        payment_entity_name: AWAL-UK
        reference_payment_entity_id: 1
      properties:
        country_of_tax_reporting:
          description: code of country where payment entity is reporting for tax
          type: string
        payment_entity_name:
          description: name of the payment entity
          type: string
        reference_payment_entity_id:
          description: id of the reference_payment_entity
          type: integer
      title: ReferencePaymentEntity Detail
      type: object
    ReferencePaymentTypeDetail:
      example:
        is_internal: false
        payment_method: Other Manual Payment Method
        payment_service: other
        payment_type: advance
        reference_payment_type_id: 1
      properties:
        is_internal:
          description: internal flag for the payment type
          type: boolean
        notes:
          description: Payment type description
          type: string
        payment_service:
          description: Payment service
          type: string
        payment_type:
          description: Payment type
          enum:
          - advance
          type: string
        reference_payment_type_id:
          description: the ID of the Payment Type
          type: integer
      title: Payment Type Details
      type: object
    ReferenceSapProfitCenter:
      additionalProperties: false
      properties:
        business_group:
          minLength: 1
          type: string
        company_code:
          minLength: 1
          type: string
        display_name:
          minLength: 1
          type: string
        profit_center:
          minLength: 1
          type: string
        reference_sap_profit_center_id:
          minimum: 0
          type: integer
      required:
      - business_group
      - company_code
      - display_name
      - profit_center
      - reference_sap_profit_center_id
      type: object
    ReferenceSapProfitCenterDataloader:
      additionalProperties: false
      properties:
        data:
          items:
            $ref: '#/components/schemas/ReferenceSapProfitCenter'
          nullable: true
          type: array
      type: object
    ReferenceSapProfitCenterDetail:
      example:
        business_group: ORC
        company_code: 4914
        profit_center: UK4914
        reference_sap_profit_center_id: 1
      properties:
        business_group:
          description: the profit center's business group
          type: string
        company_code:
          description: the profit center's company code
          type: integer
        profit_center:
          description: alpha-numeric identity of the profit center
          type: string
        reference_sap_profit_center_id:
          description: royalty_accounting (AKA abacus) ID of the profit_center
          type: integer
      title: SAP Profit Center Details
      type: object
    ReferenceSapProfitCenterPost:
      additionalProperties: false
      properties:
        business_group:
          minLength: 1
          type: string
        company_code:
          minLength: 1
          type: string
        display_name:
          minLength: 1
          type: string
        profit_center:
          minLength: 1
          type: string
        reference_signing_entity_ids:
          items:
            minimum: 0
            type: integer
          type: array
      required:
      - business_group
      - company_code
      - display_name
      - profit_center
      type: object
    ReferenceSigningEntity:
      additionalProperties: false
      example:
        address: 2 Canal Reach London N1C 4DB
        company_code: '4914'
        company_registration_number: '04430703'
        legal_name: AWAL Digital Limited
        reference_payment_entity_id: 1
        reference_signing_entity_id: 1
        vat_number: GB 423 4787 86
      properties:
        address:
          description: address of the company
          minLength: 1
          type: string
        company_code:
          description: 4 digit code used for financial reporting and for issuing KNR
            payments
          minLength: 1
          type: string
        company_registration_number:
          description: registration number of the company
          minLength: 1
          type: string
        legal_name:
          description: name of the signing entity
          minLength: 1
          type: string
        reference_payment_entity_id:
          description: id of the related reference_payment_entity
          minimum: 0
          type: integer
        reference_sap_profit_center_id:
          minimum: 0
          type: integer
        reference_signing_entity_id:
          description: id of the reference_signing_entity
          minimum: 0
          type: integer
        vat_number:
          description: registered tax identification number
          minLength: 1
          type: string
      required:
      - company_code
      - legal_name
      - reference_payment_entity_id
      - reference_sap_profit_center_id
      - reference_signing_entity_id
      title: ReferenceSigningEntity Detail
      type: object
    ReferenceSigningEntityDataloader:
      additionalProperties: false
      properties:
        data:
          items:
            $ref: '#/components/schemas/ReferenceSigningEntity'
          nullable: true
          type: array
      type: object
    ReferenceSigningEntityListResponse:
      additionalProperties: false
      properties:
        items:
          items:
            $ref: '#/components/schemas/ReferenceSigningEntity'
          type: array
        total_count:
          type: integer
      required:
      - total_count
      type: object
    ReferenceTransactionTypeDetail:
      example:
        reference_transaction_type_id: 1
        transaction_type_code: S
        transaction_type_name: Subscription Audio Streams
      properties:
        reference_transaction_type_id:
          description: The ID of the transaction type
          type: number
        transaction_type_code:
          description: The code of the transaction type
          type: string
        transaction_type_name:
          description: The transaction type name
          type: string
      title: Reference Transaction Type Detail
      type: object
    ReferenceTransactionTypeGroupDetail:
      example:
        reference_transaction_type_group_id: 1
        transaction_type_group_name: Digital Distribution Streaming
      properties:
        reference_transaction_type_group_id:
          description: The ID of the transaction type group
          type: number
        transaction_type_group_name:
          description: The name of the transaction type group
          type: string
      title: Reference Transaction Type Group Detail
      type: object
    ReferenceTransactionTypeGroupTransactionType:
      example:
        reference_transaction_type_group_admin: PRESENTATIONAL
        reference_transaction_type_group_id: 1
        reference_transaction_type_group_transaction_type_id: 1
        reference_transaction_type_id: 1
      properties:
        reference_transaction_type_group_admin:
          description: group admin for the reference_transaction_type_group_transaction_type
          type: string
        reference_transaction_type_group_id:
          description: ID of the reference_transaction_type_group
          type: number
        reference_transaction_type_group_transaction_type_id:
          description: ID of the reference_transaction_type_group_transaction_type
          type: number
        reference_transaction_type_id:
          description: ID of the reference_transaction_type
          type: number
      title: Reference Transaction Type Group Transaction Type
      type: object
    SapProfitCenterSigningEntityDataloader:
      additionalProperties: false
      properties:
        data:
          items:
            $ref: '#/components/schemas/SigningEntitySapProfitCenterWithSigningEntity'
          nullable: true
          type: array
      type: object
    SigningEntitySapProfitCenterDataloader:
      additionalProperties: false
      properties:
        data:
          items:
            $ref: '#/components/schemas/SigningEntitySapProfitCenterWithSapProfitCenter'
          nullable: true
          type: array
      type: object
    SigningEntitySapProfitCenterDetail:
      additionalProperties: false
      properties:
        created_at:
          format: null
          nullable: true
          pattern: null
          type: string
        deleted_at:
          format: null
          nullable: true
          pattern: null
          type: string
        reference_sap_profit_center_id:
          minimum: 0
          type: integer
        reference_signing_entity_id:
          minimum: 0
          type: integer
        signing_entity_sap_profit_center_id:
          minimum: 0
          type: integer
      required:
      - reference_sap_profit_center_id
      - reference_signing_entity_id
      - signing_entity_sap_profit_center_id
      type: object
    SigningEntitySapProfitCenterPostByProfitCenter:
      additionalProperties: false
      properties:
        reference_signing_entity_ids:
          items:
            minimum: 1
            type: integer
          type: array
      type: object
    SigningEntitySapProfitCenterWithSapProfitCenter:
      additionalProperties: false
      properties:
        created_at:
          format: null
          nullable: true
          pattern: null
          type: string
        reference_signing_entity_id:
          minimum: 0
          type: integer
        sap_profit_center:
          $ref: '#/components/schemas/ReferenceSapProfitCenter'
        signing_entity_sap_profit_center_id:
          minimum: 0
          type: integer
      required:
      - reference_signing_entity_id
      - sap_profit_center
      - signing_entity_sap_profit_center_id
      type: object
    SigningEntitySapProfitCenterWithSigningEntity:
      additionalProperties: false
      properties:
        created_at:
          format: null
          nullable: true
          pattern: null
          type: string
        reference_sap_profit_center_id:
          minimum: 0
          type: integer
        signing_entity:
          $ref: '#/components/schemas/ReferenceSigningEntity'
        signing_entity_sap_profit_center_id:
          minimum: 0
          type: integer
      required:
      - reference_sap_profit_center_id
      - signing_entity
      - signing_entity_sap_profit_center_id
      type: object
    StatementPeriodAdjustmentBatchCriteriaDetail:
      additionalProperties: false
      properties:
        batch_criteria:
          $ref: '#/components/schemas/StatementPeriodAdjustmentBatchCriteriaJson'
        statement_period_adjustment_batch_criteria_id:
          minimum: 0
          type: integer
        statement_period_adjustment_file_id:
          minimum: 0
          type: integer
      required:
      - batch_criteria
      - statement_period_adjustment_batch_criteria_id
      - statement_period_adjustment_file_id
      type: object
    StatementPeriodAdjustmentBatchCriteriaJson:
      additionalProperties: false
      properties:
        payment_schedules:
          items:
            enum:
            - 30_days_after_month_end
            - 45_days_after_month_end
            - 60_days_after_month_end
            - 90_days_after_month_end
            - 30_days_after_quarter_end
            - 45_days_after_quarter_end
            - 60_days_after_quarter_end
            - 90_days_after_quarter_end
            - 30_days_after_half_year_end
            - 45_days_after_half_year_end
            - 60_days_after_half_year_end
            - 90_days_after_half_year_end
            - TEMPORARY
            type: string
          minItems: 1
          type: array
        reference_payment_entities:
          items:
            minimum: 0
            type: integer
          minItems: 1
          type: array
      required:
      - payment_schedules
      - reference_payment_entities
      type: object
    StatementPeriodAdjustmentBatchCriteriaPost:
      additionalProperties: false
      properties:
        batch_criteria:
          $ref: '#/components/schemas/StatementPeriodAdjustmentBatchCriteriaJson'
        statement_period_adjustment_file_id:
          minimum: 0
          type: integer
      required:
      - batch_criteria
      - statement_period_adjustment_file_id
      type: object
    StatementPeriodAdjustmentFileAndBatchCriteriaPost:
      additionalProperties: false
      properties:
        batch_criteria:
          $ref: '#/components/schemas/StatementPeriodAdjustmentBatchCriteriaJson'
        file_name:
          minLength: 1
          type: string
      required:
      - batch_criteria
      - file_name
      type: object
    StatementPeriodAdjustmentFileDetail:
      additionalProperties: false
      properties:
        batch_type:
          enum:
          - auto
          - manual
          - upload
          type: string
        created_by:
          nullable: true
          type: string
        error_type:
          type: string
        file_name:
          minLength: 1
          type: string
        invalid_file_location:
          type: string
        invalid_row_count:
          minimum: 0
          type: integer
        md5sum:
          type: string
        source_file_upload_id:
          minimum: 0
          nullable: true
          type: integer
        statement_period_adjustment_file_id:
          minimum: 0
          type: integer
        statement_period_id:
          minimum: 0
          type: integer
        total_file_amount_multicurrency:
          type: number
        total_rounded_amount_multicurrency:
          type: number
        valid_file_location:
          minLength: 1
          type: string
        valid_row_count:
          minimum: 0
          type: integer
      required:
      - file_name
      - statement_period_id
      title: StatementPeriodAdjustmentFile Detail
      type: object
    StoreDetail:
      example:
        store_id: 1483
        store_name: Spotify US
      properties:
        store_id:
          description: The ID of the store / service
          type: integer
        store_name:
          description: The name of the store / service
          type: string
      title: Store (AKA "Service") Detail
      type: object
    ValidateAdjustmentsPost:
      additionalProperties: false
      properties:
        adjustments:
          items:
            $ref: '#/components/schemas/AdjustmentToValidate'
          type: array
        statement_period_id:
          minimum: 0
          type: integer
      required:
      - adjustments
      - statement_period_id
      type: object
    ValidateAdjustmentsResponse:
      additionalProperties: false
      properties:
        errors:
          additionalProperties: {}
          type: object
      type: object
info:
  title: ows-royalties API Specifications
  version: 1.0.0
openapi: 3.0.0
paths:
  /account/{account_id}/contract-terms/:
    post:
      parameters:
      - description: An Account ID
        in: path
        name: account_id
        required: true
        schema:
          type: integer
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ContractTermsAttachmentsPostBody'
        description: An object of term_type and list of attachments
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                items:
                  $ref: '#/components/schemas/ContractTermDetail'
                type: array
          description: 200 OK
        '400':
          description: 400 invalid data in payload
        '404':
          description: 404 contract terms not found
      summary: GET contract-terms belonging to the specified account.
  /contract-advance/{contract_advance_id}/:
    delete:
      parameters:
      - description: ID of the contract_advance
        in: path
        name: contract_advance_id
        required: true
        schema:
          type: integer
      responses:
        '204':
          description: success
        '400':
          description: contract_advance does not exist
        '404':
          description: contract_advance is already deleted or can not be deleted
      summary: Soft delete a Contract Advance
    get:
      parameters:
      - description: The ID of the contract advance
        in: path
        name: contract_advance_id
        required: true
        schema:
          type: integer
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ContractAdvanceDetail'
          description: Success
        '404':
          description: 404 NOT FOUND
      summary: Retrieves contract advance details
    put:
      parameters:
      - description: The ID of the contract advance
        in: path
        name: contract_advance_id
        required: true
        schema:
          type: integer
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ContractAdvancePutBody'
        description: The contract advance details
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ContractAdvanceDetail'
          description: Success
        '404':
          description: 404 NOT FOUND
      summary: Update contract advance details
  /contract-flowthrough/{contract_flowthrough_id}/:
    delete:
      parameters:
      - description: ID of the contract_flowthrough
        in: path
        name: contract_flowthrough_id
        required: true
        schema:
          type: integer
      responses:
        '204':
          description: Success
        '404':
          description: contract_flowthrough does not exist or is already deleted
      summary: Soft delete a Contract Flowthrough
    get:
      parameters:
      - description: ID of the contract_flowthrough
        in: path
        name: contract_flowthrough_id
        required: true
        schema:
          type: integer
      responses:
        '200':
          content:
            application/json:
              schema:
                items:
                  $ref: '#/components/schemas/ContractFlowthroughDetail'
                type: array
          description: 200 OK
        '404':
          description: ContractFlowthrough doesn't exist
      summary: Get a contract flowthrough by contract_flowthrough_id
    put:
      parameters:
      - description: ID of the contract_flowthrough
        in: path
        name: contract_flowthrough_id
        required: true
        schema:
          type: integer
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ContractFlowthroughPutBody'
        description: The contract flowthrough fields
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ContractFlowthroughDetail'
          description: Ok
        '400':
          description: Bad data received in payload
      summary: Updates contract flowthrough
  /contract-lifecycle-schedule-detail/dataloader/:
    post:
      requestBody:
        content:
          application/json:
            schema:
              items:
                type: integer
              type: array
        description: List of contract_lifecycle_schedule_detail_ids
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                items:
                  $ref: '#/components/schemas/ContractLifecycleScheduleDetailDataloaderResponse'
                type: array
          description: 200 OK
        '400':
          description: Bad data received in payload
      summary: Get a list of contract lifecycle schedule details by contract_lifecycle_schedule_detail_ids
  /contract-lifecycle-schedule-detail/{contract_lifecycle_schedule_detail_id}/:
    get:
      parameters:
      - description: The contract lifecycle schedule detail id
        in: path
        name: contract_lifecycle_schedule_detail_id
        required: true
        schema:
          type: integer
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ContractLifecycleScheduleDetailResponse'
          description: 200 OK
        '404':
          description: 404 contract lifecycle schedule detail not found
      summary: Get contract lifecycle schedule detail by specified id
  /contract-lifecycle-schedule/{contract_lifecycle_schedule_id}/:
    get:
      parameters:
      - description: The contract_lifecycle_schedule ID
        in: path
        name: contract_lifecycle_schedule_id
        required: true
        schema:
          type: integer
      responses:
        '200':
          content:
            application/json:
              schema:
                items:
                  $ref: '#/components/schemas/ContractLifecycleScheduleResponse'
                type: array
          description: 200 OK
        '404':
          description: 404 ContractLifecycleSchedule not found
      summary: Get a contract lifecycle schedule by contract_lifecycle_schedule_id
  /contract-lifecycle-schedule/{contract_lifecycle_schedule_id}/contract-lifecycle/:
    get:
      parameters:
      - description: The contract_lifecycle_schedule ID
        in: path
        name: contract_lifecycle_schedule_id
        required: true
        schema:
          type: integer
      responses:
        '200':
          content:
            application/json:
              schema:
                items:
                  $ref: '#/components/schemas/ContractLifecycleDetail'
                type: array
          description: 200 OK
        '404':
          description: 404 ContractLifecycleSchedule not found
      summary: Get a contract lifecycle associated to the specified contract_lifecycle_schedule_id
  /contract-lifecycle-schedules/dataloader/:
    post:
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ContractLifecycleScheduleIdsPostBody'
        description: The contract_lifecycle_schedule ids
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                description: List of ContractLifecycleSchedule details
                items:
                  $ref: '#/components/schemas/DataloadedContractLifecycleScheduleList'
                type: array
          description: Success
        '400':
          description: Bad data received in payload
      summary: Dataload contract lifecycle schedules by ids
  /contract-lifecycle/{contract_lifecycle_id}/:
    get:
      parameters:
      - description: The contract_lifecycle ID
        in: path
        name: contract_lifecycle_id
        required: true
        schema:
          type: integer
      responses:
        '200':
          content:
            application/json:
              schema:
                items:
                  $ref: '#/components/schemas/ContractLifecycleDetail'
                type: array
          description: 200 OK
        '404':
          description: 404 ContractLifecycle not found
      summary: Get a contract lifecycle by contract_lifecycle_id
  /contract-lifecycles/activable:
    get:
      description: Get contract_lifecycle records in the init state with a lifecycle_term_start
        date of today
      responses:
        200:
          content:
            application/json:
              schema:
                properties:
                  items:
                    description: the contract_lifecycle records ready to be activated
                    items:
                      $ref: '#/components/schemas/ContractLifecycleDetail'
                    type: array
                  total_count:
                    description: total number of contract_lifecycle records ready
                      to be activated
                    example: 1
                    type: integer
                type: object
          description: success
      summary: Get activable contract_lifecycle records
  /contract-lifecycles/activate/:
    post:
      description: This endpoint will only "activate" contract lifecycles that are
        in the "init" state.
      requestBody:
        content:
          application/json:
            example:
            - 1
            - 2
            - 3
            schema:
              items:
                type: number
              type: array
        description: List of contract_lifecycle ids.
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                items:
                  $ref: '#/components/schemas/ContractLifecycleDetail'
                type: array
          description: 200 OK
      summary: Update the lifecycle_status of contract_lifecycle records to "active"
  /contract-lifecycles/dataloader/:
    post:
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ContractLifecycleIdsPostBody'
        description: The contract_lifecycle ids
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                description: List of ContractLifecycle details
                items:
                  $ref: '#/components/schemas/DataloadedContractLifecycleList'
                type: array
          description: Success
        '400':
          description: Bad data received in payload
      summary: Dataload contract lifecycles by ids
  /contract-lifecycles/renew/:
    post:
      requestBody:
        content:
          application/json:
            example:
            - 1
            - 2
            - 3
            schema:
              items:
                type: number
              type: array
        description: List of contract_lifecycle ids.
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                items:
                  $ref: '#/components/schemas/ContractLifecycleDetail'
                type: array
          description: 200 OK
        '400':
          description: Invalid lifecycle_status or renewal_effective date
        '404':
          description: 404 contract_lifecycle not found
      summary: Renewing contract_lifecycle records that are due for renewal.
  /contract-lifecycles/renewable/:
    get:
      description: Get 'active' contract_lifecycle records with a renewal_effective
        date of today
      responses:
        200:
          content:
            application/json:
              schema:
                properties:
                  items:
                    description: the contract_lifecycle records ready to be renewed
                    items:
                      $ref: '#/components/schemas/ContractLifecycleDetail'
                    type: array
                  total_count:
                    description: total number of contract_lifecycle records ready
                      to be renewed
                    example: 1
                    type: integer
                type: object
          description: success
      summary: Get renewable contract_lifecycle records
  /contract-lifecycles/terminable/:
    get:
      responses:
        200:
          content:
            application/json:
              schema:
                properties:
                  items:
                    description: the contract_lifecycle records that are to be terminated
                    items:
                      $ref: '#/components/schemas/ContractLifecycleDetail'
                    type: array
                  total_count:
                    description: total number of contract_lifecycle records that are
                      to be terminated
                    example: 1
                    type: integer
                type: object
          description: success
      summary: Get terminable contract_lifecycle records
  /contract-lifecycles/terminate/:
    post:
      description: This endpoint will only "terminate" contract lifecycles that are
        in "to_be_terminated" or "in_collection_period" state, and are due to be terminated
        by date.
      requestBody:
        content:
          application/json:
            example:
            - 1
            - 2
            - 3
            schema:
              items:
                type: number
              type: array
        description: List of contract_lifecycle ids.
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                items:
                  $ref: '#/components/schemas/ContractLifecycleDetail'
                type: array
          description: 200 OK
      summary: Update the lifecycle_status of contract_lifecycle records to either
        "terminated" or "in_collection_period"
  /contract-mechanical-deduction/{contract_mechanical_deduction_id}:
    delete:
      parameters:
      - description: ID of the contract_mechanical_deduction
        in: path
        name: contract_mechanical_deduction_id
        required: true
        schema:
          type: integer
      responses:
        '204':
          description: Success
        '404':
          description: contract_mechanical_deduction does not exist or is already
            deleted
      summary: Soft delete a Contract Mechanical Deduction
    put:
      parameters:
      - description: ID of the contract_mechanical_deduction
        in: path
        name: contract_mechanical_deduction_id
        required: true
        schema:
          type: integer
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ContractMechanicalDeductionPutBody'
        description: The contract_mechanical_deduction fields
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ContractMechanicalDeductionDetail'
          description: Success
        '400':
          description: Bad data received in payload
        '404':
          description: ContractMechanicalDeduction Not Found
      summary: Update contract_mechanical_deduction data
  /contract-mechanical-deduction/{contract_mechanical_deduction_id}/:
    get:
      parameters:
      - description: ID of the contract_mechanical_deduction
        in: path
        name: contract_mechanical_deduction_id
        required: true
        schema:
          type: integer
      responses:
        200:
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ContractMechanicalDeductionDetail'
          description: Success
        404:
          description: contract_mechanical_deduction Not found
      summary: GET a contract_mechanical_deduction by contract_mechanical_deduction_id
  /contract-party/:
    post:
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ContractPartyPostBody'
        description: contract party details
        required: true
      responses:
        '201':
          description: 201 Created
        '400':
          description: Bad data received in payload
      summary: Creates a new contract_party with the specified details
  /contract-party/{contract_party_id}/:
    delete:
      parameters:
      - description: id of the contract_party
        in: path
        name: contract_party_id
        required: true
        schema:
          type: integer
      responses:
        '204':
          description: success
        '400':
          description: contract_party does not exist or is already deleted
      summary: Soft delete a Contract Party
  /contract-reserves/:
    post:
      requestBody:
        content:
          application/json:
            example:
            - 10
            schema:
              items:
                type: number
              type: array
        description: List of contract_reserve_ids.
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                items:
                  $ref: '#/components/schemas/ContractReserveDetail'
                type: array
          description: 200 OK
      summary: GET reserves by list of contract_reserve_ids. Uses POST to allow for
        a larger list of query args.
  /contract-template/{contract_template_id}/contract/:
    post:
      parameters:
      - description: ID of contract template
        in: path
        name: contract_template_id
        required: true
        schema:
          type: integer
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/GDAContractPostBody'
        description: account details
        required: true
      responses:
        '201':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GDAContractDetail'
          description: 201 Created
        '404':
          description: 404 contract not found
      summary: Create a contract from the specified contract template
  /contract-term-conditions/soft-delete/:
    put:
      requestBody:
        content:
          application/json:
            example:
            - 1
            - 2
            - 3
            schema:
              items:
                description: A list of contract_term_condition_ids
                type: integer
              type: array
        description: An array of contract_term_condition_ids
        required: true
      responses:
        '200':
          description: 200 ok
        '400':
          description: contract term condition cannot be deleted
        '404':
          description: 404 contract term condition not found
      summary: Soft delete one or more contract term conditions
  /contract-term/{contract_term_id}/:
    delete:
      parameters:
      - description: id of the contract term
        in: path
        name: contract_term_id
        required: true
        schema:
          type: integer
      responses:
        '204':
          description: success
        '400':
          description: contract_term does not exist or already deleted
      summary: Delete contract term and attached term conditions by specified contract_term_id
    get:
      parameters:
      - description: The contract term id
        in: path
        name: contract_term_id
        required: true
        schema:
          type: integer
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ContractTermDetail'
          description: 200 OK
        '404':
          description: 404 contract term not found
      summary: Get contract term by specified id
    put:
      parameters:
      - description: The contract term ID
        in: path
        name: contract_term_id
        required: true
        schema:
          type: integer
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ContractTermPutBody'
        description: An array of attachments
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ContractTermDetail'
          description: 200 ok
        '404':
          description: 404 contract term not found
      summary: Update attachments for a specified contract term.
  /contract-term/{contract_term_id}/conditions/:
    get:
      parameters:
      - description: The id of the contract
        in: path
        name: contract_term_id
        required: true
        schema:
          type: integer
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ContractTermConditionDetail'
          description: Success
        '404':
          description: 404 NOT FOUND
      summary: Retrieves contract term conditions
    post:
      parameters:
      - description: The contract term ID
        in: path
        name: contract_term_id
        required: true
        schema:
          type: integer
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ContractTermConditionPostBody'
        description: An array of one or more contract term condition details
        required: true
      responses:
        '201':
          content:
            application/json:
              schema:
                items:
                  $ref: '#/components/schemas/ContractTermConditionDetail'
                type: array
          description: 201 created
        '404':
          description: 404 contract term not found
      summary: Create one or more contract term conditions for the specified contract
        term
    put:
      parameters:
      - description: The contract term ID
        in: path
        name: contract_term_id
        required: true
        schema:
          type: integer
      requestBody:
        content:
          application/json:
            schema:
              allOf:
              - $ref: '#/components/schemas/ContractTermConditionDetail'
        description: An array of one or more contract term condition details
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                items:
                  $ref: '#/components/schemas/ContractTermConditionDetail'
                type: array
          description: 200 ok
        '400':
          description: contract term condition does not belong to contract term
        '404':
          description: 404 contract term not found || 404 contract term condition
            not found
      summary: Update one or more specified contract term conditions.
  /contract-term/{contract_term_id}/contract-term-schedules/:
    get:
      parameters:
      - description: id of the contract_term
        in: path
        name: contract_term_id
        required: true
        schema:
          type: integer
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ContractTermScheduleDetail'
          description: Success
        '400':
          description: contract_term does not exist
        '404':
          description: 404 NOT FOUND
      summary: Get a list of contract term schedules by contract_term_id
  /contract-terms/snapshot/:
    get:
      parameters:
      - description: List of contract IDs
        explode: false
        in: query
        name: contract_ids
        required: false
        schema:
          items:
            type: integer
          type: array
        style: form
      responses:
        '200':
          content:
            text/csv: {}
          description: 200 OK
      summary: Return a csv of contract term
  /contract/:
    post:
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ContractPostBody'
        description: The contract details
        required: true
      responses:
        '201':
          description: 200 OK
        '400':
          description: Bad data received in payload or contract id already exists
        '401':
          description: 401 API key is missing or invalid
      summary: Creates a new contract with the specified details
  /contract/contract-lifecycle-schedule/contract-lifecycle/:
    post:
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ContractAndLifecyclePostBody'
        description: The contract, contract_lifecycle_schedule and contract_lifecycle
          details
        required: true
      responses:
        '201':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ContractDetails'
          description: Created
        '400':
          description: Bad data received in payload or contract id already exists
      summary: Creates a new contract with contract_lifecycle_schedules and contract_lifecycle
  /contract/contract-lifecycle/dataloader/:
    post:
      requestBody:
        content:
          application/json:
            example:
            - 10
            schema:
              items:
                type: number
              type: array
        description: List of contract_ids.
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                description: List of ContractLifecycle details
                items:
                  $ref: '#/components/schemas/DataloadedContractLifecycleList'
                type: array
          description: Success
        '400':
          description: Bad data received in payload
      summary: GET contracts by a list of contract_ids. Uses POST to allow for a larger
        list of query args.
  /contract/contract-reserves/:
    post:
      requestBody:
        content:
          application/json:
            example:
            - 10
            schema:
              items:
                type: number
              type: array
        description: List of contract_ids.
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                items:
                  $ref: '#/components/schemas/ContractReserveDetailWithAccountId'
                type: array
          description: 200 OK
      summary: GET reserves by list of contract_ids. Uses POST to allow for a larger
        list of query args.
  /contract/{contract_id}/:
    delete:
      parameters:
      - description: The contract ID
        in: path
        name: contract_id
        required: true
        schema:
          type: integer
      responses:
        '200':
          content:
            application/json:
              schema:
                properties:
                  deleted:
                    type: boolean
                type: object
          description: 200 OK
      summary: Delete a contract.
    get:
      parameters:
      - description: The ID of the contract
        in: path
        name: contract_id
        required: true
        schema:
          type: integer
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ContractDetails'
          description: Success
        '404':
          description: 404 NOT FOUND
      summary: Retrieves contract details
    put:
      parameters:
      - description: The contract ID
        in: path
        name: contract_id
        required: true
        schema:
          type: integer
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ContractPutBody'
        description: An object containing the contract fields that need to be updated.
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ContractDetails'
          description: 200 ok
        '404':
          description: 404 contract not found
      summary: Update contract details for a specified contract.
  /contract/{contract_id}/advance/:
    post:
      parameters:
      - description: ID of the parent contract
        in: path
        name: contract_id
        required: true
        schema:
          type: integer
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ContractAdvancePostBody'
        description: The contract advance details
        required: true
      responses:
        '201':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ContractAdvanceDetail'
          description: Created
      summary: Create a new contract advance
  /contract/{contract_id}/advances/{status}/:
    get:
      parameters:
      - description: ID of the contract
        in: path
        name: contract_id
        required: true
        schema:
          type: integer
      - description: Status of the advance is either pending, not_qualified, qualified,
          paid, in_review, approved or deleted
        in: path
        name: status
        required: true
        schema:
          type: string
      responses:
        '200':
          content:
            application/json:
              schema:
                properties:
                  items:
                    items:
                      oneOf:
                      - $ref: '#/components/schemas/ContractAdvanceDetail'
                      - $ref: '#/components/schemas/ContractAdvancePaidDetail'
                    type: array
                  total_count:
                    example: 1
                    type: integer
                type: object
          description: Success
      summary: Get a list of contract advances for a specified contract and status
  /contract/{contract_id}/can-be-deleted:
    get:
      parameters:
      - description: The contract ID
        in: path
        name: contract_id
        required: true
        schema:
          type: integer
      responses:
        '200':
          content:
            application/json:
              schema:
                properties:
                  can_be_deleted:
                    type: boolean
                type: object
          description: 200 OK
      summary: Check if a contract can be deleted
  /contract/{contract_id}/contract-flowthrough/:
    get:
      parameters:
      - description: ID of the contract
        in: path
        name: contract_id
        required: true
        schema:
          type: integer
      responses:
        '200':
          content:
            application/json:
              schema:
                items:
                  $ref: '#/components/schemas/ContractFlowthroughDetail'
                type: array
          description: 200 OK
        '404':
          description: contract doesn't exist
      summary: Get a contract_flowthrough associated to the specified contract
    post:
      parameters:
      - description: ID of the contract
        in: path
        name: contract_id
        required: true
        schema:
          type: integer
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ContractFlowthroughPostBody'
        description: The contract flowthrough fields
        required: true
      responses:
        '201':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ContractFlowthroughDetail'
          description: 201 Created
        '400':
          description: Bad data received in payload
        '404':
          description: 404 contract not found
        '409':
          description: contract_flowthrough already exist
      summary: Create a contract flowthrough
  /contract/{contract_id}/contract-lifecycle-schedule/{contract_lifecycle_schedule_id}/contract-lifecycle/:
    post:
      parameters:
      - description: ID of the parent contract
        in: path
        name: contract_id
        required: true
        schema:
          type: integer
      - description: ID of the parent contract_lifecycle_schedule
        in: path
        name: contract_lifecycle_schedule_id
        required: true
        schema:
          type: integer
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ContractLifecyclePostBody'
        description: The contract contract_lifecycle_schedule details
        required: true
      responses:
        '201':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ContractLifecycleDetail'
          description: Created
        '400':
          description: Bad data received in payload or contract/contract_lifecycle_schedule
            does not exist
        '409':
          description: already exist
      summary: Create a new contract lifecycle
  /contract/{contract_id}/contract-lifecycle-schedules/:
    post:
      parameters:
      - description: ID of the parent contract
        in: path
        name: contract_id
        required: true
        schema:
          type: integer
      - description: Allow schedule end date in the past. Used for backfilling contracts.
        in: query
        name: allow_end_date_in_past
        required: false
        schema:
          type: boolean
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ContractLifecycleSchedulePostBody'
        description: The contract lifecycle schedule fields
        required: true
      responses:
        '201':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ContractLifecycleScheduleResponse'
          description: Created
        '400':
          description: Bad data received in payload
        '409':
          description: already exist
      summary: Create one or two contract lifecycle schedules
    put:
      parameters:
      - description: ID of the parent contract
        in: path
        name: contract_id
        required: true
        schema:
          type: integer
      - description: Allow schedule end date in the past. Used for backfilling contracts.
        in: query
        name: allow_end_date_in_past
        required: false
        schema:
          type: boolean
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ContractLifecycleSchedulePutBody'
        description: The contract lifecycle schedule fields
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ContractLifecycleScheduleResponse'
          description: Created
        '400':
          description: Bad data received in payload
      summary: Updates one or two contract lifecycle schedules
  /contract/{contract_id}/contract-lifecycle/:
    get:
      parameters:
      - description: The contract ID
        in: path
        name: contract_id
        required: true
        schema:
          type: integer
      responses:
        '200':
          content:
            application/json:
              schema:
                items:
                  $ref: '#/components/schemas/ContractLifecycleDetail'
                type: array
          description: 200 OK
        '400':
          description: contract doesn't exist
      summary: Get a contract lifecycle associated to the specified contract
    put:
      parameters:
      - description: The contract ID
        in: path
        name: contract_id
        required: true
        schema:
          type: integer
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ContractLifecyclePutBody'
        description: contract lifecycle details
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                items:
                  $ref: '#/components/schemas/ContractLifecycleDetail'
                type: array
          description: 200 OK
        '400':
          description: Lifecycle data required
        '404':
          description: Contract doesn't exist
      summary: Update a contract lifecycle associated to the specified contract
  /contract/{contract_id}/contract-mechanical-deduction/:
    post:
      parameters:
      - description: ID of the parent contract
        in: path
        name: contract_id
        required: true
        schema:
          type: integer
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ContractMechanicalDeductionPostBody'
        description: The contract_mechanical_deduction fields
        required: true
      responses:
        '201':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ContractMechanicalDeductionDetail'
          description: Created
        '400':
          description: Bad data received in payload
        '404':
          description: Contract Not Found
      summary: Create a new contract_mechanical_deduction
  /contract/{contract_id}/contract-mechanical-deductions/:
    get:
      parameters:
      - description: ID of the parent contract
        in: path
        name: contract_id
        required: true
        schema:
          type: integer
      responses:
        200:
          content:
            application/json:
              schema:
                items:
                  $ref: '#/components/schemas/ContractMechanicalDeductionDetail'
                type: array
          description: 200 OK
        404:
          description: 404 Contract Mechanical Deduction not found
      summary: GET list of contract mechanical deductions by contract_id
  /contract/{contract_id}/contract-mechanical-deductions/worldwide/:
    post:
      parameters:
      - description: ID of the contract
        in: path
        name: contract_id
        required: true
        schema:
          type: integer
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ContractWorldWideMechanicalDeductionPostBody'
        description: The contract_mechanical_deduction fields
        required: true
      responses:
        '201':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ContractMechanicalDeductionDetail'
          description: Created
        '400':
          description: Bad data received in payload
        '404':
          description: Contract Not Found
      summary: Creating contract mechanical deductions worldwide i.e USA, CAN, ROW
  /contract/{contract_id}/contract-term/:
    post:
      parameters:
      - description: The contract ID
        in: path
        name: contract_id
        required: true
        schema:
          type: integer
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ContractTermPostBody'
        description: The contract term details
        required: true
      responses:
        '201':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ContractTermDetail'
          description: 201 Created
        '404':
          description: 404 contract not found
      summary: Create a contract term associated to the specified contract
  /contract/{contract_id}/earnings-transfers:
    get:
      description: Retrieves a paginated list of earnings transfers.
      parameters:
      - description: The unique ID of the contract
        in: path
        name: contract_id
        required: true
        schema:
          format: int32
          type: integer
        type: integer
      responses:
        '200':
          content:
            application/json:
              schema:
                items:
                  $ref: '#/components/schemas/EarningsTransferDetail'
                type: array
          description: the list of earnings transfers
        '400':
          content:
            application/json:
              schema: {}
          description: Invalid query parameter syntax or validation error
        '401':
          content:
            application/json:
              schema: {}
          description: Unauthorized
        '500':
          content:
            application/json:
              schema: {}
          description: Internal server error
      summary: Get the list of earnings transfers.
  /contract/{contract_id}/earnings-transfers/{transfer_type}:
    get:
      description: Retrieves a paginated list of earnings transfers.
      parameters:
      - description: The unique ID of the contract
        in: path
        name: contract_id
        required: true
        schema:
          format: int32
          type: integer
        type: integer
      - description: Filter by transfer type - reclass, override, or transfer
        in: path
        name: transfer_type
        required: true
        schema:
          type: string
        type: string
      responses:
        '200':
          content:
            application/json:
              schema:
                items:
                  $ref: '#/components/schemas/EarningsTransferDetail'
                type: array
          description: the list of earnings transfers
        '400':
          content:
            application/json:
              schema: {}
          description: Invalid query parameter syntax or validation error
        '401':
          content:
            application/json:
              schema: {}
          description: Unauthorized
        '500':
          content:
            application/json:
              schema: {}
          description: Internal server error
      summary: Get the list of earnings transfers.
  /contract/{contract_id}/exclusions/:
    get:
      parameters:
      - description: The ID of the contract
        in: path
        name: contract_id
        required: true
        schema:
          format: int32
          type: integer
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ContractExclusionListResponse'
          description: OK
      summary: Get excluded countries by contract id
    post:
      parameters:
      - description: The ID of the contract
        in: path
        name: contract_id
        required: true
        schema:
          format: int32
          type: integer
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Exclusions'
        required: true
      responses:
        '201':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ContractExclusion'
          description: Created
      summary: Create countries and stores that should be excluded from distribution
    put:
      parameters:
      - description: The ID of the contract
        in: path
        name: contract_id
        required: true
        schema:
          format: int32
          type: integer
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Exclusions'
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ContractExclusion'
          description: OK
      summary: Update countries and stores that should be excluded from distribution
  /contract/{contract_id}/parties/:
    get:
      parameters:
      - description: id of the contract
        in: path
        name: contract_id
        required: true
        schema:
          type: integer
      responses:
        '200':
          content:
            application/json:
              schema:
                properties:
                  items:
                    items:
                      $ref: '#/components/schemas/ContractPartyDetails'
                    type: array
                  total_count:
                    example: 1
                    type: integer
                type: object
          description: Success
        '400':
          description: Bad Request
      summary: Get a list of contract parties by contract_id
  /contract/{contract_id}/reactivate/:
    put:
      parameters:
      - description: The contract ID
        in: path
        name: contract_id
        required: true
        schema:
          type: integer
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ContractDetails'
          description: 200 OK
      summary: Reactivate a contract
  /contract/{contract_id}/reserves/:
    get:
      parameters:
      - description: The ID of contract
        in: path
        name: contract_id
        required: true
        schema:
          type: integer
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ContractReserveDetail'
          description: 200 OK
      summary: Get reserve by contract id
    post:
      parameters:
      - description: The ID of contract
        in: path
        name: contract_id
        required: true
        schema:
          type: integer
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ContractReservePostBody'
        description: contract reserve details
        required: true
      responses:
        '201':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ContractReserveDetail'
          description: 201 Created
        '400':
          description: 400 invalid data in payload
      summary: Create a reserve associated to the specified contract
    put:
      parameters:
      - description: The ID of contract
        in: path
        name: contract_id
        required: true
        schema:
          type: integer
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ContractReservePostBody'
        description: contract reserve details
        required: true
      responses:
        '201':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ContractReserveDetail'
          description: 201 Created
        '400':
          description: 400 invalid data in payload
      summary: Update a reserve associated to the specified contract, via soft-delete/insert
    delete:
      description: Delete the active contract reserve for a contract
      parameters:
        - description: ID of the contract
          in: path
          name: contract_id
          required: true
          schema:
            format: int32
            type: integer
      responses:
        '204':
          content:
            application/json:
              schema: {}
          description: No Content
        '400':
          content:
            application/json:
              schema: {}
          description: Bad Request
        '401':
          content:
            application/json:
              schema: {}
          description: Unauthorized
        '403':
          content:
            application/json:
              schema: {}
          description: Forbidden
      summary: Delete a contract reserve by contract ID
  /contract/{contract_id}/terminate/:
    put:
      parameters:
      - description: The contract ID
        in: path
        name: contract_id
        required: true
        schema:
          type: integer
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ContractTerminationBody'
        description: Termination details
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ContractTermDetail'
          description: Terminated
        '400':
          description: Bad data received in payload
      summary: Terminate a contract
  /contract/{contract_id}/{target_type}/parties/:
    get:
      parameters:
      - description: id of the contract
        in: path
        name: contract_id
        required: true
        schema:
          type: integer
      - description: must be one of 'contributor', 'label'
        in: path
        name: target_type
        required: true
        schema:
          type: string
      responses:
        '200':
          content:
            application/json:
              schema:
                properties:
                  items:
                    items:
                      $ref: '#/components/schemas/ContractPartyDetails'
                    type: array
                  total_count:
                    example: 1
                    type: integer
                type: object
          description: Success
        '400':
          description: Bad Request
      summary: Get a list of contract parties by contract_id and target_type
  /contracts/:
    get:
      parameters:
      - description: Get contracts by contract name
        in: query
        name: contract_name
        required: false
        schema:
          type: string
      - description: search contracts by name and id
        in: query
        name: search_ter,
        required: false
        schema:
          type: string
      - description: get contracts by account_ids
        in: query
        name: account_ids
        required: false
        schema:
          type: string
      - description: get contracts by contract type
        in: query
        name: contract_type
        required: false
        schema:
          type: string
      - description: get contracts by is_excluded_from_accounting_run
        in: query
        name: is_excluded_from_accounting_run
        required: false
        schema:
          type: boolean
      - description: get contracts by one or more contract lifecycle status(comma
          separated values)
        in: query
        name: contract_statuses
        required: false
        schema:
          type: string
      responses:
        '200':
          content:
            application/json:
              schema:
                properties:
                  items:
                    items:
                      $ref: '#/components/schemas/ContractDetails'
                    type: array
                  total_count:
                    example: 1
                    type: integer
                type: object
          description: 200 OK
      summary: Return a paginated list of contracts
    post:
      requestBody:
        content:
          application/json:
            example:
            - 10
            schema:
              items:
                type: number
              type: array
        description: List of contract_ids.
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                items:
                  $ref: '#/components/schemas/ContractDetails'
                type: array
          description: 200 OK
      summary: GET contracts by a list of contract_ids. Uses POST to allow for a larger
        list of query args.
  /contracts/account/dataloader/:
    post:
      requestBody:
        content:
          application/json:
            schema:
              items:
                type: number
              type: array
        description: List of account_ids.
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                description: List of contracts
                items:
                  $ref: '#/components/schemas/ContractDetails'
                type: array
          description: Success
        '400':
          description: Bad data received in payload
      summary: Get a list of contracts by account_ids
  /contracts/account/{account_id}/:
    get:
      parameters:
      - description: The account ID
        in: path
        name: account_id
        required: true
        schema:
          type: integer
      responses:
        '200':
          content:
            application/json:
              schema:
                items:
                  $ref: '#/components/schemas/ContractDetails'
                type: array
          description: 200 OK
      summary: Return array of contracts belonging to the specified account
  /contracts/accounts/:
    post:
      requestBody:
        content:
          application/json:
            schema:
              items:
                type: integer
              type: array
        description: Array of account_ids
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                items:
                  $ref: '#/components/schemas/ContractDetails'
                type: array
          description: 200 OK
      summary: Get contracts associated to the list of specified account ids. Uses
        POST to allow for a larger list of query args.
  /contracts/dataloader/:
    post:
      requestBody:
        content:
          application/json:
            schema:
              items:
                type: number
              type: array
        description: List of contract_ids.
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                items:
                  $ref: '#/components/schemas/ContractsDataloaderResponse'
                type: array
          description: 200 OK
      summary: Get a list of contracts by contract_ids
  /contracts/mechanical-deductions/account/{account_id}/mechadmin:
    get:
      parameters:
      - description: The ID of the account
        in: path
        name: account_id
        required: true
        schema:
          format: int32
          type: integer
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MechadminResponse'
          description: OK
        '401':
          content:
            application/json:
              schema: {}
          description: Unauthorized
        '403':
          content:
            application/json:
              schema: {}
          description: Forbidden
      summary: Get whether or not an account is a mechadmin
  /contracts/mechanical-deductions/active:
    get:
      description: Returns contracts with active mechanical deductions filtered by
        date.
      parameters:
      - description: 'Filter by active date (format: YYYY-MM-DD). Defaults to today.'
        in: query
        name: date
        required: false
        schema:
          format: date
          type: string
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ActiveContractsByDate'
          description: Success
        '400':
          description: Invalid date format
        '401':
          description: Unauthorized
      summary: Get active contracts with mechanical deductions by date
  /contracts/snapshot/:
    get:
      parameters:
      - description: List of contract IDs
        explode: false
        in: query
        name: contract_ids
        required: false
        schema:
          items:
            type: integer
          type: array
        style: form
      responses:
        '200':
          content:
            text/csv: {}
          description: 200 OK
      summary: Return a csv of contracts
  /contracts/vat-info/:
    post:
      requestBody:
        content:
          application/json:
            example:
            - 10
            - 15
            schema:
              items:
                type: number
              type: array
        description: List of contract_ids.
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                items:
                  $ref: '#/components/schemas/ContractVatInfoDetail'
                type: array
          description: 200 OK
      summary: GET contracts vat info by a list of contract_ids. Uses POST to allow
        for a larger list of query args.
  /contracts/{contract_id}/contract-lifecycle-schedules/:
    get:
      parameters:
      - description: The contract ID
        in: path
        name: contract_id
        required: true
        schema:
          type: integer
      responses:
        '200':
          content:
            application/json:
              schema:
                items:
                  $ref: '#/components/schemas/ContractLifecycleScheduleResponse'
                type: array
          description: 200 OK
        '400':
          description: contract doesn't exist
      summary: Get all contract lifecycle schedules associated to the specified contract
  /contracts/{contract_id}/contract-terms/:
    get:
      parameters:
      - description: The contract ID
        in: path
        name: contract_id
        required: true
        schema:
          type: integer
      responses:
        '200':
          content:
            application/json:
              schema:
                items:
                  $ref: '#/components/schemas/ContractTermDetail'
                type: array
          description: 200 OK
        '404':
          description: 404 contract not found
      summary: Get all contract terms associated to the specified contract
  /dag_run_time/{dag_id}:
    get:
      parameters:
      - description: The ID of the DAG
        example: accounting_run_calculate
        in: path
        name: dag_id
        required: true
        schema:
          type: string
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DagRunTimes'
          description: Success
        '500':
          description: Error getting DAG run times {error}
      summary: Retrieves the run times for a particular DAG
  /earnings-transfer/bulk:
    post:
      description: Create one or more earnings transfer records in bulk. Each record
        specifies a source and destination contract, transfer type, amount, and other
        configuration.
      parameters: []
      requestBody:
        content:
          application/json:
            schema:
              items:
                $ref: '#/components/schemas/EarningsTransferPost'
              type: array
        required: true
      responses:
        '201':
          content:
            application/json:
              schema:
                items:
                  $ref: '#/components/schemas/EarningsTransferDetail'
                type: array
          description: The list of created earnings transfers
        '400':
          content:
            application/json:
              schema: {}
          description: Invalid request body or contract validation error
        '401':
          content:
            application/json:
              schema: {}
          description: Missing or invalid authentication credentials
        '500':
          content:
            application/json:
              schema: {}
          description: Unexpected server error
      summary: Create one or more EarningsTransfer
    put:
      description: Update one or more existing earnings transfer records in bulk.
        Each record must specify its unique ID.
      parameters: []
      requestBody:
        content:
          application/json:
            schema:
              items:
                $ref: '#/components/schemas/EarningsTransferPut'
              type: array
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                items:
                  $ref: '#/components/schemas/EarningsTransferDetail'
                type: array
          description: The list of updated earnings transfers
        '400':
          content:
            application/json:
              schema: {}
          description: Invalid request body, ID not found, or validation error
        '401':
          content:
            application/json:
              schema: {}
          description: Missing or invalid authentication credentials
        '500':
          content:
            application/json:
              schema: {}
          description: Unexpected server error
      summary: Update one or more EarningsTransfer
  /earnings-transfer/{earnings_transfer_id}:
    get:
      description: Retrieve a specific earnings transfer by ID.
      parameters:
      - description: The unique ID of the earnings transfer
        in: path
        name: earnings_transfer_id
        required: true
        schema:
          format: int32
          type: integer
        type: integer
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/EarningsTransferDetail'
          description: The earnings transfer
        '401':
          content:
            application/json:
              schema: {}
          description: Unauthorized
        '404':
          content:
            application/json:
              schema: {}
          description: Not Found
        '500':
          content:
            application/json:
              schema: {}
          description: Internal server error
      summary: Get an earnings transfer.
  /earnings-transfers:
    get:
      description: Retrieves a paginated list of earnings transfers.
      parameters: []
      responses:
        '200':
          content:
            application/json:
              schema:
                items:
                  $ref: '#/components/schemas/EarningsTransferDetail'
                type: array
          description: the list of earnings transfers
        '400':
          content:
            application/json:
              schema: {}
          description: Invalid query parameter syntax or validation error
        '401':
          content:
            application/json:
              schema: {}
          description: Unauthorized
        '500':
          content:
            application/json:
              schema: {}
          description: Internal server error
      summary: Get the list of earnings transfers.
  /file-upload:
    post:
      parameters: []
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/InitiateUploadRequest'
        required: true
      responses:
        '201':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InitiateUploadResponse'
          description: Upload initiated successfully with presigned URLs
        '400':
          content:
            application/json:
              schema: {}
          description: Invalid request body or validation error
        '401':
          content:
            application/json:
              schema: {}
          description: Unauthorized
        '404':
          content:
            application/json:
              schema: {}
          description: Upload configuration not found for the specified upload type
        '500':
          content:
            application/json:
              schema: {}
          description: Internal server error
      summary: Initiate file upload
  /file-upload-config:
    post:
      parameters: []
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/FileUploadConfigPost'
        required: true
      responses:
        '201':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FileUploadConfigDetail'
          description: Upload configuration successfully created
        '400':
          content:
            application/json:
              schema: {}
          description: Invalid request body or validation error
        '401':
          content:
            application/json:
              schema: {}
          description: Unauthorized
        '409':
          content:
            application/json:
              schema: {}
          description: Configuration with this upload_type already exists
        '500':
          content:
            application/json:
              schema: {}
          description: Internal server error
      summary: Create file upload configuration
  /file-upload-config/{object_id}:
    delete:
      parameters:
      - description: The ID of the file upload configuration
        in: path
        name: object_id
        required: true
        schema:
          format: int32
          type: integer
      responses:
        '204':
          content:
            application/json:
              schema: {}
          description: Configuration successfully deleted
        '401':
          content:
            application/json:
              schema: {}
          description: Unauthorized
        '404':
          content:
            application/json:
              schema: {}
          description: Upload configuration not found
        '500':
          content:
            application/json:
              schema: {}
          description: Internal server error
      summary: Delete file upload configuration
    get:
      parameters:
      - description: The ID of the file upload configuration
        in: path
        name: object_id
        required: true
        schema:
          format: int32
          type: integer
      - description: Include audit fields (created_at, created_by, last_modified,
          last_modified_by, deleted_at, deleted_by)
        in: query
        name: verbose
        required: false
        schema:
          type: boolean
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FileUploadConfigDetailVerbose'
          description: Returns upload configuration (audit fields included only when
            verbose=true)
        '401':
          content:
            application/json:
              schema: {}
          description: Unauthorized
        '404':
          content:
            application/json:
              schema: {}
          description: Upload configuration not found
        '500':
          content:
            application/json:
              schema: {}
          description: Internal server error
      summary: Get file upload configuration by ID
    put:
      parameters:
      - description: The ID of the file upload configuration
        in: path
        name: object_id
        required: true
        schema:
          format: int32
          type: integer
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/FileUploadConfigPut'
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FileUploadConfigDetailVerbose'
          description: Returns updated upload configuration with audit fields
        '400':
          content:
            application/json:
              schema: {}
          description: Invalid request body or validation error
        '401':
          content:
            application/json:
              schema: {}
          description: Unauthorized
        '404':
          content:
            application/json:
              schema: {}
          description: Upload configuration not found
        '500':
          content:
            application/json:
              schema: {}
          description: Internal server error
      summary: Update file upload configuration
  /file-upload-configs:
    get:
      parameters:
      - description: Include audit fields (created_at, created_by, last_modified,
          last_modified_by, deleted_at, deleted_by)
        in: query
        name: verbose
        required: false
        schema:
          type: boolean
      responses:
        '200':
          content:
            application/json:
              schema:
                items:
                  $ref: '#/components/schemas/FileUploadConfigDetailVerbose'
                type: array
          description: Returns list of all active upload configurations (audit fields
            included only when verbose=true)
        '401':
          content:
            application/json:
              schema: {}
          description: Unauthorized
        '500':
          content:
            application/json:
              schema: {}
          description: Internal server error
      summary: Get list of file upload configurations
  /file-upload/{file_key}:
    get:
      parameters:
      - description: Unique file key (UUID)
        in: path
        name: file_key
        required: true
        schema:
          type: string
      - description: Include audit fields (created_at, created_by, last_modified,
          last_modified_by, deleted_at, deleted_by)
        in: query
        name: verbose
        required: false
        schema:
          type: boolean
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FileUploadDetailVerbose'
          description: Returns file upload record with status and metadata (audit
            fields included only when verbose=true)
        '401':
          content:
            application/json:
              schema: {}
          description: Unauthorized
        '404':
          content:
            application/json:
              schema: {}
          description: Upload not found
        '500':
          content:
            application/json:
              schema: {}
          description: Internal server error
      summary: Get file upload record
  /file-upload/{file_key}/cancel:
    post:
      parameters:
      - description: Unique file key (UUID)
        in: path
        name: file_key
        required: true
        schema:
          type: string
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FileUploadDetail'
          description: Upload successfully cancelled
        '400':
          content:
            application/json:
              schema: {}
          description: Invalid operation (e.g., cancelling a completed upload)
        '401':
          content:
            application/json:
              schema: {}
          description: Unauthorized
        '404':
          content:
            application/json:
              schema: {}
          description: Upload not found
        '500':
          content:
            application/json:
              schema: {}
          description: Internal server error
      summary: Cancel file upload
  /file-upload/{file_key}/complete:
    post:
      parameters:
      - description: Unique file key (UUID)
        in: path
        name: file_key
        required: true
        schema:
          type: string
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FileUploadDetail'
          description: Upload successfully completed and verified
        '400':
          content:
            application/json:
              schema: {}
          description: Invalid operation (e.g., completing a cancelled upload)
        '401':
          content:
            application/json:
              schema: {}
          description: Unauthorized
        '404':
          content:
            application/json:
              schema: {}
          description: Upload not found
        '500':
          content:
            application/json:
              schema: {}
          description: Internal server error
      summary: Complete file upload
  /file-upload/{file_key}/download:
    get:
      parameters:
      - description: Unique file key (UUID)
        in: path
        name: file_key
        required: true
        schema:
          type: string
      responses:
        '200':
          content:
            application/json:
              schema: {}
          description: Returns download URL with expiration and file metadata
        '400':
          content:
            application/json:
              schema: {}
          description: File not available for download (e.g., upload not completed)
        '401':
          content:
            application/json:
              schema: {}
          description: Unauthorized
        '404':
          content:
            application/json:
              schema: {}
          description: Upload not found
        '500':
          content:
            application/json:
              schema: {}
          description: Internal server error
      summary: Generate presigned download URL for uploaded file
  /file-upload/{file_key}/quarantine:
    post:
      parameters:
      - description: Unique file key (UUID)
        in: path
        name: file_key
        required: true
        schema:
          type: string
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FileUploadDetail'
          description: Infected uploads are successfully moved.
        '400':
          content:
            application/json:
              schema: {}
          description: Invalid operation (e.g., completing a cancelled upload)
        '401':
          content:
            application/json:
              schema: {}
          description: Unauthorized
        '404':
          content:
            application/json:
              schema: {}
          description: Upload not found
        '500':
          content:
            application/json:
              schema: {}
          description: Internal server error
      summary: Files that fail the AV scan are moved to the quarantine s3 bucket.
  /file-upload/{file_key}/status:
    put:
      parameters:
      - description: Unique file key (UUID)
        in: path
        name: file_key
        required: true
        schema:
          type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/FileUploadStatusPut'
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FileUploadDetail'
          description: Updated the upload status successfully.
        '400':
          content:
            application/json:
              schema: {}
          description: Invalid operation (e.g., invalid upload status transition)
        '401':
          content:
            application/json:
              schema: {}
          description: Unauthorized
        '404':
          content:
            application/json:
              schema: {}
          description: Upload not found
        '500':
          content:
            application/json:
              schema: {}
          description: Internal server error
      summary: Updated the file_upload status
  /hello/:
    get:
      responses:
        200:
          description: 200 OK
      summary: Check the health of the application.
  /oa-contracts/contracts/:
    post:
      requestBody:
        content:
          application/json:
            schema:
              items:
                type: integer
              type: array
        description: The list of oa_contract_ids
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                items:
                  $ref: '#/components/schemas/ContractDetails'
                type: array
          description: 200 OK
      summary: GET contracts belonging to the specified orchard admin contracts. Uses
        POST to allow for a larger list of query args.
  /reference-flowthrough-calculation/{reference_flowthrough_calculation_id}/:
    get:
      description: Get a reference_flowthrough_calculation by reference_flowthrough_calculation_id
      parameters:
      - description: ID of the reference_flowthrough_calculation
        in: path
        name: reference_flowthrough_calculation_id
        required: true
        schema:
          type: integer
      responses:
        200:
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ReferenceFlowthroughCalculation'
          description: Success
        404:
          description: Not found
      summary: GET a reference_flowthrough_calculation by ID
  /reference-flowthrough-calculations/:
    get:
      description: GET list of reference flowthrough calculations
      responses:
        200:
          content:
            application/json:
              schema:
                properties:
                  items:
                    items:
                      $ref: '#/components/schemas/ReferenceFlowthroughCalculation'
                    type: array
                  total_count:
                    example: 1
                    type: integer
                type: object
          description: Success
      summary: GET list of reference flowthrough calculations
  /reference-mechanical-rate/{reference_mechanical_rate_id}/:
    get:
      parameters:
      - description: ID of the reference_mechanical_rate
        in: path
        name: reference_mechanical_rate_id
        required: true
        schema:
          type: integer
      responses:
        200:
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ReferenceMechanicalRateDetail'
          description: Success
        404:
          description: reference_mechanical_rate Not found
      summary: GET a reference_mechanical_rate by reference_mechanical_rate_id
  /reference-mechanical-rates/:
    get:
      responses:
        200:
          content:
            application/json:
              schema:
                properties:
                  items:
                    items:
                      $ref: '#/components/schemas/ReferenceMechanicalRateDetail'
                    type: array
                  total_count:
                    example: 1
                    type: integer
                type: object
          description: Success
      summary: GET a list of reference mechanical rates
  /reference-payment-entities/:
    get:
      description: GET a list of reference payment entities
      responses:
        200:
          content:
            application/json:
              schema:
                properties:
                  items:
                    items:
                      $ref: '#/components/schemas/ReferencePaymentEntityDetail'
                    type: array
                  total_count:
                    example: 1
                    type: integer
                type: object
          description: Success
      summary: GET a list of reference payment entities
  /reference-payment-entity/{reference_payment_entity_id}/:
    get:
      description: Get a reference_payment_entity by reference_payment_entity_id
      parameters:
      - description: ID of the reference_payment_entity
        in: path
        name: reference_payment_entity_id
        required: true
        schema:
          type: integer
      responses:
        200:
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ReferencePaymentEntityDetail'
          description: Success
        404:
          description: Not found
      summary: GET a reference_payment_entity by ID
  /reference-payment-type/{reference_payment_type_id}/:
    get:
      description: GET a Payment Type by reference_payment_type_id
      parameters:
      - description: The abacus ID of the Payment Type
        in: path
        name: reference_payment_type_id
        required: true
        schema:
          type: integer
      responses:
        200:
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ReferencePaymentTypeDetail'
          description: Success
        404:
          description: Not found
      summary: GET a Payment Type by ID
  /reference-payment-types/:
    get:
      description: GET list of Payment Types ordered by reference_payment_type_id
      responses:
        200:
          content:
            application/json:
              schema:
                properties:
                  items:
                    items:
                      $ref: '#/components/schemas/ReferencePaymentTypeDetail'
                    type: array
                  total_count:
                    example: 1
                    type: integer
                type: object
          description: Success
      summary: GET list of Payment Types
  /reference-sap-profit-center/:
    post:
      parameters: []
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ReferenceSapProfitCenterPost'
        required: true
      responses:
        '201':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ReferenceSapProfitCenter'
          description: Profit Center successfully created
        '400':
          content:
            application/json:
              schema: {}
          description: Invalid request body or validation error
        '401':
          content:
            application/json:
              schema: {}
          description: Unauthorized
        '500':
          content:
            application/json:
              schema: {}
          description: Internal server error
      summary: Create a new Reference SAP Profit Center and map its associated Signing
        Entities.
  /reference-sap-profit-center/reference-signing-entities/dataloader:
    post:
      description: Retrieves a list of active signing entities authorized for the
        provided SAP profit center IDs passed in the request body.
      parameters: []
      responses:
        '200':
          content:
            application/json:
              schema:
                items:
                  $ref: '#/components/schemas/SapProfitCenterSigningEntityDataloader'
                type: array
          description: A list of authorized signing entity mappings matching the provided
            IDs.
        '400':
          content:
            application/json:
              schema: {}
          description: Invalid request body payload or validation error.
        '401':
          content:
            application/json:
              schema: {}
          description: Unauthorized
        '500':
          content:
            application/json:
              schema: {}
          description: Internal server error.
      summary: Fetch signing entities by SAP profit center IDs.
  /reference-sap-profit-center/{reference_sap_profit_center_id}/:
    get:
      description: Get SAP Profit Center by reference_sap_profit_center_id
      parameters:
      - description: The abacus ID of the SAP Profit Center
        in: path
        name: reference_sap_profit_center_id
        required: true
        schema:
          type: integer
      responses:
        200:
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ReferenceSapProfitCenterDetail'
          description: Success
        404:
          description: Not found
      summary: GET an SAP Profit Center by ID
  /reference-sap-profit-center/{sap_profit_center_id}/signing-entities/bulk:
    post:
      description: Bulk create or restore Signing Entity assignments for a specific
        SAP Profit Center.
      parameters:
      - in: path
        name: sap_profit_center_id
        required: true
        schema:
          format: int32
          type: integer
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SigningEntitySapProfitCenterPostByProfitCenter'
        required: false
      responses:
        '201':
          content:
            application/json:
              schema:
                items:
                  $ref: '#/components/schemas/SigningEntitySapProfitCenterDetail'
                type: array
          description: Successfully created or restored the mappings.
        '400':
          description: Invalid request payload or missing references.
        '401':
          description: Authorization rules check failed.
        '409':
          description: A mapping relationship already exists and is active.
      summary: Bulk associate signing entities to a profit center
      tags:
      - Signing Entity SAP Profit Center Mappings
  /reference-sap-profit-centers:
    get:
      description: Retrieves a paginated list of SAP profit centers.
      parameters:
      - description: The column name used to sort the results.
        in: query
        name: sort_by
        type: string
      - default: 100
        description: The maximum number of records to return per page.
        in: query
        name: limit
        type: integer
      - description: Free-text search query matched against display_name and profit_center.
        in: query
        name: search_term
        type: string
      - description: The sort direction; must be either "asc" or "desc".
        in: query
        name: sort_order
        type: string
      - description: Comma separated signing entity ids
        in: query
        name: signing_entity_ids
        type: string
      - default: 0
        description: The number of records to skip before starting to return results.
        in: query
        name: offset
        type: integer
      - default: false
        description: If true, filters results to only return records that lack an
          active mapping/junction entry.
        in: query
        name: orphan
        type: boolean
      responses:
        '200':
          content:
            application/json:
              schema:
                items:
                  $ref: '#/components/schemas/ReferenceSapProfitCenter'
                type: array
          description: the list of reference-sap-profit-centers
        '400':
          content:
            application/json:
              schema: {}
          description: Invalid query parameter syntax or validation error
        '401':
          content:
            application/json:
              schema: {}
          description: Unauthorized
        '500':
          content:
            application/json:
              schema: {}
          description: Internal server error
      summary: Get the list of SAP profit centers.
  /reference-sap-profit-centers/dataloader:
    post:
      description: Retrieves a list of SAP profit centers for the IDs passed in the
        request body.
      parameters: []
      responses:
        '200':
          content:
            application/json:
              schema:
                items:
                  $ref: '#/components/schemas/ReferenceSapProfitCenterDataloader'
                type: array
          description: A list of SAP profit centers.
        '400':
          content:
            application/json:
              schema: {}
          description: Invalid request body payload or validation error.
        '401':
          content:
            application/json:
              schema: {}
          description: Unauthorized
        '500':
          content:
            application/json:
              schema: {}
          description: Internal server error.
      summary: Fetch SAP profit centers by IDs.
  /reference-signing-entities/:
    get:
      description: GET a list of reference signing entities
      parameters: []
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ReferenceSigningEntityListResponse'
          description: OK
      summary: GET a list of reference signing entities
  /reference-signing-entities/dataloader:
    post:
      description: Retrieves a list of signing entity ids passed in the request body.
      parameters: []
      responses:
        '200':
          content:
            application/json:
              schema:
                items:
                  $ref: '#/components/schemas/ReferenceSigningEntityDataloader'
                type: array
          description: A list of signing entities.
        '400':
          content:
            application/json:
              schema: {}
          description: Invalid request body payload or validation error.
        '401':
          content:
            application/json:
              schema: {}
          description: Unauthorized
        '500':
          content:
            application/json:
              schema: {}
          description: Internal server error.
      summary: Fetch signing entities by IDs.
  /reference-signing-entity/reference-sap-profit-centers/dataloader:
    post:
      description: Retrieves a list of active SAP profit centers authorized for the
        provided signing entity IDs passed in the request body.
      parameters: []
      responses:
        '200':
          content:
            application/json:
              schema:
                items:
                  $ref: '#/components/schemas/SigningEntitySapProfitCenterDataloader'
                type: array
          description: A list of authorized SAP profit center mappings matching the
            provided IDs.
        '400':
          content:
            application/json:
              schema: {}
          description: Invalid request body payload or validation error.
        '401':
          content:
            application/json:
              schema: {}
          description: Unauthorized
        '500':
          content:
            application/json:
              schema: {}
          description: Internal server error.
      summary: Fetch SAP profit centers by signing entity IDs.
  /reference-signing-entity/{object_id}/:
    get:
      description: Get a reference_signing_entity by reference_signing_entity_id
      parameters:
      - description: ID of the reference_signing_entity
        in: path
        name: object_id
        required: true
        schema:
          format: int32
          type: integer
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ReferenceSigningEntity'
          description: OK
        '404':
          content:
            application/json:
              schema: {}
          description: Not Found
      summary: GET a reference_signing_entity by ID
  /reference-transaction-type-group/group-admin/{group_admin}/:
    get:
      description: Get list of reference_transaction_type_groups by the group_admin
        category
      parameters:
      - description: one of 'contract_admin', 'tax_admin', or 'workstation'
        in: path
        name: group_admin
        required: true
        schema:
          type: string
      responses:
        200:
          content:
            application/json:
              schema:
                items:
                  $ref: '#/components/schemas/ReferenceTransactionTypeGroupDetail'
                type: array
          description: Success
        404:
          description: invalid group_admin
      summary: Get list of transaction type groups by the group_admin
  /reference-transaction-type-group/reference_transaction_type_group_transaction_types:
    get:
      responses:
        200:
          content:
            application/json:
              schema:
                items:
                  $ref: '#/components/schemas/ReferenceTransactionTypeGroupTransactionType'
                type: array
          description: Success
      summary: Get a list of transaction type groups and their transaction_types
  /reference-transaction-type-group/{reference_transaction_type_group_id}/reference-transaction-types/:
    get:
      description: Get a list of reference_transaction_type by reference_transaction_type_group_id
      parameters:
      - description: ID of the parent reference_transaction_type_group_id
        in: path
        name: reference_transaction_type_group_id
        required: true
        schema:
          type: integer
      responses:
        200:
          content:
            application/json:
              schema:
                items:
                  $ref: '#/components/schemas/ReferenceTransactionTypeDetail'
                type: array
          description: Success
        404:
          description: reference_transaction_type_group_id does not exist
      summary: Get a list of transaction types by parent group
  /reference-transaction-type-groups:
    get:
      responses:
        200:
          content:
            application/json:
              schema:
                items:
                  $ref: '#/components/schemas/ReferenceTransactionTypeGroupDetail'
                type: array
          description: Success
      summary: Get a list of all transaction type groups
  /reference-transaction-types/:
    get:
      responses:
        '200':
          content:
            application/json:
              schema:
                items:
                  $ref: '#/components/schemas/ReferenceTransactionTypeDetail'
                type: array
          description: Success
      summary: Get transaction types
  /statement-period-adjustment-batch-criteria:
    post:
      parameters: []
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/StatementPeriodAdjustmentBatchCriteriaPost'
        required: true
      responses:
        '201':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/StatementPeriodAdjustmentBatchCriteriaDetail'
          description: StatementPeriodAdjustmentBatchCriteria successfully created
        '400':
          content:
            application/json:
              schema: {}
          description: Invalid request body or validation error
        '401':
          content:
            application/json:
              schema: {}
          description: Unauthorized
        '500':
          content:
            application/json:
              schema: {}
          description: Internal server error
      summary: Create StatementPeriodAdjustmentBatchCriteria
  /statement-period-adjustment-file/by-source-file-key/{source_file_key}:
    get:
      parameters:
      - description: The source file key of the adjustment file.
        in: path
        name: source_file_key
        required: true
        schema:
          type: string
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/StatementPeriodAdjustmentFileDetail'
          description: OK
        '404':
          content:
            application/json:
              schema: {}
          description: Not Found
      summary: Get adjustment file by source file upload key.
  /statement-period-adjustment-file/validate-adjustments:
    post:
      parameters: []
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ValidateAdjustmentsPost'
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ValidateAdjustmentsResponse'
          description: OK
        '401':
          content:
            application/json:
              schema: {}
          description: Unauthorized
      summary: Validate a list of manual adjustments
  /statement-period-adjustment-file/{statement_period_adjustment_file_id}/batch-criteria/:
    get:
      parameters:
      - description: ID of the statement_period_adjustment_file
        in: path
        name: statement_period_adjustment_file_id
        required: true
        schema:
          type: string
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/StatementPeriodAdjustmentBatchCriteriaDetail'
          description: Returns batch record
        '401':
          content:
            application/json:
              schema: {}
          description: Unauthorized
        '404':
          content:
            application/json:
              schema: {}
          description: Batch not found
        '500':
          content:
            application/json:
              schema: {}
          description: Internal server error
      summary: Get the statement_period_adjustment_batch_criteria by file id
  /statement-period/{statement_period_id}/adjustment-file/batch-criteria:
    post:
      parameters:
      - in: path
        name: statement_period_id
        required: true
        schema:
          format: int32
          type: integer
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/StatementPeriodAdjustmentFileAndBatchCriteriaPost'
        required: true
      responses:
        '201':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/StatementPeriodAdjustmentFileDetail'
          description: StatementPeriodAdjustmentFile and StatementPeriodAdjustmentBatchCriteria
            successfully created
        '400':
          content:
            application/json:
              schema: {}
          description: Invalid request body or validation error
        '401':
          content:
            application/json:
              schema: {}
          description: Unauthorized
        '500':
          content:
            application/json:
              schema: {}
          description: Internal server error
      summary: Create the adjustment file and the corresponding batch criteria.
  /statement-period/{statement_period_id}/adjustments/auto-generation/progress:
    get:
      parameters:
      - description: ID of the statement_period
        in: path
        name: statement_period_id
        required: true
        schema:
          format: int32
          type: integer
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AutoGenerationInProgressOrError'
          description: Returns auto generated file record which is in progress
        '400':
          content:
            application/json:
              schema: {}
          description: Selected statement period status must be current
        '401':
          content:
            application/json:
              schema: {}
          description: Unauthorized
        '404':
          content:
            application/json:
              schema: {}
          description: Statement period not found
        '500':
          content:
            application/json:
              schema: {}
          description: Internal server error
      summary: Get the auto-generated adjustment files that are currently being processed
        or have encountered an error
  /transfer-job/{job_id}/terms:
    get:
      parameters:
      - in: path
        name: job_id
        required: true
        schema:
          minimum: 0
          type: integer
      responses:
        '200':
          content:
            application/json:
              schema:
                items:
                  $ref: '#/components/schemas/ProjectTransferTermDetail'
                type: array
          description: Transfer terms (with nested conditions) for the given job;
            empty array if none exist
        '401':
          content:
            application/json:
              schema: {}
          description: Unauthorized
        '500':
          content:
            application/json:
              schema: {}
          description: Internal server error
      summary: Get the transfer terms for a project transfer job
    post:
      parameters:
      - in: path
        name: job_id
        required: true
        schema:
          minimum: 0
          type: integer
      requestBody:
        content:
          application/json:
            schema:
              items:
                $ref: '#/components/schemas/ProjectTransferTermInput'
              type: array
        required: true
      responses:
        '201':
          content:
            application/json:
              schema:
                items:
                  $ref: '#/components/schemas/ProjectTransferTermDetail'
                type: array
          description: Transfer terms successfully created
        '400':
          content:
            application/json:
              schema: {}
          description: Invalid request body or validation error
        '401':
          content:
            application/json:
              schema: {}
          description: Unauthorized
        '500':
          content:
            application/json:
              schema: {}
          description: Internal server error
      summary: Create transfer terms for a project transfer job
servers:
- description: QA server
  url: https://qa-ows-royalties.theorchard.io
