Skip to content
Hydda One API
Esc
↑↓navigate↵open⌘Jpreview

Report a credit note your platform issued

Call this when your invoicing platform issues a credit note against an invoice Hydda One sent. 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.

POST/v1/billing/invoices/{invoiceId}/report-credit-note
Authorization
AuthorizationOAuth2 access token · headerrequired

An 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>.

Path parameters
invoiceIdstring<uuid>required

The id of the invoice, from the send queue or an earlier report.

Request body
requiredapplication/json
externalReferencestringrequired

Your 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.

min length 1 · max length 200
issuedInvoiceNumberstringrequired

The legal number your platform gave the credit note, 1 to 64 characters.

min length 1 · max length 64
issuedInvoiceDatestring<date>required

The date the credit note was issued, as an ISO date (YYYY-MM-DD).

issuedTotalGrossMinorUnitsintegerrequired

The 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.

min -9007199254740991
documentUrlstring<uri>

An https link where the issued credit note can be fetched, at most 2000 characters.

max length 2000
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.

min items 1 · max items 500
Show properties
Array of object
invoiceLineIdstring<uuid>required

The id of a line of the credited invoice, from the send queue item that carried it.

amountMinorUnitsintegerrequired

The net amount credited on the line, in minor units, positive. Never more than what remains of the line after earlier credits.

max 9007199254740991
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.

min items 1 · max items 500
Show properties
Array of object
vatRateBasisPointsintegerrequired

The VAT rate in basis points, where 2500 is 25%. The credited invoice must carry a line at this rate.

min 0 · max 10000
vatTreatmentstring

Why 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.

Allowed:exemptreverseCharge
amountMinorUnitsintegerrequired

The net amount credited at this rate, in minor units, positive.

max 9007199254740991
labelstring

The text of the credit line, 1 to 200 characters. Defaults to "Credit note" and the issued number.

min length 1 · max length 200
Responses
201

The credit note and the credited invoice, after the credit applied.

creditNoteInvoicerequired

The credit note, sent with your issued facts, or paid when the credited invoice took all of it.

Show properties
idstring<uuid>required

The invoice id. Report outcomes against it.

invoiceRunIdstring<uuid>required

The invoice run that created the invoice.

organizationIdstring<uuid>required

The organization the invoice belongs to.

operationalContextIdstring<uuid>required

The operational context the invoice was created in.

contractIdstring<uuid>required

The contract the invoice bills.

recipientAgentIdstring<uuid>required

The customer the invoice bills.

recipientAgentNamestringrequired

The customer's name as written on the invoice.

billingAccountIdstring<uuid>required

The billing account the invoice is sent to.

documentKindstringrequired

Whether the document is an invoice or a credit note. A credit note names the invoice it credits.

Allowed:invoicecredit-note
creditedInvoiceIdstring<uuid>

On a credit note, the invoice it credits. Absent on an invoice.

billingStreamstringrequired

Where the charges come from: contractual for the contract's own products, running for purchases beside it, such as bookings.

Allowed:contractualrunning
requestedInvoiceDatestring<date>required

The 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.

paymentTermsDaysinteger

The payment terms in days that give the requested due date. Absent on a credit note.

min 0 · max 9007199254740991
invoiceNumberintegerrequired

Hydda One's own number for the invoice. The legal number is issuedInvoiceNumber.

max 9007199254740991
statusstringrequired

Where 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.

Allowed:createdapprovedsentpaidwritten-offfailed
currencystringrequired

An ISO 4217 currency code, for example SEK.

Allowed:SEKNOKDKKEURUSDGBP
totalNetMinorUnitsintegerrequired

The total excluding VAT, in minor units. Negative on a credit note.

min -9007199254740991 · max 9007199254740991
totalVatMinorUnitsintegerrequired

The total VAT, in minor units.

min -9007199254740991 · max 9007199254740991
totalGrossMinorUnitsintegerrequired

The total including VAT as Hydda One computed it, in minor units.

min -9007199254740991 · max 9007199254740991
externalReferencestring

