Create a credit top-up invoice
POST /api/v2/billing/credit/actions/add-funds
Creates an unpaid invoice for adding money to the account credit. The amount is added to the credit when the invoice is paid. The call itself charges nothing and starts no payment. The invoice is in the account currency. Pay it like any other invoice. POST to paymentLinkGeneratorUrl for a payment link. You can also use POST /api/v2/billing/invoices/{id}/actions/pay.
Authentication: An API key with the scope write:billing. About keys and scopes
Request
Body
amountnumberrequiredAmount to add, in the account currency. More than 0 and at most 100000. Rounded to two decimals. At most 100000.
Example
curl -X POST "https://cloud.hostup.se/api/v2/billing/credit/actions/add-funds" \ -H "Authorization: Bearer $HOSTUP_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "amount": 250 }'Responses
200 The top-up invoice is created and unpaid.
{ "invoice": { "id": "inv_01hxa3b4c5d6e7f8g9h0j1k2m3", "number": "202600001", "amount": 250, "currencyCode": "SEK", "dueAt": "2026-11-02T00:00:00.000Z", "status": "unpaid", "paymentUrl": "/billing?invoice=202600001" }, "paymentLinkGeneratorUrl": "/api/v2/billing/invoices/inv_01hxa3b4c5d6e7f8g9h0j1k2m3/actions/generate-payment-link"}Response fields
invoiceobjectThe new top-up invoice.
idstringInvoice ID (
inv_…).numberstring or nullInvoice number.
amountnumber or nullInvoice total in major units of
currencyCode.currencyCodestringAccount currency, ISO 4217.
dueAtstring or nullDue date of the invoice.
statusstringInvoice status.
unpaid for a new top-up invoice.paymentUrlstring or nullClient-area page where the invoice can be paid, relative to
https://cloud.hostup.se.paymentLinkGeneratorUrlstringAPI endpoint to POST to for a payment link to this invoice.
Errors
Errors are Problem Details with a stable code. Branch on the code, not on the text.
| 400 | amount must be a number above 0 and at most 100000. The body takes no other field. Also returned when the top-up invoice could not be created. |
| 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. |
| 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 | The invoice may have been created, but its ID did not come back. List your unpaid invoices with GET /api/v2/billing/invoices before you retry, so you do not create a second top-up invoice. |