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

# Terminate Contract

> Terminate a contract and optionally void associated invoices.

        If the user has permission to terminate contracts and void invoices, both operations
        are performed atomically. If the user lacks permission for either operation, a draft
        is created instead, and the response indicates which operations were drafted.

        Returns 400 if any of the provided void_invoice_ids are invalid (not found, already voided,
        has payments, void date is before the invoice date, or in a closed period).



## OpenAPI

````yaml https://api.meetcampfire.com/api/schema?format=json post /rr/api/v1/contracts/{id}/terminate
openapi: 3.0.3
info:
  title: Campfire Developer APIs
  version: 1.0.0
  description: >
    ## Introduction

    Campfire's developer APIs offer granular access to Campfire's core
    accounting,

    revenue recognition, and financial data features.


    These APIs are designed to be used by developers to build custom
    integrations,

    automate workflows, and perform any other programmatic operations.
servers:
  - url: https://api.meetcampfire.com
    description: Production server
security: []
tags:
  - name: Cash Management
    description: Operations related to accounts, transactions, and other bank-related data.
  - name: Core Accounting
    description: >-
      Operations related to core accounting data, such as the chart of accounts,
      entity management, and the general ledger.
  - name: Revenue Recognition
    description: >-
      Operations related to revenue recognition, contract management, and
      contract data aggregation.
  - name: Accounts Receivable
    description: Operations related to invoicing and the AR subledger
  - name: Accounts Payable
    description: Operations related to billing and the AP subledger.
  - name: Financial Statements
    description: Operations related to financial statement generation and data aggregation.
  - name: Settings
    description: Operations related to system and accounting settings configuration.
paths:
  /rr/api/v1/contracts/{id}/terminate:
    post:
      tags:
        - Revenue Recognition
      summary: Terminate Contract
      description: |-
        Terminate a contract and optionally void associated invoices.

                If the user has permission to terminate contracts and void invoices, both operations
                are performed atomically. If the user lacks permission for either operation, a draft
                is created instead, and the response indicates which operations were drafted.

                Returns 400 if any of the provided void_invoice_ids are invalid (not found, already voided,
                has payments, void date is before the invoice date, or in a closed period).
      operationId: rr_api_v1_contracts_terminate_create
      parameters:
        - in: path
          name: id
          schema:
            type: integer
          required: true
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TerminateContract'
          application/x-www-form-urlencoded:
            schema:
              $ref: '#/components/schemas/TerminateContract'
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/TerminateContract'
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TerminateContractResponse'
          description: ''
      security:
        - knoxApiToken: []
components:
  schemas:
    TerminateContract:
      type: object
      properties:
        termination_date:
          type: string
          format: date
        void_invoice_ids:
          type: array
          items:
            type: integer
          description: >-
            List of invoice IDs to void atomically when terminating the
            contract.
        void_date:
          type: string
          format: date
          description: >-
            Date to use when voiding invoices. Required when void_invoice_ids is
            provided.
      required:
        - termination_date
    TerminateContractResponse:
      type: object
      description: >-
        Response serializer for contract termination with hints about drafted
        operations.
      properties:
        contract_terminated:
          type: boolean
          description: >-
            Whether the contract was terminated directly (True) or drafted
            (False).
        contract_draft_id:
          type: integer
          nullable: true
          description: >-
            Draft queue ID if contract termination was drafted instead of
            executed.
        voided_invoice_ids:
          type: array
          items:
            type: integer
          description: List of invoice IDs that were voided directly.
        drafted_invoice_ids:
          type: array
          items:
            type: integer
          description: >-
            List of invoice IDs that were drafted for voiding (user lacks void
            permission).
      required:
        - contract_terminated
  securitySchemes:
    knoxApiToken:
      type: apiKey
      in: header
      name: Authorization
      description: Token-based authentication with required prefix "Token"

````