Your own id for the invoice. Absent until you attach one, by passing its proposal or reporting it sent.

issuedInvoiceNumberstring

The 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.

issuedTotalGrossMinorUnitsinteger

The total including VAT your ERP issued, in minor units. Payments are measured against it. Absent until reported sent.

min -9007199254740991 · max 9007199254740991
paymentReferencestring

The reference the payer quotes, as reported with the send.

paymentReferenceTypestring

The system the payment reference belongs to: ocr for a Swedish OCR number, kid for a Norwegian KID number, reference for a free reference.

Allowed:ocrkidreference
documentUrlstring

The link to the issued document, as reported with the send.

balanceMinorUnitsinteger

What is left to pay, in minor units: the issued total less payments and write-offs. Below zero after an overpayment. Absent until reported sent.

min -9007199254740991 · max 9007199254740991
overduebooleanrequired

True 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.

failureReasonstring

Why sending failed, as it was reported.

createdAtstring<date-time>required

When the invoice was created, as an ISO 8601 timestamp in UTC.

updatedAtstring<date-time>required

When the invoice last changed, as an ISO 8601 timestamp in UTC.

invoiceInvoicerequired

The credited invoice with its new balance.

Show properties
idstring<uuid>required

The invoice id. Report outcomes against it.

invoiceRunIdstring<uuid>required

The invoice run that created the invoice.

organizationIdstring<uuid>required

The organization the invoice belongs to.

operationalContextIdstring<uuid>required

The operational context the invoice was created in.

contractIdstring<uuid>required

The contract the invoice bills.

recipientAgentIdstring<uuid>required

The customer the invoice bills.

recipientAgentNamestringrequired

The customer's name as written on the invoice.

billingAccountIdstring<uuid>required

The billing account the invoice is sent to.

documentKindstringrequired

Whether the document is an invoice or a credit note. A credit note names the invoice it credits.

Allowed:invoicecredit-note
creditedInvoiceIdstring<uuid>

On a credit note, the invoice it credits. Absent on an invoice.

billingStreamstringrequired

Where the charges come from: contractual for the contract's own products, running for purchases beside it, such as bookings.

Allowed:contractualrunning
requestedInvoiceDatestring<date>required

The 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.

paymentTermsDaysinteger

The payment terms in days that give the requested due date. Absent on a credit note.

min 0 · max 9007199254740991
invoiceNumberintegerrequired

Hydda One's own number for the invoice. The legal number is issuedInvoiceNumber.

max 9007199254740991
statusstringrequired

Where 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.

Allowed:createdapprovedsentpaidwritten-offfailed
currencystringrequired

An ISO 4217 currency code, for example SEK.

Allowed:SEKNOKDKKEURUSDGBP
totalNetMinorUnitsintegerrequired

The total excluding VAT, in minor units. Negative on a credit note.

min -9007199254740991 · max 9007199254740991
totalVatMinorUnitsintegerrequired

The total VAT, in minor units.

min -9007199254740991 · max 9007199254740991
totalGrossMinorUnitsintegerrequired

The total including VAT as Hydda One computed it, in minor units.

min -9007199254740991 · max 9007199254740991
externalReferencestring

Your own id for the invoice. Absent until you attach one, by passing its proposal or reporting it sent.

issuedInvoiceNumberstring

The 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.

issuedTotalGrossMinorUnitsinteger

The total including VAT your ERP issued, in minor units. Payments are measured against it. Absent until reported sent.

min -9007199254740991 · max 9007199254740991
paymentReferencestring

The reference the payer quotes, as reported with the send.

paymentReferenceTypestring

The system the payment reference belongs to: ocr for a Swedish OCR number, kid for a Norwegian KID number, reference for a free reference.

Allowed:ocrkidreference
documentUrlstring

The link to the issued document, as reported with the send.

balanceMinorUnitsinteger

What is left to pay, in minor units: the issued total less payments and write-offs. Below zero after an overpayment. Absent until reported sent.

min -9007199254740991 · max 9007199254740991
overduebooleanrequired

