Report a credit note by your own invoice id
The same as reporting a credit note, but the credited invoice is named by the external reference you attached to it. The body’s externalReference is your id for the credit note itself. A 404 means no invoice in the organization carries the reference in the path. Name what was credited in one of two shapes: lines, the credited invoice’s lines with the net amount credited on each, or vatRates, the net amount credited per VAT rate the invoice carries. The credit note is already issued, so it never reaches the send queue: it is recorded sent with your issued facts, and in the same call it is applied to the credited invoice up to that invoice’s open balance. The invoice’s balance drops by the applied amount, and an invoice it brings to zero is paid. Whatever the invoice could not take stays open on the credit note; settle it with a refund, a negative payment on the credit note. Reporting the same credit note again under the same externalReference changes nothing and answers it as it is. A 409 means the reference was reported with another invoice or other contents, or another document already holds it. A credit past what remains of a line or of the invoice’s net is refused with 400, as is an invoice that was never sent. To report many credit notes in one request, use POST /v1/billing/batch/report-credit-notes, where an item can name its invoice the same way.
/v1/billing/invoices/by-external-reference/{externalReference}/report-credit-noteAuthorizationOAuth2 access token · headerrequiredAn access token for an Application, from the client_credentials grant. An integration of your own uses the same grant. A connector from Hydda gets its token from the installation-token grant instead. Send it as Authorization: Bearer <token>.
externalReferencestringrequiredYour own id for the invoice in your system, 1 to 200 characters and unique in the organization. Payments can be reported by it in place of Hydda One's id.
application/jsonexternalReferencestringrequiredYour own id for the credit note, 1 to 200 characters and unique in the organization. Reporting the same credit note again under it changes nothing.
issuedInvoiceNumberstringrequiredThe legal number your platform gave the credit note, 1 to 64 characters.
issuedInvoiceDatestring<date>requiredThe date the credit note was issued, as an ISO date (YYYY-MM-DD).
issuedTotalGrossMinorUnitsintegerrequiredThe total including VAT that your platform issued, in minor units. Negative, like every credit note. It may differ from what Hydda One computes by rounding.
documentUrlstring<uri>An https link where the issued credit note can be fetched, at most 2000 characters.
linesobject[]The credited invoice's lines and the net amount credited on each, 1 to 500. A line appears at most once. Send this or vatRates, never both.
Show propertiesHide properties
objectinvoiceLineIdstring<uuid>requiredThe id of a line of the credited invoice, from the send queue item that carried it.
amountMinorUnitsintegerrequiredThe net amount credited on the line, in minor units, positive. Never more than what remains of the line after earlier credits.
vatRatesobject[]The net amount credited per VAT rate, when your platform does not credit named lines. A rate and treatment appear at most once. Send this or lines, never both.
Show propertiesHide properties
objectvatRateBasisPointsintegerrequiredThe VAT rate in basis points, where 2500 is 25%. The credited invoice must carry a line at this rate.
vatTreatmentstringWhy the rate is 0. Required at a zero rate and refused above it, and the credited invoice must carry a line with the same treatment.
exemptreverseChargeamountMinorUnitsintegerrequiredThe net amount credited at this rate, in minor units, positive.
labelstringThe text of the credit line, 1 to 200 characters. Defaults to "Credit note" and the issued number.
The credit note and the credited invoice, after the credit applied.
creditNoteInvoicerequiredThe credit note, sent with your issued facts, or paid when the credited invoice took all of it.
Show propertiesHide properties
idstring<uuid>requiredThe invoice id. Report outcomes against it.
invoiceRunIdstring<uuid>requiredThe invoice run that created the invoice.
organizationIdstring<uuid>requiredThe organization the invoice belongs to.
operationalContextIdstring<uuid>requiredThe operational context the invoice was created in.
contractIdstring<uuid>requiredThe contract the invoice bills.
recipientAgentIdstring<uuid>requiredThe customer the invoice bills.
recipientAgentNamestringrequiredThe customer's name as written on the invoice.
billingAccountIdstring<uuid>requiredThe billing account the invoice is sent to.
documentKindstringrequiredWhether the document is an invoice or a credit note. A credit note names the invoice it credits.
invoicecredit-notecreditedInvoiceIdstring<uuid>On a credit note, the invoice it credits. Absent on an invoice.
billingStreamstringrequiredWhere the charges come from: contractual for the contract's own products, running for purchases beside it, such as bookings.
contractualrunningrequestedInvoiceDatestring<date>requiredThe invoice date to issue with, as an ISO date (YYYY-MM-DD).
requestedDueDatestring<date>The due date to issue with, as an ISO date. Absent on a credit note.
paymentTermsDaysintegerThe payment terms in days that give the requested due date. Absent on a credit note.
invoiceNumberintegerrequiredHydda One's own number for the invoice. The legal number is issuedInvoiceNumber.
statusstringrequiredWhere the invoice is in its life. failed is reached only by a failure report, and written-off is settled like paid with at least one write-off.
createdapprovedsentpaidwritten-offfailedcurrencystringrequiredAn ISO 4217 currency code, for example SEK.
SEKNOKDKKEURUSDGBPtotalNetMinorUnitsintegerrequiredThe total excluding VAT, in minor units. Negative on a credit note.
totalVatMinorUnitsintegerrequiredThe total VAT, in minor units.
totalGrossMinorUnitsintegerrequiredThe total including VAT as Hydda One computed it, in minor units.
externalReferencestringYour own id for the invoice. Absent until you attach one, by passing its proposal or reporting it sent.
issuedInvoiceNumberstringThe legal invoice number your ERP issued. Absent until the invoice is reported sent.
issuedInvoiceDatestring<date>The date your ERP issued the invoice, as an ISO date. Absent until reported sent.
dueDatestring<date>The due date the invoice was issued with, as an ISO date. Absent until reported sent.
issuedTotalGrossMinorUnitsintegerThe total including VAT your ERP issued, in minor units. Payments are measured against it. Absent until reported sent.
paymentReferencestringThe reference the payer quotes, as reported with the send.
paymentReferenceTypestringThe system the payment reference belongs to: ocr for a Swedish OCR number, kid for a Norwegian KID number, reference for a free reference.
ocrkidreferencedocumentUrlstringThe link to the issued document, as reported with the send.
balanceMinorUnitsintegerWhat is left to pay, in minor units: the issued total less payments and write-offs. Below zero after an overpayment. Absent until reported sent.
overduebooleanrequiredTrue when the invoice is sent and its due date has passed.
approvedAtstring<date-time>When the invoice was approved, as an ISO 8601 timestamp in UTC.
sentAtstring<date-time>When the invoice was reported sent, as an ISO 8601 timestamp in UTC.
paidAtstring<date-time>When the invoice was settled as paid, as an ISO 8601 timestamp in UTC.
writtenOffAtstring<date-time>When the invoice was settled as written off, as an ISO 8601 timestamp in UTC.
failedAtstring<date-time>When the invoice was reported failed, as an ISO 8601 timestamp in UTC.
failureReasonstringWhy sending failed, as it was reported.
createdAtstring<date-time>requiredWhen the invoice was created, as an ISO 8601 timestamp in UTC.
updatedAtstring<date-time>requiredWhen the invoice last changed, as an ISO 8601 timestamp in UTC.
invoiceInvoicerequiredThe credited invoice with its new balance.
Show propertiesHide properties
idstring<uuid>requiredThe invoice id. Report outcomes against it.
invoiceRunIdstring<uuid>requiredThe invoice run that created the invoice.
organizationIdstring<uuid>requiredThe organization the invoice belongs to.
operationalContextIdstring<uuid>requiredThe operational context the invoice was created in.
contractIdstring<uuid>requiredThe contract the invoice bills.
recipientAgentIdstring<uuid>requiredThe customer the invoice bills.
recipientAgentNamestringrequiredThe customer's name as written on the invoice.
billingAccountIdstring<uuid>requiredThe billing account the invoice is sent to.
documentKindstringrequiredWhether the document is an invoice or a credit note. A credit note names the invoice it credits.
invoicecredit-notecreditedInvoiceIdstring<uuid>On a credit note, the invoice it credits. Absent on an invoice.
billingStreamstringrequiredWhere the charges come from: contractual for the contract's own products, running for purchases beside it, such as bookings.
contractualrunningrequestedInvoiceDatestring<date>requiredThe invoice date to issue with, as an ISO date (YYYY-MM-DD).
requestedDueDatestring<date>The due date to issue with, as an ISO date. Absent on a credit note.
paymentTermsDaysintegerThe payment terms in days that give the requested due date. Absent on a credit note.
invoiceNumberintegerrequiredHydda One's own number for the invoice. The legal number is issuedInvoiceNumber.
statusstringrequiredWhere the invoice is in its life. failed is reached only by a failure report, and written-off is settled like paid with at least one write-off.
createdapprovedsentpaidwritten-offfailedcurrencystringrequiredAn ISO 4217 currency code, for example SEK.
SEKNOKDKKEURUSDGBPtotalNetMinorUnitsintegerrequiredThe total excluding VAT, in minor units. Negative on a credit note.
totalVatMinorUnitsintegerrequiredThe total VAT, in minor units.
totalGrossMinorUnitsintegerrequiredThe total including VAT as Hydda One computed it, in minor units.
externalReferencestringYour own id for the invoice. Absent until you attach one, by passing its proposal or reporting it sent.
issuedInvoiceNumberstringThe legal invoice number your ERP issued. Absent until the invoice is reported sent.
issuedInvoiceDatestring<date>The date your ERP issued the invoice, as an ISO date. Absent until reported sent.
dueDatestring<date>The due date the invoice was issued with, as an ISO date. Absent until reported sent.
issuedTotalGrossMinorUnitsintegerThe total including VAT your ERP issued, in minor units. Payments are measured against it. Absent until reported sent.
paymentReferencestringThe reference the payer quotes, as reported with the send.
paymentReferenceTypestringThe system the payment reference belongs to: ocr for a Swedish OCR number, kid for a Norwegian KID number, reference for a free reference.
ocrkidreferencedocumentUrlstringThe link to the issued document, as reported with the send.
balanceMinorUnitsintegerWhat is left to pay, in minor units: the issued total less payments and write-offs. Below zero after an overpayment. Absent until reported sent.
overduebooleanrequiredTrue when the invoice is sent and its due date has passed.
approvedAtstring<date-time>When the invoice was approved, as an ISO 8601 timestamp in UTC.
sentAtstring<date-time>When the invoice was reported sent, as an ISO 8601 timestamp in UTC.
paidAtstring<date-time>When the invoice was settled as paid, as an ISO 8601 timestamp in UTC.
writtenOffAtstring<date-time>When the invoice was settled as written off, as an ISO 8601 timestamp in UTC.
failedAtstring<date-time>When the invoice was reported failed, as an ISO 8601 timestamp in UTC.
failureReasonstringWhy sending failed, as it was reported.
createdAtstring<date-time>requiredWhen the invoice was created, as an ISO 8601 timestamp in UTC.
updatedAtstring<date-time>requiredWhen the invoice last changed, as an ISO 8601 timestamp in UTC.
appliedMinorUnitsintegerrequiredHow much of the credit was applied to the credited invoice's open balance, in minor units. What is left open on the credit note is settled by a refund: a negative payment on the credit note.
The request is not valid, or a business rule refused it. code names the rule.
typestringrequiredAlways about:blank.
titlestringrequiredThe HTTP status phrase, for example Not Found.
statusintegerrequiredThe HTTP status code.
detailstringWhat went wrong, for a person to read. Do not parse it.
codestringNames the rule that refused the request, when the failure has one. Match on this, not on detail.
VALIDATION_FAILEDBILLING_INTEGRATION_NOT_CONFIGUREDBILLING_CREDIT_NOTE_INVOICE_NOT_CREDITABLEBILLING_CREDIT_EXCEEDS_LINEBILLING_CREDIT_EXCEEDS_INVOICEBILLING_CREDIT_WITHHELDBILLING_MANUAL_CREDIT_VAT_RATE_UNKNOWNparametersobjectValues the refusal names, keyed by what they are, for example occurrenceDate with BOOKING_SERIES_CONFLICT.
issuesobject[]With VALIDATION_FAILED: one entry per field that failed validation, each with its path and message.
The access token is missing, expired or not valid.
typestringrequiredAlways about:blank.
titlestringrequiredThe HTTP status phrase, for example Not Found.
statusintegerrequiredThe HTTP status code.
detailstringWhat went wrong, for a person to read. Do not parse it.
codestringNames the rule that refused the request. Match on this, not on detail.
parametersobjectValues the refusal names, keyed by what they are, for example occurrenceDate with BOOKING_SERIES_CONFLICT.
issuesobject[]With VALIDATION_FAILED: one entry per field that failed validation, each with its path and message.
The token does not allow this request.
typestringrequiredAlways about:blank.
titlestringrequiredThe HTTP status phrase, for example Not Found.
statusintegerrequiredThe HTTP status code.
detailstringWhat went wrong, for a person to read. Do not parse it.
codestringNames the rule that refused the request. Match on this, not on detail.
parametersobjectValues the refusal names, keyed by what they are, for example occurrenceDate with BOOKING_SERIES_CONFLICT.
issuesobject[]With VALIDATION_FAILED: one entry per field that failed validation, each with its path and message.
The resource does not exist, or the token cannot see it.
typestringrequiredAlways about:blank.
titlestringrequiredThe HTTP status phrase, for example Not Found.
statusintegerrequiredThe HTTP status code.
detailstringWhat went wrong, for a person to read. Do not parse it.
codestringNames the rule that refused the request. Match on this, not on detail.
parametersobjectValues the refusal names, keyed by what they are, for example occurrenceDate with BOOKING_SERIES_CONFLICT.
issuesobject[]With VALIDATION_FAILED: one entry per field that failed validation, each with its path and message.
The request conflicts with the current state of the resource.
typestringrequiredAlways about:blank.
titlestringrequiredThe HTTP status phrase, for example Not Found.
statusintegerrequiredThe HTTP status code.
detailstringWhat went wrong, for a person to read. Do not parse it.
codestringNames the rule that refused the request, when the failure has one. Match on this, not on detail.
BILLING_CREDIT_NOTE_REPLAY_MISMATCHBILLING_EXTERNAL_REFERENCE_ALREADY_USEDparametersobjectValues the refusal names, keyed by what they are, for example occurrenceDate with BOOKING_SERIES_CONFLICT.
issuesobject[]With VALIDATION_FAILED: one entry per field that failed validation, each with its path and message.