Cancel an invoice
POST /api/v2/billing/invoices/{id}/actions/cancel
Cancel an unpaid invoice so it no longer needs to be paid. Check actions.canCancel on GET /api/v2/billing/invoices/{id} first. You can cancel account top-up invoices and invoices for add-ons or plan changes. A domain renewal invoice can be cancelled once its order is cancelled. When actions.canCancel.code is cancel_related_order_first, cancel the order with POST /api/v2/orders/{id}/actions/cancel instead. Cancelling the invoice for an add-on or a plan change also cancels that purchase or change. An address held for an IP address change is released. The response is the updated invoice with status: cancelled.
Authentication: An API key with the scope write:billing. About keys and scopes
Request
Path parameters
idstringrequiredGET /api/v2/billing/invoices (inv_…).Example
curl -X POST "https://cloud.hostup.se/api/v2/billing/invoices/inv_01hxa3b4c5d6e7f8g9h0j1k2m3/actions/cancel" \ -H "Authorization: Bearer $HOSTUP_API_KEY" \ -H "Content-Type: application/json"Responses
200 The cancelled invoice.
{ "id": "inv_01hxa3b4c5d6e7f8g9h0j1k2m3", "number": "202600001", "status": "cancelled", "dates": { "issuedAt": "2026-04-27T12:00:00.000Z", "dueAt": "2026-05-11T23:59:59.000Z" }, "totals": { "currencyCode": "SEK", "subtotal": 10, "taxAmount": 0, "creditApplied": 0, "total": 10, "amountPaid": 0, "amountRefunded": 0, "outstanding": 0 }, "lineItemCount": 1, "lineItems": [ { "kind": "credit", "purpose": "account_credit_top_up", "description": "Add account credit", "quantity": 1, "unitAmount": 10, "totalAmount": 10, "currencyCode": "SEK" } ], "actions": { "canPay": { "allowed": false, "reason": "Invoice is cancelled." }, "canGeneratePaymentLink": { "allowed": false, "reason": "Invoice is cancelled." }, "canBulkPay": { "allowed": false, "reason": "Invoice is cancelled." }, "canCancel": { "allowed": false, "reason": "Only unpaid invoices can be cancelled.", "code": "invoice_not_unpaid" }, "canEmail": { "allowed": false, "reason": "Cancelled invoices cannot be emailed." }, "canDownload": { "allowed": true, "reason": null }, "canReissueInCurrency": { "allowed": false, "reason": "Swedish billing accounts pay SEK invoices by bankgiro, Swish or card.", "code": "account_country_not_eligible" } }, "paymentMethods": { "card": { "method": "card", "label": "Card", "available": false, "reason": "Invoice is cancelled.", "checkoutMode": "payment", "requirements": { "minimumAmount": { "amount": 3, "currencyCode": "SEK", "comparison": "greater_than" } } }, "accountCredit": { "method": "accountCredit", "label": "Account credit", "available": false, "reason": "Invoice is cancelled.", "checkoutMode": null, "requirements": { "invoiceCurrencyCode": "SEK", "accountCurrencyCode": "SEK", "availableBalance": { "amount": 0, "currencyCode": "SEK" }, "maximumAmount": { "amount": 0, "currencyCode": "SEK", "comparison": "less_than_or_equal" } } }, "swish": { "method": "swish", "label": "Swish", "available": false, "reason": "Invoice is cancelled.", "checkoutMode": null, "requirements": { "invoiceCurrencyCode": "SEK", "accountCountryCode": "SE" } }, "bankgiro": { "method": "bankgiro", "label": "Bankgiro", "available": false, "reason": "Invoice is cancelled.", "checkoutMode": null, "requirements": { "invoiceCurrencyCode": "SEK", "accountCountryCode": "SE" } }, "sepa": { "method": "sepa", "label": "SEPA bank transfer", "available": false, "reason": "Invoice is cancelled.", "checkoutMode": "sepa_bank_transfer_payment", "requirements": { "invoiceCurrencyCode": "EUR" } }, "alipay": { "method": "alipay", "label": "Alipay", "available": false, "reason": "Invoice is cancelled.", "checkoutMode": "alipay_payment", "requirements": { "invoiceCurrencyCodes": [ "EUR", "USD" ] } }, "crypto": { "method": "crypto", "label": "Cryptocurrency", "available": false, "reason": "Cryptocurrency payments are not available for Swedish billing accounts.", "checkoutMode": null, "requirements": { "invoiceCurrencyCodes": [ "SEK", "EUR", "USD" ], "accountCountryExcludedCode": "SE", "accountType": "private", "requiresCardVerification": true }, "visible": false } }, "paymentLinkGeneratorUrl": null, "isBulkPaymentChild": false, "bulkPaymentParentId": null}Response fields
idstringorderIdstringord_…) when the invoice belongs to an order. A domain renewal invoice whose order is still open is cancelled by cancelling that order first.numberstringstatusstringdraft, unpaid, partially_paid, paid, cancelled, refunded.datesobjectissuedAtstringdueAtstringpaidAtstringtotalsobjectcurrencyCodestringsubtotalnumbertaxAmountnumbertaxRateDecimalnumbercreditAppliednumbertotalnumberamountPaidnumberamountRefundednumberoutstandingnumberlineItemCountintegerlineItemsarray of objectkindstringvps, shared_hosting, domain, addon, credit, setup, other.purposestringrenewal, registration, transfer, account_credit_top_up, credit, setup.resourceobjecttypestringvps, shared_hosting, domain.idstring or nulldisplayNamestring or nullproductNamestringconfigurableOptionsarray of objectkey is the label in lower case with the bracket part dropped and other characters turned into _.keystringlabelstringvaluestringdescriptionstringdisplayDescriptionstringdisplaySecondaryLinesarray of stringdisplayDescription, such as the period.monthlyHintstringdetailsHintstringquantitynumberunitAmountnumbertotalAmountnumbercurrencyCodestringperiodobjectstartAtstringendAtstringoverpaymentCreditobjectdecisionstringcard_bankgiro_overpayment_already_credited.currencyCodestringSEK.invoiceAmountnumberexcessAmountnumbercreditedAtstringcurrentCreditBalancenumberpaymentsarray of objectkindstring or nullpayment: a payment of the invoice. account_credit_added: an overpayment added to account credit, not counted as a payment. refund: money returned (see refundedTo). rounding: a remainder under 1 SEK that Hostup wrote off so the invoice counts as paid. It is not money the customer paid. It is never a refund or a credit movement. One of payment, account_credit_added, refund, rounding.methodstring or nullmethodLabel for the text to show. One of card, accountCredit, swish, bankgiro, sepa, alipay, crypto, paypal, invoice, rounding, other.methodLabelstring or nullamountnumbercurrencyCodestringamount.refundedbooleanrefund row says where the money went.refundedTostringaccountCredit: the money is on the account balance and pays the next invoice automatically. paymentMethod: returned to the payment method. unknown: not recorded. One of accountCredit, paymentMethod, unknown.atstringnotestringactionsobjectcanPayobjectallowedbooleanreasonstring or nullcodestring or nullcanGeneratePaymentLinkobjectallowedbooleanreasonstring or nullcodestring or nullcanBulkPayobjectallowedbooleanreasonstring or nullcodestring or nullcanCancelobjectallowedbooleanreasonstring or nullcodestring or nullcanEmailobjectallowedbooleanreasonstring or nullcodestring or nullcanDownloadobjectallowedbooleanreasonstring or nullcodestring or nullcanReissueInCurrencyobjectPOST /api/v2/billing/invoices/{id}/actions/reissue-in-currency. When it is blocked, branch on code: invoice_order_backed (a pending order or plan change backs the invoice: cancel that order, change currency, then order again), invoice_domain_renewal (cancel the renewal order, then renew again), invoice_partially_settled, invoice_multiple_services, invoice_usage_not_reissuable and renewal_period_ended (contact support), account_country_not_eligible (Swedish accounts pay by bankgiro, Swish or card).allowedbooleanreasonstring or nullcodestring or nullpaymentMethodsobjectcard, accountCredit, swish, bankgiro, sepa, alipay and crypto. Check them before you start a payment.cardobjectmethodstringpaymentMethods. Card checkout and wallets are all card. One of card, accountCredit, swish, bankgiro, sepa, alipay, crypto.labelstringavailablebooleanvisiblebooleanreasonstring or nullavailable is false.checkoutModestring or nullpayment, sepa_bank_transfer_payment, alipay_payment.requirementsobjectinvoiceCurrencyCodestringinvoiceCurrencyCodesarray of stringaccountCountryCodestringaccountCountryExcludedCodestringaccountTypestringprivate, organisation.accountCurrencyCodestringrequiresCardVerificationbooleanavailableBalanceobjectamountnumbercurrencyCodestringminimumAmountobjectamountnumbercurrencyCodestringcomparisonstringamount. greater_than: more than it, used in minimumAmount. less_than_or_equal: at most it, used in maximumAmount. One of greater_than, less_than_or_equal.maximumAmountobjectamountnumbercurrencyCodestringcomparisonstringamount. greater_than: more than it, used in minimumAmount. less_than_or_equal: at most it, used in maximumAmount. One of greater_than, less_than_or_equal.accountCreditobjectmethodstringpaymentMethods. Card checkout and wallets are all card. One of card, accountCredit, swish, bankgiro, sepa, alipay, crypto.labelstringavailablebooleanvisiblebooleanreasonstring or nullavailable is false.checkoutModestring or nullpayment, sepa_bank_transfer_payment, alipay_payment.requirementsobjectinvoiceCurrencyCodestringinvoiceCurrencyCodesarray of stringaccountCountryCodestringaccountCountryExcludedCodestringaccountTypestringprivate, organisation.accountCurrencyCodestringrequiresCardVerificationbooleanavailableBalanceobjectamountnumbercurrencyCodestringminimumAmountobjectamountnumbercurrencyCodestringcomparisonstringamount. greater_than: more than it, used in minimumAmount. less_than_or_equal: at most it, used in maximumAmount. One of greater_than, less_than_or_equal.maximumAmountobjectamountnumbercurrencyCodestringcomparisonstringamount. greater_than: more than it, used in minimumAmount. less_than_or_equal: at most it, used in maximumAmount. One of greater_than, less_than_or_equal.swishobjectmethodstringpaymentMethods. Card checkout and wallets are all card. One of card, accountCredit, swish, bankgiro, sepa, alipay, crypto.labelstringavailablebooleanvisiblebooleanreasonstring or nullavailable is false.checkoutModestring or nullpayment, sepa_bank_transfer_payment, alipay_payment.requirementsobjectinvoiceCurrencyCodestringinvoiceCurrencyCodesarray of stringaccountCountryCodestringaccountCountryExcludedCodestringaccountTypestringprivate, organisation.accountCurrencyCodestringrequiresCardVerificationbooleanavailableBalanceobjectamountnumbercurrencyCodestringminimumAmountobjectamountnumbercurrencyCodestringcomparisonstringamount. greater_than: more than it, used in minimumAmount. less_than_or_equal: at most it, used in maximumAmount. One of greater_than, less_than_or_equal.maximumAmountobjectamountnumbercurrencyCodestringcomparisonstringamount. greater_than: more than it, used in minimumAmount. less_than_or_equal: at most it, used in maximumAmount. One of greater_than, less_than_or_equal.bankgiroobjectmethodstringpaymentMethods. Card checkout and wallets are all card. One of card, accountCredit, swish, bankgiro, sepa, alipay, crypto.labelstringavailablebooleanvisiblebooleanreasonstring or nullavailable is false.checkoutModestring or nullpayment, sepa_bank_transfer_payment, alipay_payment.requirementsobjectinvoiceCurrencyCodestringinvoiceCurrencyCodesarray of stringaccountCountryCodestringaccountCountryExcludedCodestringaccountTypestringprivate, organisation.accountCurrencyCodestringrequiresCardVerificationbooleanavailableBalanceobjectamountnumbercurrencyCodestringminimumAmountobjectamountnumbercurrencyCodestringcomparisonstringamount. greater_than: more than it, used in minimumAmount. less_than_or_equal: at most it, used in maximumAmount. One of greater_than, less_than_or_equal.maximumAmountobjectamountnumbercurrencyCodestringcomparisonstringamount. greater_than: more than it, used in minimumAmount. less_than_or_equal: at most it, used in maximumAmount. One of greater_than, less_than_or_equal.sepaobjectmethodstringpaymentMethods. Card checkout and wallets are all card. One of card, accountCredit, swish, bankgiro, sepa, alipay, crypto.labelstringavailablebooleanvisiblebooleanreasonstring or nullavailable is false.checkoutModestring or nullpayment, sepa_bank_transfer_payment, alipay_payment.requirementsobjectinvoiceCurrencyCodestringinvoiceCurrencyCodesarray of stringaccountCountryCodestringaccountCountryExcludedCodestringaccountTypestringprivate, organisation.accountCurrencyCodestringrequiresCardVerificationbooleanavailableBalanceobjectamountnumbercurrencyCodestringminimumAmountobjectamountnumbercurrencyCodestringcomparisonstringamount. greater_than: more than it, used in minimumAmount. less_than_or_equal: at most it, used in maximumAmount. One of greater_than, less_than_or_equal.maximumAmountobjectamountnumbercurrencyCodestringcomparisonstringamount. greater_than: more than it, used in minimumAmount. less_than_or_equal: at most it, used in maximumAmount. One of greater_than, less_than_or_equal.alipayobjectmethodstringpaymentMethods. Card checkout and wallets are all card. One of card, accountCredit, swish, bankgiro, sepa, alipay, crypto.labelstringavailablebooleanvisiblebooleanreasonstring or nullavailable is false.checkoutModestring or nullpayment, sepa_bank_transfer_payment, alipay_payment.requirementsobjectinvoiceCurrencyCodestringinvoiceCurrencyCodesarray of stringaccountCountryCodestringaccountCountryExcludedCodestringaccountTypestringprivate, organisation.accountCurrencyCodestringrequiresCardVerificationbooleanavailableBalanceobjectamountnumbercurrencyCodestringminimumAmountobjectamountnumbercurrencyCodestringcomparisonstringamount. greater_than: more than it, used in minimumAmount. less_than_or_equal: at most it, used in maximumAmount. One of greater_than, less_than_or_equal.maximumAmountobjectamountnumbercurrencyCodestringcomparisonstringamount. greater_than: more than it, used in minimumAmount. less_than_or_equal: at most it, used in maximumAmount. One of greater_than, less_than_or_equal.cryptoobjectmethodstringpaymentMethods. Card checkout and wallets are all card. One of card, accountCredit, swish, bankgiro, sepa, alipay, crypto.labelstringavailablebooleanvisiblebooleanreasonstring or nullavailable is false.checkoutModestring or nullpayment, sepa_bank_transfer_payment, alipay_payment.requirementsobjectinvoiceCurrencyCodestringinvoiceCurrencyCodesarray of stringaccountCountryCodestringaccountCountryExcludedCodestringaccountTypestringprivate, organisation.accountCurrencyCodestringrequiresCardVerificationbooleanavailableBalanceobjectamountnumbercurrencyCodestringminimumAmountobjectamountnumbercurrencyCodestringcomparisonstringamount. greater_than: more than it, used in minimumAmount. less_than_or_equal: at most it, used in maximumAmount. One of greater_than, less_than_or_equal.maximumAmountobjectamountnumbercurrencyCodestringcomparisonstringamount. greater_than: more than it, used in minimumAmount. less_than_or_equal: at most it, used in maximumAmount. One of greater_than, less_than_or_equal.paymentLinkGeneratorUrlstring or nullPOST /api/v2/billing/invoices/{id}/actions/generate-payment-link). Null when actions.canGeneratePaymentLink.allowed is false.isBulkPaymentChildbooleanbulkPaymentParentId instead. actions.canPay can still be allowed on such an invoice.bulkPaymentParentIdstring or nullisBulkPaymentChild is false.coversInvoiceIdsarray of stringrenewalInvoicingobjectpreferencestringconsolidated, separate.generatedByAutomationbooleanisConsolidatedbooleanlabelstringsettingsUrlstringdeliveryobjectchannelstringpeppol.statusstringqueued: accepted for sending and waiting, for example for the send window. An unpaid invoice from today for an organisation registered in Peppol is also queued until it is sent. sent: sent into the Peppol network. delivered: the recipient’s access point confirmed receipt. A failed or ineligible delivery never shows here. Such an invoice has no delivery field. One of queued, sent, delivered.sentAtstring or nulldeliveredAtstring or nullcancellationobjectcodestringdomain_registered_elsewhere: an unpaid order for a new domain registration was cancelled automatically. Someone else registered the name before the invoice was paid. A new domain is registered only once its invoice is paid. The name was never on this account and nothing was charged. One of domain_registered_elsewhere.reasonstringcode to branch or to pick a translated text.domainNamestringregistrarNamestring or nullnull when unknown.registeredAtstring or nullnull when unknown.cancelledAtstring or nullregisteredAt, since the cancellation follows that registration.Errors
Errors are Problem Details with a stable code. Branch on the code, not on the text.
| 400 | Invalid request. The response body is an RFC 7807 Problem Details document. |
| 401 | Unauthorized. Authentication is required. |
| 403 | Forbidden. The caller lacks a required scope or does not own the resource. |
| 404 | Not found. The resource does not exist or is not owned by the caller; code is invoice_not_found. |
| 409 | Cancellation is blocked by an invoice update or payment. Codes: invoice_update_in_progress (refresh and retry), invoice_changed (refresh and retry), invoice_payment_in_progress (complete the unfinished payment, or contact support for an abandoned payment), invoice_payment_state_changed (refresh the invoice and check its payment status). |
| 429 | Rate limited. Retry after the limit resets. 429 responses include Retry-After seconds plus X-RateLimit-* headers. |
| 500 | Internal error. Retry later or contact support if the issue persists. |
| 502 | Upstream failure. A dependent provider request failed; the Problem Details code is upstream_failed. Retry later or contact support if the issue persists. |