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

# Finalize credit note

> Submits the credit note to the tax agency (when applicable) and locks the document.



## OpenAPI

````yaml GET /creditnotes/{id}/finalize/
openapi: 3.0.3
info:
  title: Piriod API
  version: 1.0.0
  description: >
    Piriod API for billing, payments, procurement and collections.


    All requests require:

    - `Authorization: Token <api_token>` header.

    - `x-simple-workspace: <workspace_id>` header (the account/workspace
    identifier).

    - Optionally `x-piriod-test-mode: true` to operate against test-mode data.


    See the Documentation tab for getting started, integration flows,
    authentication,

    error handling and pagination/filtering guides.
servers:
  - url: https://api.piriod.com
    description: Production
security:
  - TokenAuth: []
paths:
  /creditnotes/{id}/finalize/:
    parameters:
      - $ref: '#/components/parameters/IdPath'
      - $ref: '#/components/parameters/WorkspaceHeader'
      - $ref: '#/components/parameters/TestModeHeader'
    get:
      tags:
        - Billing
      summary: Finalize credit note
      description: >-
        Submits the credit note to the tax agency (when applicable) and locks
        the document.
      responses:
        '200':
          description: Finalized credit note.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreditNote'
        '400':
          $ref: '#/components/responses/ValidationFailed'
components:
  parameters:
    IdPath:
      name: id
      in: path
      required: true
      schema:
        type: string
      description: Resource identifier.
    WorkspaceHeader:
      name: x-simple-workspace
      in: header
      required: true
      schema:
        type: string
      description: Workspace (account) identifier. Required for every request.
      example: acc_01H8XYZ123ABC
    TestModeHeader:
      name: x-piriod-test-mode
      in: header
      required: false
      schema:
        type: boolean
        default: false
      description: Whether to operate against test-mode data. Defaults to `false`.
  schemas:
    CreditNote:
      type: object
      properties:
        id:
          type: integer
          readOnly: true
        invoice:
          type: string
          description: Invoice ID this credit note adjusts.
        document:
          type: integer
          nullable: true
          description: >-
            Credit-note document type. Optional; the biller may assign one at
            finalize.
        number:
          type: integer
          readOnly: true
        date:
          type: string
          format: date
        note:
          type: string
          maxLength: 64
          nullable: true
        internal_note:
          type: string
          maxLength: 1024
          nullable: true
        amount:
          type: number
          nullable: true
        exempt:
          type: number
          nullable: true
        tax:
          type: number
          nullable: true
        tax_percent:
          type: number
          nullable: true
        subtotal:
          type: number
          nullable: true
        total:
          type: number
          nullable: true
        retention:
          type: number
          nullable: true
        discount:
          type: number
          nullable: true
        discount_scheme:
          type: string
          enum:
            - '%'
            - $
          nullable: true
        status:
          type: string
          enum:
            - draft
            - finalized
            - cancelled
          readOnly: true
        biller_status:
          type: string
          readOnly: true
        tax_agency:
          type: object
          readOnly: true
        local_file:
          type: string
          format: uri
          readOnly: true
          nullable: true
        imported:
          type: boolean
          readOnly: true
        test_mode:
          type: boolean
          readOnly: true
        lines:
          type: array
          items:
            $ref: '#/components/schemas/CreditNoteLine'
        created:
          type: string
          format: date-time
          readOnly: true
        updated:
          type: string
          format: date-time
          readOnly: true
      required:
        - invoice
        - date
    CreditNoteLine:
      type: object
      properties:
        id:
          type: integer
          readOnly: true
        name:
          type: string
          maxLength: 80
        description:
          type: string
          maxLength: 512
          nullable: true
        amount:
          type: number
        quantity:
          type: number
        exempt:
          type: boolean
        tax:
          type: number
          nullable: true
        tax_percent:
          type: number
          nullable: true
        total:
          type: number
          readOnly: true
        discount:
          type: number
          nullable: true
        discount_scheme:
          type: string
          enum:
            - '%'
            - $
          nullable: true
        code:
          type: string
          maxLength: 32
          nullable: true
        code_scheme:
          type: string
          maxLength: 10
          nullable: true
        retention:
          type: number
          nullable: true
        retention_percent:
          type: number
          default: 0
        retention_scheme:
          type: string
          enum:
            - subtotal
            - tax
          default: subtotal
      required:
        - name
        - amount
        - quantity
        - exempt
    ValidationError:
      type: object
      additionalProperties:
        type: array
        items:
          type: string
      description: |
        Field-keyed error map. The special key `non_field_errors` carries
        errors that are not bound to a specific field.
      example:
        name:
          - This field is required.
        non_field_errors:
          - x-simple-workspace header is required.
  responses:
    ValidationFailed:
      description: Request body or query parameters failed validation.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ValidationError'
  securitySchemes:
    TokenAuth:
      type: apiKey
      in: header
      name: Authorization
      description: |
        Use header `Authorization: Token <api_token>`.
        API tokens are obtained from the Piriod dashboard.

````