Validate order contact details
POST /api/v2/orders/validate-contact
Checks the contact details of a new order for common mistakes before the customer places it. It looks for missing names and names that look like an e-mail address. For an organisation it also checks that the company name is not an organisation number. It does not check the organisation number or personal identity number itself. No API key is needed. The answer is 200 for both outcomes: read valid and warnings[]. The warnings are advice. POST /api/v2/orders does not run this check and does not refuse an order because of them. To reuse the checked values in items[].registrantContact there, send accountType as type. registrantContact refuses a field named accountType.
Authentication: None. Anyone can call it.
Request
Body
firstNamestringrequiredlastNamestringrequiredcompanyNamestring or nullaccountType is organisation.registrationIdentifierobject | string | null{ value, countryCode } or a plain string. Used to spot a company name that repeats it.valuestringrequired400.countryCodestring or null400.accountTypestringrequiredprivate or organisation. The same choice as registrantContact.type in POST /api/v2/orders. One of private, organisation.countryCodestringrequiredExample
curl -X POST "https://cloud.hostup.se/api/v2/orders/validate-contact" \ -H "Content-Type: application/json" \ -d '{ "firstName": "Anna", "lastName": "Svensson", "companyName": null, "registrationIdentifier": null, "accountType": "private", "countryCode": "SE" }'curl -X POST "https://cloud.hostup.se/api/v2/orders/validate-contact" \ -H "Content-Type: application/json" \ -d '{ "firstName": "Anna", "lastName": "Svensson", "companyName": "Example AB", "registrationIdentifier": { "value": "556000-0000", "countryCode": "SE" }, "accountType": "organisation", "countryCode": "SE" }'curl -X POST "https://cloud.hostup.se/api/v2/orders/validate-contact" \ -H "Content-Type: application/json" \ -d '{ "firstName": "Anna", "lastName": "Svensson", "companyName": "556000-0000", "registrationIdentifier": { "value": "556000-0000", "countryCode": "SE" }, "accountType": "organisation", "countryCode": "SE" }'Responses
200 The verdict. valid: false is still a 200 response.
{ "valid": true, "warnings": []}{ "valid": false, "warnings": [ { "field": "companyName", "code": "duplicates_org_number", "reason": "Organisation name and organisation number contain the same value. Organisation name should be your company's registered name." } ]}Response fields
validbooleanwarningsarray of objectvalid is true.fieldstringfirstName, lastName, companyName.codestringmissing_required: the field is empty. looks_like_email: a name looks like an e-mail address. looks_like_org_number: the company name looks like an organisation number. duplicates_org_number: the company name repeats the organisation number. One of missing_required, looks_like_email, looks_like_org_number, duplicates_org_number.reasonstringErrors
Errors are Problem Details with a stable code. Branch on the code, not on the text.
| 400 | invalid_request: the body is not a JSON object or a field has the wrong type. |
| 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. |