Skip to content

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

firstNamestringrequired
First name. For an organisation, the first name of the contact person at the company.
lastNamestringrequired
Last name. For an organisation, the last name of the contact person at the company.
companyNamestring or null
Company name. Checked only when accountType is organisation.
registrationIdentifierobject | string | null
Organisation number or personal identity number, as { value, countryCode } or a plain string. Used to spot a company name that repeats it.
valuestringrequired
The number. An empty value is refused with 400.
countryCodestring or null
Two-letter country code of the number. Optional. Any other value is refused with 400.
accountTypestringrequired
private or organisation. The same choice as registrantContact.type in POST /api/v2/orders. One of private, organisation.
countryCodestringrequired
Two-letter country code (ISO 3166-1 alpha-2).

Example

POST /api/v2/orders/validate-contact
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"
}'

Responses

200 The verdict. valid: false is still a 200 response.

{
"valid": true,
"warnings": []
}
Response fields
validboolean
True when there are no warnings.
warningsarray of object
One entry per problem found. Empty when valid is true.
fieldstring
The field the warning is about. One of firstName, lastName, companyName.
codestring
missing_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.
reasonstring
The warning in plain English, ready to show.

Errors

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

400invalid_request: the body is not a JSON object or a field has the wrong type.
429Rate limited. Retry after the limit resets. 429 responses include Retry-After seconds plus X-RateLimit-* headers.
500Internal error. Retry later or contact support if the issue persists.