GET/api/v1/invoices/{uuid}

Get Credit Note

Retrieves complete details for a specific credit note, including all line items, client information, parent invoice reference, and calculated totals. Credit notes use the same endpoint as invoices since they are a special type of invoice.

Headers

NameTypeRequiredDescription
AuthorizationstringYesBearer token for authentication
X-CompanystringYesCompany UUID to scope the request

Path Parameters

NameTypeRequiredDescription
uuidstringYesThe UUID of the credit note to retrieve

Request

cURL
curl -X GET https://api.storno.ro/api/v1/invoices/850e8400-e29b-41d4-a716-446655440000 \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "X-Company: company-uuid-here"
JavaScript
const response = await fetch('https://api.storno.ro/api/v1/invoices/850e8400-e29b-41d4-a716-446655440000', {
  method: 'GET',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
    'X-Company': 'company-uuid-here'
  }
});

const data = await response.json();

Response

{
  "uuid": "850e8400-e29b-41d4-a716-446655440000",
  "number": "CN-2026-005",
  "direction": "outgoing",
  "isCreditNote": true,
  "seriesId": "750e8400-e29b-41d4-a716-446655440000",
  "series": {
    "uuid": "750e8400-e29b-41d4-a716-446655440000",
    "name": "CN",
    "nextNumber": 6,
    "prefix": "CN-",
    "year": 2026
  },
  "clientId": "750e8400-e29b-41d4-a716-446655440000",
  "client": {
    "uuid": "750e8400-e29b-41d4-a716-446655440000",
    "name": "Client SRL",
    "registrationNumber": "RO12345678",
    "address": "Str. Exemplu 123, București, Sector 1",
    "city": "București",
    "county": "București",
    "country": "RO",
    "postalCode": "010101",
    "email": "[email protected]",
    "phone": "+40721234567",
    "bankAccount": "RO49AAAA1B31007593840000",
    "bankName": "Banca Comercială Română"
  },
  "parentDocumentId": "650e8400-e29b-41d4-a716-446655440111",
  "parentDocument": {
    "uuid": "650e8400-e29b-41d4-a716-446655440111",
    "number": "FAC-2026-045",
    "issueDate": "2026-02-18",
    "dueDate": "2026-03-18",
    "currency": "RON",
    "subtotal": "7000.00",
    "vatAmount": "1330.00",
    "total": "8330.00",
    "status": "validated",
    "anafUploadIndex": 2026000230
  },
  "status": "validated",
  "anafStatus": "validated",
  "anafUploadIndex": 2026000234,
  "anafCif": 2026000234,
  "issueDate": "2026-02-20",
  "dueDate": "2026-03-20",
  "currency": "RON",
  "exchangeRate": 1.0,
  "invoiceTypeCode": "381",
  "notes": "Partial refund - hosting services cancelled by client request",
  "paymentTerms": "Immediate refund",
  "issuerName": "John Doe",
  "issuerId": "850e8400-e29b-41d4-a716-446655440000",
  "mentions": "Credit note for invoice FAC-2026-045",
  "internalNote": "Client cancelled annual hosting, refund via original payment method",
  "lines": [
    {
      "uuid": "910e8400-e29b-41d4-a716-446655440000",
      "lineNumber": 1,
      "description": "Hosting Services - Annual (CREDIT)",
      "quantity": "-1.00",
      "unitPrice": "1200.00",
      "unitOfMeasure": "service",
      "productId": "460e8400-e29b-41d4-a716-446655440000",
      "product": {
        "uuid": "460e8400-e29b-41d4-a716-446655440000",
        "name": "Hosting Services",
        "code": "HOST-001",
        "unitOfMeasure": "service"
      },
      "vatRateId": "350e8400-e29b-41d4-a716-446655440000",
      "vatRate": {
        "uuid": "350e8400-e29b-41d4-a716-446655440000",
        "name": "Standard VAT",
        "percentage": "19.00"
      },
      "discount": "200.00",
      "discountPercent": "16.67",
      "vatIncluded": false,
      "subtotal": "-1000.00",
      "vatAmount": "-190.00",
      "total": "-1190.00"
    }
  ],
  "subtotal": "-1000.00",
  "totalDiscount": "200.00",
  "vatAmount": "-190.00",
  "total": "-1190.00",
  "xmlContent": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>...",
  "anafMessages": [],
  "createdAt": "2026-02-20T09:00:00Z",
  "updatedAt": "2026-02-20T10:15:00Z",
  "uploadedAt": "2026-02-20T09:30:00Z",
  "validatedAt": "2026-02-20T10:15:00Z"
}

