Filter Credit Notes
Credit notes are used to record refunds, cancellations, or invoice adjustments. In Pennylane’s API, credit notes are exposed through the Customer Invoices endpoint and can be retrieved by filtering on the invoice type.
Filtering helps reduce dataset size, improve performance, and synchronize only the documents your integration needs.
This guide explains how to retrieve credit notes using the filters[] parameter on GET /customer_invoices.
Reminder: Filters use a JSON array passed as the filters query parameter. See Filter API Data for the general filtering syntax.
How Filtering Works
Credit notes can be retrieved by filtering customer invoices on their type.
Example request:
GET /customer_invoices?filters=[{"field":"document_type","operator":"eq","value":"credit_note"}]You can combine filters to narrow down results further (e.g., type + invoice number).
Common Use Cases
Developers typically filter credit notes to:
- Retrieve refunds issued for one or more customer invoices
- Identify cancelled or adjusted invoices
- Synchronize credit notes with an external accounting or ERP system
- Build reconciliation or reporting workflows
- Track customer refunds in BI or financial dashboards
Examples
Retrieve credit notes
GET /customer_invoices?filters=[
{"field":"document_type","operator":"eq","value":"credit_note"}
]Retrieve a specific credit note by number
GET /customer_invoices?filters=[
{"field":"document_type","operator":"eq","value":"credit_note"},
{"field":"invoice_number","operator":"eq","value":"CN-2024-0012"}
]Retrieve multiple credit notes
GET /customer_invoices?filters=[
{"field":"document_type","operator":"eq","value":"credit_note"},
{"field":"invoice_number","operator":"in","value":["CN-2024-0012","CN-2024-0015"]}
]Available Fields and Operators
| Field | Description | Value Type | Operators |
|---|---|---|---|
document_type | Document type (use credit_note for credit notes) | String | eq, not_eq, in, not_in |
invoice_number | Credit note reference | String | eq, not_eq, in, not_in |
Tips & Troubleshooting
- URL-encode the filter array to avoid 400 errors.
- Combine filters with pagination when retrieving large datasets (using the pagination mechanism supported by the endpoint).
invoice_numberfiltering is exact match (not a text search).- If your integration needs incremental updates, use the Changelog API instead of refetching all records.
Updated 10 days ago
