# Verify the customer's Route 53 access role and write the connection's records with it

> complete route53 role: reference page for this CustomDomain™ API operation in the connections group. Covers parameters, request body, responses and error codes.

Source: https://docs.customdomain.ai/docs/api-reference/connections/completeRoute53Role

## `POST https://api.customdomain.ai/v1/connections/{id}/route53-role:complete`

**Route 53 access role, second step.** Send the `RoleArn` output of the stack the customer created from the `route53-role:start` link. CustomDomain™ assumes the role with the connection's external ID and checks that AWS refuses the role both without an external ID and with a wrong one: a role that lets CustomDomain™ in without the right external ID is refused and never stored. It then finds the hosted zone and writes the connection's records through Route 53 with the role's temporary credentials, and the connection moves to `propagating` exactly as after an API key apply. The verified role is stored, so calling this again with an empty body re-applies the records with it. Branch on `code`: `route53_role_not_started` (409), `route53_role_arn_invalid` (400), `route53_external_id_mismatch` (the role was made from another link), `route53_role_not_found` (AWS refused the role), `route53_external_id_not_required`, `route53_zone_not_found` (no public hosted zone for the domain or a parent of it), `route53_zone_ambiguous` (two public hosted zones share the name and the role can read both), `route53_access_denied` (the role cannot read that zone, or cannot write a record the connection needs) and `route53_record_conflict` (another record holds the name with a type the needed record cannot share; delete or change it in the Route 53 console), all 422, and `route53_unavailable` (503, nothing was changed, try again).

A widget token must be the connection's end user: a connection that names another end user than the token's `end_user_ref`, or names one while the token names none, answers `403` `token_wrong_end_user` before anything is read or changed, and a connection that names none is any token's. An API key, an app-scoped token and a delegated agent token are not limited by it.

### Authentication

`widgetJWT`, `apiKey`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes |  |

### Request body (JSON)

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `role_arn` | string | no | The stack's `RoleArn` output, such as `arn:aws:iam::123456789012:role/CustomDomainDNSAccess-0123456789abcdef0123456789abcdef`. Optional once a role has been verified for the connection. |

### Responses

| Status | Description |
| --- | --- |
| `200` | The records were written and the connection is propagating. |
| `400` | Error envelope: {code, title, details}. |
| `401` | Error envelope: {code, title, details}. |
| `403` | `forbidden`: the credential may not do this. `token_wrong_end_user`: a widget token that is not this connection's end user (the connection names another end user than the token's `end_user_ref`, or names one while the token names none); nothing is read or changed, and the answer shows nothing of the connection. Mint the token with the end user's `end_user_ref`. |
| `404` | Error envelope: {code, title, details}. |
| `409` | Error envelope: {code, title, details}. |
| `422` | Error envelope: {code, title, details}. |
| `503` | Error envelope: {code, title, details}. |

### `200` response body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `connection` | object | yes |  |
| `records` | array of object | yes |  |
| `role_arn` | string | yes | The verified role, now stored so an empty call re-applies with it. |
| `zone` | string | yes | The Route 53 hosted zone the records were written into. |

The full specification is served at `GET https://api.customdomain.ai/v1/openapi.json`.