True 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.

failureReasonstring

Why sending failed, as it was reported.

createdAtstring<date-time>required

When the invoice was created, as an ISO 8601 timestamp in UTC.

updatedAtstring<date-time>required

When the invoice last changed, as an ISO 8601 timestamp in UTC.

appliedMinorUnitsintegerrequired

How 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.

min 0 · max 9007199254740991
400

The request is not valid, or a business rule refused it. code names the rule.

typestringrequired

Always about:blank.

titlestringrequired

The HTTP status phrase, for example Not Found.

statusintegerrequired

The HTTP status code.

min -9007199254740991 · max 9007199254740991
detailstring

What went wrong, for a person to read. Do not parse it.

codestring

Names the rule that refused the request, when the failure has one. Match on this, not on detail.

Allowed:VALIDATION_FAILEDBILLING_INTEGRATION_NOT_CONFIGUREDBILLING_CREDIT_NOTE_INVOICE_NOT_CREDITABLEBILLING_CREDIT_EXCEEDS_LINEBILLING_CREDIT_EXCEEDS_INVOICEBILLING_CREDIT_WITHHELDBILLING_MANUAL_CREDIT_VAT_RATE_UNKNOWN
parametersobject

Values 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.

401

The access token is missing, expired or not valid.

typestringrequired

Always about:blank.

titlestringrequired

The HTTP status phrase, for example Not Found.

statusintegerrequired

The HTTP status code.

min -9007199254740991 · max 9007199254740991
detailstring

What went wrong, for a person to read. Do not parse it.

codestring

Names the rule that refused the request. Match on this, not on detail.

parametersobject

Values 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.

403

The token does not allow this request.

typestringrequired

Always about:blank.

titlestringrequired

The HTTP status phrase, for example Not Found.

statusintegerrequired

The HTTP status code.

min -9007199254740991 · max 9007199254740991
detailstring

What went wrong, for a person to read. Do not parse it.

codestring

Names the rule that refused the request. Match on this, not on detail.

parametersobject

Values 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.

404

The resource does not exist, or the token cannot see it.

typestringrequired

Always about:blank.

titlestringrequired

The HTTP status phrase, for example Not Found.

statusintegerrequired

The HTTP status code.

min -9007199254740991 · max 9007199254740991
detailstring

What went wrong, for a person to read. Do not parse it.

codestring

Names the rule that refused the request. Match on this, not on detail.

parametersobject

Values 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.

409

The request conflicts with the current state of the resource.

typestringrequired

Always about:blank.

titlestringrequired

The HTTP status phrase, for example Not Found.

statusintegerrequired

The HTTP status code.

min -9007199254740991 · max 9007199254740991
detailstring

What went wrong, for a person to read. Do not parse it.

codestring

Names the rule that refused the request, when the failure has one. Match on this, not on detail.

Allowed:BILLING_CREDIT_NOTE_REPLAY_MISMATCHBILLING_EXTERNAL_REFERENCE_ALREADY_USED
parametersobject

Values 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.

