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

# Download a credit note as PDF

> Renders and streams the credit note as an inline PDF.



## OpenAPI

````yaml /openapi/credit_notes.yaml get /credit_notes/{id}/pdf
openapi: 3.0.3
info:
  title: Ionic Credit Notes API
  version: '2026-05-01'
  description: >
    Credit notes — accounting documents that offset paid invoices.


    A credit note (`cn_…`) is an immutable document issued against a paid

    invoice. It reduces the invoice's effective balance by the credited amount.

    Every credit note carries a sequential, per-merchant/mode number

    (for example `CN-000001`; test-mode notes use `TEST-CN-000001`). Once

    issued, a credit note cannot be edited — it can only be voided, which

    creates an equal and opposite accounting entry.


    All monetary amounts are integers in the currency's minor unit (for example

    cents for USD). Timestamps are Unix epoch seconds. Identifiers are opaque,

    prefixed strings: credit notes are `cn_…`, credit note lines `cnl_…`.


    Authentication uses a merchant secret key (`sk_…`) as a bearer token. Read

    endpoints require the `credit_notes:read` permission; write endpoints
    require

    `credit_notes:write`. The mode of the key (test or live) scopes which

    resources it can see and mutate, reflected by each resource's `livemode`

    field. Send an `Idempotency-Key` header on create and void so a retried

    request never issues a duplicate credit or voids an already-voided note.


    Errors are returned as `{ "error": { "code": "...", "message": "..." } }`.
servers:
  - url: '{baseUrl}/v1'
    variables:
      baseUrl:
        default: https://api.ionicfi.com
        description: API base URL for your environment.
security:
  - secretKey: []
tags:
  - name: Credit Notes
    description: >-
      Issue, retrieve, list, void, and download credit notes against paid
      invoices.
paths:
  /credit_notes/{id}/pdf:
    parameters:
      - $ref: '#/components/parameters/CreditNoteId'
    get:
      tags:
        - Credit Notes
      summary: Download a credit note as PDF
      description: Renders and streams the credit note as an inline PDF.
      operationId: credit_notes_retrieve_pdf
      responses:
        '200':
          description: The credit note rendered as a PDF.
          headers:
            Content-Disposition:
              description: '`inline; filename="CN-000001.pdf"`'
              schema:
                type: string
          content:
            application/pdf:
              schema:
                type: string
                format: binary
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/CreditNoteNotFound'
        '429':
          $ref: '#/components/responses/RateLimited'
        '500':
          $ref: '#/components/responses/InternalError'
      security:
        - secretKey:
            - credit_notes:read
components:
  parameters:
    CreditNoteId:
      name: id
      in: path
      required: true
      description: The credit note id (`cn_…`).
      schema:
        type: string
  responses:
    BadRequest:
      description: The request was malformed or failed validation.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error:
              code: INVALID_DATA
              message: provide either lines or a single amount, not both
    Unauthorized:
      description: Missing or invalid API key.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Forbidden:
      description: The key lacks the required permission, or the merchant is not active.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    CreditNoteNotFound:
      description: No credit note with that id is visible to this key.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error:
              code: CREDIT_NOTE_NOT_FOUND
              message: credit note not found
    RateLimited:
      description: Too many requests. Honour the `Retry-After` header before retrying.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    InternalError:
      description: >-
        The API could not complete the request. For the PDF endpoint, the
        document could not be rendered.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error:
              code: PDF_RENDER_FAILED
              message: failed to render credit note PDF
  schemas:
    Error:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
              description: A stable, machine-readable error code.
            message:
              type: string
  securitySchemes:
    secretKey:
      type: http
      scheme: bearer
      description: 'A merchant secret key (`sk_…`) sent as `Authorization: Bearer <key>`.'

````