Skip to content

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

amountnumberrequired
Amount to add, in the account currency. More than 0 and at most 100000. Rounded to two decimals. At most 100000.

Example

POST /api/v2/billing/credit/actions/add-funds
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.

Response 200
{
"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
invoiceobject
The new top-up invoice.
idstring
Invoice ID (inv_…).
numberstring or null
Invoice number.
amountnumber or null
Invoice total in major units of currencyCode.
currencyCodestring
Account currency, ISO 4217.
dueAtstring or null
Due date of the invoice.
statusstring
Invoice status. unpaid for a new top-up invoice.
paymentUrlstring or null
Client-area page where the invoice can be paid, relative to https://cloud.hostup.se.
paymentLinkGeneratorUrlstring
API 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.

400amount 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.
401Unauthorized. Authentication is required.
403Forbidden. The caller lacks a required scope or does not own the resource.
404Not found. The resource does not exist or is not owned by the caller.
429Rate limited. Retry after the limit resets. 429 responses include Retry-After seconds plus X-RateLimit-* headers.
500Internal error. Retry later or contact support if the issue persists.
502The 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.