Response Fields

Core Fields

FieldTypeDescription
uuidstringUnique identifier
numberstringCredit note number
isCreditNotebooleanAlways true for credit notes
directionstringAlways outgoing for credit notes
parentDocumentIdstringUUID of the original invoice being credited
parentDocumentobjectComplete details of the original invoice

Status Fields

FieldTypeDescription
statusstringDocument status: draft, uploaded, validated, error
anafStatusstringANAF validation status
anafUploadIndexinteger | nullANAF upload index (CIF)

Financial Fields

FieldTypeDescription
subtotalstringNegative subtotal amount
totalDiscountstringDiscount amount (positive, reduces the credit)
vatAmountstringNegative VAT amount
totalstringNegative total amount
currencystringCurrency code (must match parent invoice)
exchangeRatenumberExchange rate

Line Items

FieldTypeDescription
linesarrayArray of line items with negative amounts
quantitystringNegative quantity or positive with negative unit price
subtotalstringNegative line subtotal
vatAmountstringNegative line VAT
totalstringNegative line total

Timestamps

FieldTypeDescription
createdAtstringWhen credit note was created
uploadedAtstring | nullWhen uploaded to ANAF
validatedAtstring | nullWhen ANAF validated it
updatedAtstringLast update timestamp

Parent Document Reference

The parentDocument object contains key information from the original invoice:

  • Original invoice number
  • Original issue date
  • Original amounts (positive)
  • ANAF upload status

This allows you to:

  • Display both documents side-by-side
  • Validate the credit doesn't exceed the original
  • Track total credited amount per invoice
  • Generate reports on credits per invoice

Credit Note Amounts

Amount Sign Convention

All financial amounts in credit notes are negative:

{
  "subtotal": "-1000.00",   // Negative
  "vatAmount": "-190.00",    // Negative
  "total": "-1190.00"        // Negative
}

Line Item Amounts

Two ways to represent negative line amounts:

Option 1: Negative quantity

{
  "quantity": "-1.00",
  "unitPrice": "1200.00",
  "total": "-1190.00"
}

Option 2: Negative unit price

{
  "quantity": "1.00",
  "unitPrice": "-1200.00",
  "total": "-1190.00"
}

Both are valid; negative quantity is more common.

Invoice Type Code

Credit notes typically use:

  • 381 - Credit note (most common)
  • 383 - Corrective invoice (for corrections)

Error Codes

Status CodeError CodeDescription
401unauthorizedMissing or invalid authentication token
403forbiddenInvalid or missing X-Company header
404not_foundCredit note not found or doesn't belong to the company
500internal_errorServer error occurred

Validation Rules

Amount Validation

  • Total credit amount should not exceed original invoice amount
  • Multiple credit notes can reference the same parent invoice
  • System tracks cumulative credited amount per invoice

Date Validation

  • Credit note issueDate should be after parent invoice issueDate
  • Cannot create credit note for future-dated invoice
  • Must be within fiscal period rules

Currency Match

  • Credit note currency must match parent invoice currency
  • Exchange rate should match parent invoice (if applicable)

Use Cases

Full Credit

Credit entire original invoice:

Original Invoice: 8,330.00 RON
Credit Note:     -8,330.00 RON
Net Balance:          0.00 RON

Partial Credit

Credit specific line items:

Original Invoice: 8,330.00 RON (2 items)
Credit Note:     -1,190.00 RON (1 item)
Net Balance:      7,140.00 RON

Multiple Credits

Multiple partial credits on same invoice:

Original Invoice: 8,330.00 RON
Credit Note 1:   -1,190.00 RON
Credit Note 2:     -500.00 RON
Net Balance:      6,640.00 RON

Best Practices

  1. Always link to parent - Set parentDocumentId correctly
  2. Clear descriptions - Explain what is being credited and why
  3. Match line items - Use same product/description as original
  4. Check ANAF status - Ensure parent invoice is validated first
  5. Notify client - Send credit note with clear explanation
  6. Update accounting - Sync to accounting system promptly
  7. Track totals - Monitor total credited vs original amount