Request
curl -X POST 'https://api.hydda.one/v1/billing/invoices/497f6eca-6276-4993-bfeb-53cbbbba6f08/report-credit-note' \
  -H 'Authorization: Bearer YOUR_ACCESS_TOKEN' \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{
  "externalReference": "string",
  "issuedInvoiceNumber": "string",
  "issuedInvoiceDate": "2019-08-24",
  "issuedTotalGrossMinorUnits": -9007199254740991,
  "documentUrl": "http://example.com",
  "lines": [
    {
      "invoiceLineId": "01b48345-8495-4ed8-81ba-4399df639395",
      "amountMinorUnits": 1
    }
  ],
  "vatRates": [
    {
      "vatRateBasisPoints": 0,
      "vatTreatment": "exempt",
      "amountMinorUnits": 1,
      "label": "string"
    }
  ]
}'
Response
{
  "creditNote": {
    "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
    "invoiceRunId": "d023feec-6ce3-4d83-8326-53006f2d50e7",
    "organizationId": "7bc05553-4b68-44e8-b7bc-37be63c6d9e9",
    "operationalContextId": "a3f64ce2-1602-4028-b89f-abb2bb8c71bc",
    "contractId": "dbf32426-cf38-4818-9c6e-3230d889fa51",
    "recipientAgentId": "9857c18a-555f-4729-b9ab-629537b29cdc",
    "recipientAgentName": "string",
    "billingAccountId": "56a302e4-9416-417d-adcf-22ac99649ba3",
    "documentKind": "invoice",
    "creditedInvoiceId": "74ebea99-ce39-4315-8d5b-103e18e641e4",
    "billingStream": "contractual",
    "requestedInvoiceDate": "2019-08-24",
    "requestedDueDate": "2019-08-24",
    "paymentTermsDays": 0,
    "invoiceNumber": 1,
    "status": "created",
    "currency": "SEK",
    "totalNetMinorUnits": -9007199254740991,
    "totalVatMinorUnits": -9007199254740991,
    "totalGrossMinorUnits": -9007199254740991,
    "externalReference": "string",
    "issuedInvoiceNumber": "string",
    "issuedInvoiceDate": "2019-08-24",
    "dueDate": "2019-08-24",
    "issuedTotalGrossMinorUnits": -9007199254740991,
    "paymentReference": "string",
    "paymentReferenceType": "ocr",
    "documentUrl": "string",
    "balanceMinorUnits": -9007199254740991,
    "overdue": true,
    "approvedAt": "2019-08-24T14:15:22Z",
    "sentAt": "2019-08-24T14:15:22Z",
    "paidAt": "2019-08-24T14:15:22Z",
    "writtenOffAt": "2019-08-24T14:15:22Z",
    "failedAt": "2019-08-24T14:15:22Z",
    "failureReason": "string",
    "createdAt": "2019-08-24T14:15:22Z",
    "updatedAt": "2019-08-24T14:15:22Z"
  },
  "invoice": {
    "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
    "invoiceRunId": "d023feec-6ce3-4d83-8326-53006f2d50e7",
    "organizationId": "7bc05553-4b68-44e8-b7bc-37be63c6d9e9",
    "operationalContextId": "a3f64ce2-1602-4028-b89f-abb2bb8c71bc",
    "contractId": "dbf32426-cf38-4818-9c6e-3230d889fa51",
    "recipientAgentId": "9857c18a-555f-4729-b9ab-629537b29cdc",
    "recipientAgentName": "string",
    "billingAccountId": "56a302e4-9416-417d-adcf-22ac99649ba3",
    "documentKind": "invoice",
    "creditedInvoiceId": "74ebea99-ce39-4315-8d5b-103e18e641e4",
    "billingStream": "contractual",
    "requestedInvoiceDate": "2019-08-24",
    "requestedDueDate": "2019-08-24",
    "paymentTermsDays": 0,
    "invoiceNumber": 1,
    "status": "created",
    "currency": "SEK",
    "totalNetMinorUnits": -9007199254740991,
    "totalVatMinorUnits": -9007199254740991,
    "totalGrossMinorUnits": -9007199254740991,
    "externalReference": "string",
    "issuedInvoiceNumber": "string",
    "issuedInvoiceDate": "2019-08-24",
    "dueDate": "2019-08-24",
    "issuedTotalGrossMinorUnits": -9007199254740991,
    "paymentReference": "string",
    "paymentReferenceType": "ocr",
    "documentUrl": "string",
    "balanceMinorUnits": -9007199254740991,
    "overdue": true,
    "approvedAt": "2019-08-24T14:15:22Z",
    "sentAt": "2019-08-24T14:15:22Z",
    "paidAt": "2019-08-24T14:15:22Z",
    "writtenOffAt": "2019-08-24T14:15:22Z",
    "failedAt": "2019-08-24T14:15:22Z",
    "failureReason": "string",
    "createdAt": "2019-08-24T14:15:22Z",
    "updatedAt": "2019-08-24T14:15:22Z"
  },
  "appliedMinorUnits": 0
}