---
search:
  tags:
    - Billing
    - POST
seo:
  description: >-
    The same as reporting… Reference for the POST
    /v1/billing/invoices/by-external-reference/{externalReference}/report-credit-note
    endpoint in the Hydda One API.
sidebar:
  label: Report a credit note by your own invoice id
  badge: POST
title: Report a credit note by your own invoice id
type: openapi-operation
---
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.

`POST /v1/billing/invoices/by-external-reference/{externalReference}/report-credit-note`

**Request body** (`application/json`, required)

- `externalReference` (string, required) — 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.
- `issuedInvoiceNumber` (string, required) — The legal number your platform gave the credit note, 1 to 64 characters.
- `issuedInvoiceDate` (string<date>, required) — The date the credit note was issued, as an ISO date (YYYY-MM-DD).
- `issuedTotalGrossMinorUnits` (integer, required) — 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.
- `documentUrl` (string<uri>) — An https link where the issued credit note can be fetched, at most 2000 characters.
- `lines` (object[]) — 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.
- `vatRates` (object[]) — 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.

Request body example:

```json
{
  "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"
    }
  ]
}
```

**Responses**

- `201` — The credit note and the credited invoice, after the credit applied.
- `400` — The request is not valid, or a business rule refused it. \`code\` names the rule.
- `401` — The access token is missing, expired or not valid.
- `403` — The token does not allow this request.
- `404` — The resource does not exist, or the token cannot see it.
- `409` — The request conflicts with the current state of the resource.

Response example, 201:

```json
{
  "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
}
```
