Preview an order
POST /api/v2/orders/preview
Calculates the price of an order without placing it. Nothing is ordered and no invoice is created. Send the same body as POST /api/v2/orders. The response has the price per item, the tax and the total. While the customer is still filling in the form, clientData can be partial. Its countryCode, accountType and vatNumber decide the tax. A call with an API key is priced in the account’s currency. Without those fields it uses the account’s country and VAT number, as the order will. Without a key, tax follows the country of the calling IP address, else Sweden. The key is optional. Send it to get the price your order will have. A key that is not accepted gets no error. The preview is then priced as for a call without a key. A preview with a voucher code is provisional. The voucher is checked again when the order is placed. attemptKey and paymentMethod are accepted and do not change the preview. For a domain item, items[].nameserverMode shows which nameservers the order will use. A premium domain name is priced for one year, whatever years says. For a domain item with registrantContact, the domain_not_eligible check uses that holder’s country and type. Without it, the check uses clientData and then the account. The preview does not check accepted terms, the phone number, the identity number or the EPP code. The order does.
Authentication: None. Anyone can call it.
Request
Query parameters
partialstring1: an item that fails a registry rule is listed in problems and its items[N] is null. The other items keep their prices. Without it, such an item makes the whole preview answer 422. One of 1.Body
itemsarray of objecttype. Send at least one. An empty list creates no order and answers 200 with accountCreated: false.type is domaintypestringrequireddomain.actionstringrequiredregister for a new registration. transfer for an inbound transfer order. One of register, transfer.domainNamestringrequiredyearsintegeryears says. 1 to 10.eppCodestringaction: transfer. Leave it out when the extension uses no code. A transfer that needs one and lacks it answers 400 with the pointer /items/0/eppCode.acceptedTermsarray of stringse_registration_terms. The availability check names the key an extension needs in registryRequirements.registration[].acceptedTermsKey. A missing key answers 400 with domainRequirements.missingAcceptedTerms.registrantContactobjectclientData on the order.typestringprivate for a person, organisation for a company. When you leave it out, a companyName makes it organisation. One of private, organisation.firstNamestringlastNamestringcompanyNamestringtype: organisation.emailstringphoneNumberstringstreetstringcitystringstatestringpostalCodestringcountryCodestringregistrationIdentifierobject | stringbirthDate.valuestringrequiredcountryCodestring or nullnameserverModestringhostup: Hostup’s nameservers. custom: the new set in nameservers, at least two. preserve_current: a transfer keeps the nameservers it has at the registry today, even a single one, with no nameserver change. A transfer item may send none of nameserverMode, nameservers and copyExistingDns. If the order also has no web hosting for the same domain, the account’s transfer nameserver setting decides (Account > Domain settings in the client area). An account set to keep current nameservers gets preserve_current. Every other account gets hostup. Registrations and orders without an account get hostup. POST /api/v2/orders/preview returns the mode the order will use as items[].nameserverMode. One of hostup, custom, preserve_current.nameserversarray of stringcopyExistingDnsbooleancopyExistingDnsScopestringall: the whole DNS setup. website: the website records only. email: the e-mail records only. When the same order has web hosting for this domain, that item’s mxPreferences.dnsSetupPreference decides instead. One of all, website, email.premiumbooleantrue when the availability check returned premium: true for this domain. Premium registrations need it. So do transfers that need a fee confirmation.requiresRegistrarFeeAcceptancebooleantrue to accept the extra registrar fee when the availability check returned requiresRegistrarFeeAcceptance: true for this domain.voucherCodestringprovisional.type is vpstypestringrequiredvps.productSlugstringrequireddata[].slug from GET /api/v2/products/vps. A Cloud VPS is not ordered with this item.billingCyclestringbillingCycles[].billingCycle. Always send it. When you leave it out, the item is ordered and invoiced annually, whatever the plan’s main cycle. One of monthly, quarterly, semiannually, annually, biennially, triennially.osstringoperatingSystem option in configurableOptions[] of GET /api/v2/products/vps. A shortcut for configurableOptions.operatingSystem.quantityintegercustomHostnamestringcustomHostnamesarray of stringquantity, the list must have that many entries. Without it, the length of the list is the quantity. Cannot be combined with customHostname. Each entry follows the customHostname rules.configurableOptionsobjectconfigurableOptions[] of GET /api/v2/products/vps. Use the key values listed there. A key the plan does not have gets no error. Send SSH keys here as sshKeyIds, not at the top level of the item.restoreFromBackupobjectvps_…) and the backup ID (bkp_…). Give one hostname, in customHostname or a one-entry customHostnames. The order creates a fixed-cycle VPS and starts the restore once the VPS is ready.sourceVpsIdstringrequiredbackupIdstringrequiredrequiredStorageGbintegerbackupLabelstringvoucherCodestringprovisional.type is shared_hostingtypestringrequiredshared_hosting.productSlugstringrequiredGET /api/v2/products/shared-hosting. One of webbhotell-start, webbhotell-business, webbhotell-unlimited, webbhotell-reseller-unlimited.primaryDomainstringbillingCyclestringbillingCycles[].billingCycle. When you leave it out, the item is ordered and invoiced annually. One of annually, biennially, triennially.migrationobjecttype: "none" when nothing should be moved.typestringrequirednone, wordpress, cpanel, email-only.wpUserstringwordpress migration.wpPassstringwordpress migration.wpAdminUrlstringwordpress migration.cpUrlstringcpanel migration.cpUserstringcpanel migration.cpPassstringcpanel migration.emailPasswordsstringemail-only migration.notesstringmxPreferencesobjectdnsSetupPreference decides which records the new hosting account sets up. To keep the current mail or website working, also send the records to keep in existingMx or existingA.dnsSetupPreferencestringfull: website and e-mail. email-only: e-mail only, the current website stays. website-only: website only, the current e-mail stays. none: DNS stays as it is. One of full, email-only, website-only, none.existingMxarray of objectdnsSetupPreference website-only or none, or keepExisting without a preference.typestringrequiredA, AAAA, CNAME, MX, TXT, CAA, SRV.namestringrequired@ for the domain itself.valuestringrequiredttlnumberprioritynumberkeepExistingbooleanexistingMx to the new DNS zone. Read only when dnsSetupPreference is left out.existingAarray of objectdnsSetupPreference email-only or none, or keepExistingA without a preference.typestringrequiredA, AAAA, CNAME, MX, TXT, CAA, SRV.namestringrequired@ for the domain itself.valuestringrequiredttlnumberprioritynumberkeepExistingAbooleanexistingA to the new DNS zone. Read only when dnsSetupPreference is left out.existingSpfarray of objectkeepExisting keeps the MX records, Hostup adds include:spf.hostup.se to it.typestringrequiredA, AAAA, CNAME, MX, TXT, CAA, SRV.namestringrequired@ for the domain itself.valuestringrequiredttlnumberprioritynumbervoucherCodestringprovisional.clientDataobjectfirstNamestringlastNamestringcompanyNamestringemailstringaddressobjectstreetstringaddress2string or nullcitystringstatestringpostalCodestringcountryCodestringphoneNumberstringregistrationIdentifierobjectvaluestringcountryCodestring or nullvatNumberstringaccountTypestringprivate, organisation.paymentMethodstringcard: card checkout. swish: Swish. bankgiro: bankgiro payment in SEK. sepa: SEPA bank transfer in EUR. invoice: create the invoice without starting a payment. Send invoice when you pay the invoice through the API afterwards. Account credit is not a payment method here: apply it to the invoice after the order with POST /api/v2/billing/invoices/{id}/actions/apply-credit. One of card, swish, bankgiro, sepa, invoice.attemptKeystring504 with code TIMEOUT. Send it again later with the same key.asyncbooleantrue returns 202 with a job at once instead of the order. A completed job holds the order in result. A refused order also ends as completed: its result.status is then 400 or higher and result.code says why. Ignored for an order without an API key, for an item with restoreFromBackup and by POST /api/v2/orders/preview.Example
curl -X POST "https://cloud.hostup.se/api/v2/orders/preview" \ -H "Content-Type: application/json" \ -d '{ "paymentMethod": "bankgiro", "items": [ { "type": "domain", "action": "register", "domainName": "example.se", "years": 1, "acceptedTerms": [ "se_registration_terms" ], "registrantContact": { "type": "private", "firstName": "Anna", "lastName": "Svensson", "email": "user@example.com", "phoneNumber": "+46700000000", "countryCode": "SE", "registrationIdentifier": { "value": "850507-3412", "countryCode": "SE" } } } ], "clientData": { "countryCode": "SE", "accountType": "private", "registrationIdentifier": { "value": "850507-3412", "countryCode": "SE" } } }'curl -X POST "https://cloud.hostup.se/api/v2/orders/preview" \ -H "Content-Type: application/json" \ -d '{ "paymentMethod": "invoice", "items": [ { "type": "domain", "action": "transfer", "domainName": "example.com", "years": 1, "eppCode": "YOUR_EPP_CODE" } ] }'curl -X POST "https://cloud.hostup.se/api/v2/orders/preview" \ -H "Content-Type: application/json" \ -d '{ "items": [ { "type": "vps", "productSlug": "vps-xs", "billingCycle": "monthly", "os": "ubuntu-24-04", "customHostname": "app-01.example.com" } ] }'Responses
200 The price of the order.
{ "items": [ { "productSlug": "domain-se", "domainName": "example.se", "type": "domain", "billingCycle": "annually", "periodYears": 1, "nameserverMode": "hostup", "quantity": 1, "unitAmount": 79, "renewalAnnualAmount": 129, "setupAmount": 0, "configurableOptionAmounts": [], "subtotal": 79, "currencyCode": "SEK" } ], "subtotal": 79, "taxRateDecimal": 0.25, "taxAmount": 19.75, "total": 98.75, "currencyCode": "SEK", "reverseCharge": false, "priceAssurance": { "level": "authoritative", "reason": null, "revalidatedAtSubmit": false }, "problems": []}Response fields
itemsarray of object?partial=1, an item that failed a registry rule is null here and is described in problems.problemsarray of object?partial=1.pointerstringitemIndexintegeritems, from 0. At least 0.domainNamestring or nullcodestringdomain_not_eligible.reasonCodestringeu_registrant_country, registrant_country, registrant_type.detailstringfieldPointerstringsubtotalnumbertaxRateDecimalnumbertaxAmountnumbertotalnumbercurrencyCodestringreverseChargebooleanpriceAssuranceobjectlevelstringauthoritative when every price was verified. provisional when an item has a voucher code. The voucher is checked again when the order is placed. One of authoritative, provisional.reasonstring or nullrevalidatedAtSubmitbooleantrue when a voucher discount is checked again when the order is placed.Errors
Errors are Problem Details with a stable code. Branch on the code, not on the text.
| 400 | Invalid request. The response body is an RFC 7807 Problem Details document. |
| 422 | domain_not_eligible: a domain cannot be registered or transferred for this registrant, for example because of the registrant’s country or account type. errors points at the field the rule reads. product_not_orderable: a product in the body cannot be ordered. |
| 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 failure. A dependent provider request failed; the Problem Details code is upstream_failed. Retry later or contact support if the issue persists. |