createCreditNote
Requires permission sales:credit_note:create.
Creates a credit note for a customer, optionally against a sales invoice or a return. It starts as PENDING. A note against an invoice takes that invoice's currency and exchange rate; a standalone note uses the organization's base currency. The server works out the note's money from its lines, and the amount credited across an invoice's notes cannot exceed the invoice; see invoiceCreditHeadroom.
Errors: a failed call returns a GraphQL errors entry, not a field on the result, and data may be null or partial. Read the entry's extensions.code and message; every shape and code is in the Error reference.
Example:
- GraphQL
- cURL
mutation CreateCreditNote($input: CreateCreditNoteInput!) {
createCreditNote(input: $input) {
id
creditNoteNumber
partnerName
status
type
createdAt
createdBy {
name
}
}
}
curl -X POST "https://<api-host>/graphql" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
--data @- <<'EOF'
{
"query": "mutation CreateCreditNote($input: CreateCreditNoteInput!) {\n createCreditNote(input: $input) {\n id\n creditNoteNumber\n partnerName\n status\n type\n createdAt\n createdBy {\n name\n }\n }\n}",
"variables": {
"input": {
"amount": 0,
"items": [
{
"amount": 0,
"description": "string",
"quantity": 0,
"unitPrice": 0
}
],
"partnerId": "string",
"reason": "string",
"type": "string"
}
}
}
EOF
Variables:
{
"input": {
"amount": 0,
"items": [
{
"amount": 0,
"description": "string",
"quantity": 0,
"unitPrice": 0
}
],
"partnerId": "string",
"reason": "string",
"type": "string"
}
}
Response:
{
"data": {
"createCreditNote": {
"id": "id",
"creditNoteNumber": "string",
"partnerName": "string",
"status": "string",
"type": "string",
"createdAt": "2025-01-15T00:00:00Z",
"createdBy": {
"name": "string"
}
}
}
}
Issue a credit note for a returned item:
- GraphQL
- cURL
mutation CreateCreditNote($input: CreateCreditNoteInput!) {
createCreditNote(input: $input) {
id
creditNoteNumber
status
currency
totalAmount
}
}
curl -X POST "https://<api-host>/graphql" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
--data @- <<'EOF'
{
"query": "mutation CreateCreditNote($input: CreateCreditNoteInput!) {\n createCreditNote(input: $input) {\n id\n creditNoteNumber\n status\n currency\n totalAmount\n }\n}",
"variables": {
"input": {
"partnerId": "CUSTOMER_ID",
"type": "SALES_RETURN",
"reason": "Item returned",
"amount": 100,
"originalInvoiceId": "INVOICE_ID",
"items": [
{
"description": "Line description",
"quantity": 1,
"unitPrice": 100,
"amount": 100
}
]
}
}
}
EOF
Variables:
{
"input": {
"partnerId": "CUSTOMER_ID",
"type": "SALES_RETURN",
"reason": "Item returned",
"amount": 100,
"originalInvoiceId": "INVOICE_ID",
"items": [
{
"description": "Line description",
"quantity": 1,
"unitPrice": 100,
"amount": 100
}
]
}
}
Response:
{
"data": {
"createCreditNote": {
"id": "CREDIT_NOTE_ID",
"creditNoteNumber": "CREDIT_NOTE_NUMBER",
"status": "DRAFT",
"currency": "CURRENCY_CODE",
"totalAmount": 100
}
}
}
createCreditNote(
input: CreateCreditNoteInput!
): CreditNote!
Arguments
createCreditNote.input ● CreateCreditNoteInput! non-null input
The details of the credit note to create.
Type
CreditNote object
A credit note: money owed back to a customer, from a sales return, a price adjustment or goodwill.