Update account preferences
PATCH /api/v2/me/preferences
Changes one or more account preferences. Send only the fields you want to change. The response holds all preferences, as GET /api/v2/me/preferences returns them. billing.separateInvoices.enabled: false puts domain renewals on one combined monthly invoice. true gives each domain renewal its own invoice. After you change billing.cardAutoCharge.configured, read billing.cardAutoCharge.status in the response. Automatic card payments need a saved card. To choose which e-mails the account gets, send notifications.delivery. Send overrideEnabled: false to return to defaults, which send every category.
Authentication: An API key with one of these scopes: write:account, write:billing. About keys and scopes
Request
Body
localizationobjectlanguageCodestringsv or en. One of sv, en.timezonestringEurope/Stockholm. 1 to 50 characters.notificationsobjectemailEnabledbooleansmsEnabledbooleandeliveryobjectoverrideEnabledbooleanfalse goes back to the default, which sends every category. true saves the list in enabledEmails.enabledEmailsarray of stringoverrideEnabled is true.securityobjectbankIdOnlyLoginbooleantrue needs a fresh BankID sign-in in the client area and is refused for an API key.twoFactorEnabledbooleanbillingobjectpeppolobjectPATCH /api/v2/me/preferences/peppol.optedOutbooleantrue stops new invoices from going out as Peppol e-invoices.creditNotesOptedOutbooleantrue stops credit notes from being sent automatically. Default false.cardAutoChargeobjectconfiguredbooleantrue charges the saved card automatically when invoices are due. Without a saved card the response shows status: needs_payment_method.separateInvoicesobjectenabledbooleanfalse combines domain renewals on one monthly invoice. true gives each domain renewal its own invoice.categoriesobjectgeneral, ui, notifications, billing or dashboard, each an object of key-value pairs. Keys use letters, digits and underscores, up to 100 characters.Example
curl -X PATCH "https://cloud.hostup.se/api/v2/me/preferences" \ -H "Authorization: Bearer $HOSTUP_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "billing": { "separateInvoices": { "enabled": false } } }'curl -X PATCH "https://cloud.hostup.se/api/v2/me/preferences" \ -H "Authorization: Bearer $HOSTUP_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "billing": { "separateInvoices": { "enabled": true } } }'curl -X PATCH "https://cloud.hostup.se/api/v2/me/preferences" \ -H "Authorization: Bearer $HOSTUP_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "billing": { "cardAutoCharge": { "configured": true } } }'curl -X PATCH "https://cloud.hostup.se/api/v2/me/preferences" \ -H "Authorization: Bearer $HOSTUP_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "billing": { "cardAutoCharge": { "configured": false } } }'curl -X PATCH "https://cloud.hostup.se/api/v2/me/preferences" \ -H "Authorization: Bearer $HOSTUP_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "notifications": { "delivery": { "overrideEnabled": true, "enabledEmails": [ "notify_billing", "notify_support" ] } } }'curl -X PATCH "https://cloud.hostup.se/api/v2/me/preferences" \ -H "Authorization: Bearer $HOSTUP_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "notifications": { "delivery": { "overrideEnabled": false } } }'Responses
200 All account preferences after the change.
{ "localization": { "languageCode": "en", "timezone": "Europe/Stockholm" }, "notifications": { "emailEnabled": true, "smsEnabled": false, "delivery": { "overrideEnabled": true, "enabledEmails": [ "notify_billing", "notify_support" ], "billing": { "enabled": true, "actions": { "canToggle": { "allowed": false, "reason": "Add a billing notification recipient before changing billing email delivery." } } } } }, "security": { "bankIdOnlyLogin": false, "twoFactorEnabled": false }, "billing": { "peppol": { "optedOut": false, "optOutReason": null, "optedOutAt": null, "creditNotesOptedOut": false, "creditNotesOptedOutAt": null }, "cardAutoCharge": { "enabled": true, "label": "Card auto-charge", "description": "Automatically charge the saved card when invoices are due.", "reason": null, "actions": { "canToggle": { "allowed": true, "reason": null } }, "method": "card", "status": "active", "configured": true, "hasPaymentMethod": true }, "separateInvoices": { "enabled": false, "label": "Separate domain invoices", "description": "Receive a separate invoice for each domain renewal.", "reason": null, "actions": { "canToggle": { "allowed": true, "reason": null } } } }, "categories": { "general": {}, "ui": {}, "notifications": {}, "billing": {}, "dashboard": {} }}Response fields
localizationobjectlanguageCodestringsv, en.timezonestringnotificationsobjectemailEnabledbooleansmsEnabledbooleandeliverynullsecurityobjectbankIdOnlyLoginbooleantwoFactorEnabledbooleanbillingobjectpeppolobjectoptedOutbooleanoptOutReasonstring or nulloptedOutAtstring or nullcreditNotesOptedOutbooleancreditNotesOptedOutAtstring or nullcardAutoChargenullseparateInvoicesnullcategoriesobjectgeneralobjectuiobjectnotificationsobjectbillingobjectdashboardobjectErrors
Errors are Problem Details with a stable code. Branch on the code, not on the text.
| 400 | invalid_request: the body changes no supported field. Or a field has the wrong type or value. |
| 401 | Unauthorized. Authentication is required. |
| 403 | forbidden: the request has no customer account context. Also returned when the key lacks the scope the changed fields need. An API key that sets security.bankIdOnlyLogin to true gets it too. |
| 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 | upstream_failed: the billing settings or the language could not be saved right now. Other fields in the same request may already be saved. Read the preferences again before you retry. |