## POST /api/v2/orders/validate-contact

**Validate order contact data**

Validate contact fields before order creation. This endpoint is intentionally public because checkout can run before an account exists. It returns HTTP 200 for both valid and invalid verdicts; branch on `valid` and `warnings[]`. Transport or body-shape failures return Problem Details.

### Related Endpoints

- `POST /api/v2/orders`: Create an order
- `GET /api/v2/orders/{id}`: Get order details
- `POST /api/v2/orders/preview`: Preview an order

### Headers

- `Accept`: application/json
- No authorization header required.
- `Content-Type`: application/json

### Request Body

- `firstName` (string, required) Example: `Anna`
- `lastName` (string, required) Example: `Svensson`
- `companyName` (string,null, required) Example: `null`
- `registrationIdentifier` (object,string,null, required): Organisation number or personal identity number in the same public shape used by order `clientData.registrationIdentifier`. Organisation accounts should send `{ "value": "559290-1325", "countryCode": "SE" }`; private accounts may send null. Example: `null`
- `accountType` (string, required) Example: `private`
  Allowed values: private, organisation
- `countryCode` (string, required) Example: `SE`

### Request Examples

#### Private contact

```bash
curl -X POST "https://cloud.hostup.se/api/v2/orders/validate-contact" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -d '{
    "firstName": "Anna",
    "lastName": "Svensson",
    "companyName": null,
    "registrationIdentifier": null,
    "accountType": "private",
    "countryCode": "SE"
  }'
```

```json
{
  "firstName": "Anna",
  "lastName": "Svensson",
  "companyName": null,
  "registrationIdentifier": null,
  "accountType": "private",
  "countryCode": "SE"
}
```

#### Organisation contact

```bash
curl -X POST "https://cloud.hostup.se/api/v2/orders/validate-contact" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -d '{
    "firstName": "Anna",
    "lastName": "Svensson",
    "companyName": "Example AB",
    "registrationIdentifier": {
      "value": "559290-1325",
      "countryCode": "SE"
    },
    "accountType": "organisation",
    "countryCode": "SE"
  }'
```

```json
{
  "firstName": "Anna",
  "lastName": "Svensson",
  "companyName": "Example AB",
  "registrationIdentifier": {
    "value": "559290-1325",
    "countryCode": "SE"
  },
  "accountType": "organisation",
  "countryCode": "SE"
}
```

### Response Schema

- `valid` (boolean, required) Example: `true`
- `warnings` (array<object>, required)
- `warnings[].field` (string, required) Example: `companyName`
  Allowed values: firstName, lastName, companyName, registrationIdentifier, accountType, countryCode
- `warnings[].code` (string, required) Example: `duplicates_org_number`
  Allowed values: too_short, too_long, invalid_characters, invalid_format, missing_required, unsupported_country, looks_like_email, looks_like_org_number, duplicates_org_number
- `warnings[].reason` (string, required) Example: `Organisation name and organisation number contain the same value. Organisation name should be your company's registered name.`

### Responses

#### 200 - Validation verdict. `valid: false` is still a successful validation response.
```json
{
  "valid": true,
  "warnings": []
}
```

#### 400 - Invalid request. The response body is an RFC 7807 Problem Details document.
```json
{
  "type": "https://developer.hostup.se/errors/invalid_request",
  "title": "Invalid request",
  "status": 400,
  "detail": "The request body failed validation.",
  "code": "invalid_request",
  "instance": "/api/v2/resource",
  "requestId": "req_01hxa3b4c5d6e7f8g9h0j1k2m3",
  "timestamp": "2026-04-27T12:34:56.000Z",
  "errors": [
    {
      "pointer": "/items/0/domainName",
      "detail": "`domainName` is required.",
      "code": "invalid_request"
    }
  ]
}
```

#### 404 - Not found. The resource does not exist or is not owned by the caller.
```json
{
  "type": "https://developer.hostup.se/errors/not_found",
  "title": "Not found",
  "status": 404,
  "detail": "The requested resource could not be found.",
  "code": "not_found",
  "instance": "/api/v2/resource",
  "requestId": "req_01hxa3b4c5d6e7f8g9h0j1k2m3",
  "timestamp": "2026-04-27T12:34:56.000Z"
}
```

#### 429 - Rate limited. Retry after the limit resets. 429 responses include `Retry-After` seconds plus `X-RateLimit-*` headers.
```json
{
  "type": "https://developer.hostup.se/errors/rate_limit_exceeded",
  "title": "Too many requests",
  "status": 429,
  "detail": "Too many requests. Retry after the limit resets.",
  "code": "rate_limit_exceeded",
  "instance": "/api/v2/resource",
  "requestId": "req_01hxa3b4c5d6e7f8g9h0j1k2m3",
  "timestamp": "2026-04-27T12:34:56.000Z"
}
```

#### 500 - Internal error. Retry later or contact support if the issue persists.
```json
{
  "type": "https://developer.hostup.se/errors/internal_error",
  "title": "Internal server error",
  "status": 500,
  "detail": "An unexpected error occurred. Retry later or contact support if the issue persists.",
  "code": "internal_error",
  "instance": "/api/v2/resource",
  "requestId": "req_01hxa3b4c5d6e7f8g9h0j1k2m3",
  "timestamp": "2026-04-27T12:34:56.000Z"
}
```
