# Write the domain's records with a kept key

> Write the domain's records with a kept key: CustomDomain™ API reference in the provider accounts group. Covers parameters, request body and responses.

Source: https://docs.customdomain.ai/docs/api-reference/provider-accounts/useConnectionSavedAccess

## `POST https://api.customdomain.ai/v1/connections/{id}:use-saved-access`

Writes the connection's records with one of the kept keys `GET /connections/{id}/saved-access` answers for it (`account_id`), and links the key to the domain, so later repairs and the removal use it. A key offered with `ready: false` takes the domain's zone into its scope once the write worked (`provider_account.domain_added` in the audit log). An account the resolver does not answer for this domain and caller is `409` `saved_access_not_usable`, and so is a key at another provider than the one a live or propagating domain's DNS is at, or a key whose scope does not hold such a domain yet (such a domain is linked without a write, and a scope widens only after a write). A write that fails links nothing and leaves the key's scope as it was, and records the failure on the domain (its `error_code` and `error_message`): `502` `saved_access_write_failed`, with the provider's words. A domain kept by an end user's own sign in key is left as it is (`409`).

### Authentication

`apiKey`

### Parameters

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

### Request body (JSON)

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `account_id` | string | yes |  |

### Responses

| Status | Description |
| --- | --- |
| `200` | The domain's outcome and the account after it |
| `400` | Error envelope: {code, title, details}. |
| `401` | Error envelope: {code, title, details}. |
| `403` | Error envelope: {code, title, details}. |
| `404` | Error envelope: {code, title, details}. |
| `409` | Error envelope: {code, title, details}. |
| `502` | Error envelope: {code, title, details}. |

### `200` response body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `result` | object | no | One domain's outcome of connecting with a kept key. |
| `account` | object | no |  |

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