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
idstringrequiredThe VPS ID (
vps_…).Body
enabledbooleanrequiredtrue to accept the charges and turn extra sending on. false to turn it off.Example
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 }'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": false }'Responses
200 The setting was saved.
{ "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
featureKeystringAlways
mail_relay_overage. One of mail_relay_overage.enabledbooleanTrue when the account has accepted the charges.
acceptedAtstring or nullWhen the charges were last accepted.
revokedAtstring or nullWhen the charges were turned off. Null while they are on.
paygEnabledbooleanTrue when extra sending is billed pay-as-you-go from now on.
paygEligiblebooleanTrue when the account may use pay-as-you-go billing.
pricingobject or nullPrice 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.
| 400 | enabled is missing or not a boolean. code is invalid_charge_consent_request. |
| 401 | Authentication is required. |
| 403 | The 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. |
| 404 | The VPS was not found. code is vps_not_found. |
| 429 | Rate limited. Retry after the limit resets. 429 responses include Retry-After seconds plus X-RateLimit-* headers. |
| 500 | The setting could not be saved. Try again later. |