# Introduction

This section of API allows to manage customer web domains.

## Domain Web Config model

### Example

```json
{
  "domain_web_config": {
    "id": 1,
    "tls_setup": "automatic",
    "redirect_to": {
      "target_domain_id": null,
      "http_status": null
    },
    "recaptcha": {
      "site_key": null,
      "parent_project": null,
      "service_account_key": null
    },
    "dns_records": [
      {
        "key": "kauppakeskusseppa-fi.sites.dev.placewise.com",
        "type": "CNAME",
        "values": [
          "sites.eu.placewise.com."
        ]
      }
    ],
    "status": {
      "last_validated_at": null,
      "dns_key_valid": null,
      "target": {
        "valid": true,
        "errors": []
      },
      "tls": {
        "letsencrypt_allowed_in_dns": null
      }
    },
    "created_at": "2024-02-21T10:14:16.593398Z",
    "updated_at": "2024-02-21T10:14:16.593398Z"
  }
}
```

### Definition

| Key                                   | Type          | Optional | Read-only | Description                                                                              |
|---------------------------------------|---------------|----------|-----------|------------------------------------------------------------------------------------------|
| id                                    | integer       | No       | Yes       |                                                                                          |
| tls_setup                             | string        | No       | Yes       | Describes how tls certs are created, enum [`automatic`, `manual`], default: `automatic`  |
| redirect_to                           | hash          | No       | Yes       | Hash containing configuration of redirection                                             |
| redirect_to.target_domain_id          | integer       | Yes      | Yes       | Id of domain where web request should be redirected                                      |
| redirect_to.http_status               | integer       | Yes      | Yes       | Returned http status when redirection is configured, one of [`301`, `302`]               |
| recaptcha                             | hash          | No       | Yes       | Hash containing configuration of reCAPTCHA                                               |
| recaptcha.site_key                    | string        | Yes      | Yes       | Site key obtained for registering reCAPTCHA                                              |
| recaptcha.parent_project              | string        | Yes      | Yes       |                                                                                          |
| recaptcha.service_account_key         | hash          | Yes      | Yes       | Confidential service account key for reCAPTCHA (only for write - obscured for reading)                                          |
| dns_records                           | array[hash]   | No       | Yes       | Array of hashes which describe what dns records have to be set                           |
| dns_records.key                       | string        | No       | Yes       | Key of dns record                                                                        |
| dns_records.type                      | string        | No       | Yes       | Type of dns record                                                                       |
| dns_records.values                    | array[string] | No       | Yes       | Values of dns record                                                                     |
| status                                | hash          | No       | Yes       | Hash presenting current status of web domain setup                                       |
| status.last_validated_at              | datetime      | Yes      | Yes       |                                                                                          |
| status.dns_key_valid                  | boolean       | Yes      | Yes       | Indicates if dns records are properly set (relates to `dns_records` key)                 |
| status.target                            | hash          | No       | Yes       | Hash presenting current status of target setup                                              |
| status.tls                            | hash          | No       | Yes       | Hash presenting current status of tls setup                                              |
| status.tls.letsencrypt_allowed_in_dns | boolean       | Yes      | Yes       | Indicates if letsencrypt is allowed in dns (no CAA records which disallow it) - only present when `tls_setup` is `automatic`           |
| status.tls.certificate_status          | string       | Yes      | Yes       | Indicates status of manual certificate, enum [`none`, `valid`, `expired`] (default is `none`). Only present when `tls_setup` is `manual`                                               |
| created_at         | datetime    | No                   | Yes       | Time of record creation
| updated_at         | datetime    | No                   | Yes       | Time of record last update