Skip to content

Turn pay-as-you-go mail relay sending on or off

POST /api/v2/vps/{id}/mail-relay/charge-consent

Turns pay-as-you-go billing for extra mail relay sending on or off for the whole account. With it on, the account can send more than the included amount each month. Emails above the included amount are billed at pricing.amount per pricing.unitEmails. enabled: true records that the account accepts this price. Turning it on needs an account that may use pay-as-you-go billing. Otherwise the call returns 403 payg_access_required. Send enabled: false to go back to the included amount.

Authentication: An API key with the scope write:billing. About keys and scopes

Request

Path parameters

idstringrequired
The VPS ID (vps_…).

Body

enabledbooleanrequired
true to accept the charges and turn extra sending on. false to turn it off.

Example

POST /api/v2/vps/{id}/mail-relay/charge-consent
curl -X POST "https://cloud.hostup.se/api/v2/vps/vps_01hxa3b4c5d6e7f8g9h0j1k2m3/mail-relay/charge-consent" \
-H "Authorization: Bearer $HOSTUP_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"enabled": true
}'

Responses

200 The setting was saved.

Response 200
{
"featureKey": "mail_relay_overage",
"enabled": true,
"acceptedAt": "2026-11-02T12:00:00.000Z",
"revokedAt": null,
"paygEnabled": true,
"paygEligible": true,
"pricing": {
"amount": 5,
"currencyCode": "SEK",
"unitEmails": 1000
}
}
Response fields
featureKeystring
Always mail_relay_overage. One of mail_relay_overage.
enabledboolean
True when the account has accepted the charges.
acceptedAtstring or null
When the charges were last accepted.
revokedAtstring or null
When the charges were turned off. Null while they are on.
paygEnabledboolean
True when extra sending is billed pay-as-you-go from now on.
paygEligibleboolean
True when the account may use pay-as-you-go billing.
pricingobject or null
Price of extra sending in the account currency. Null when it could not be read.

Errors

Errors are Problem Details with a stable code. Branch on the code, not on the text.

400enabled is missing or not a boolean. code is invalid_charge_consent_request.
401Authentication is required.
403The account may not use pay-as-you-go billing yet. code is payg_access_required and reason says what is missing, for example no_card_on_file.
404The VPS was not found. code is vps_not_found.
429Rate limited. Retry after the limit resets. 429 responses include Retry-After seconds plus X-RateLimit-* headers.
500The setting could not be saved. Try again later.