---
title: "Give an account a new key"
method: POST
path: "/provider-accounts/{id}/reconnect"
tags: ["Provider accounts"]
---

# Give an account a new key

`POST /provider-accounts/{id}/reconnect`

## Request

- Base URL: `https://api.customdomain.ai/v1`
- URL: `https://api.customdomain.ai/v1/provider-accounts/{id}/reconnect`
- Auth: HTTP bearer

For an account the provider stopped accepting, or a one time account whose key was deleted. Everything is checked before anything is kept: the access mode, then the key (listing the provider's domains, or reading `check_domain`, a selected domain or a domain the account connected, for a provider that cannot list them), and for a `selected` account that the key reaches every selected domain. `params` sent with the key replace the kept ones. Takes an admin, an owner or the member who connected the account.

## Path parameters

- `id` string, required

## Request body

- object
  - `access` 'continuous' | 'one_time'
  - `check_domain` string: A domain the key manages, read to check the key when the provider cannot list its domains.
  - `credential` object, required
    - `token` string, required
    - `params` object

## Response `200`

The account

- object
  - `account` ProviderAccount
    - `id` string, required
    - `kind` 'api_key', required
    - `provider` string, required
    - `provider_name` string, required
    - `label` string, required
    - `access` 'continuous' | 'one_time', required
    - `scope` 'all' | 'selected', required
    - `domains` string[], required: The selected zones (scope `selected`).
    - `credential_held` boolean, required: Whether the key is still kept and usable (false for a one time account past its hour). The key itself is never returned.
    - `status` 'active' | 'used' | 'expired' | 'needs_reconnect', required
    - `last_error` string
    - `created_by` string
    - `last_used_at` string, date-time
    - `expires_at` string, date-time: When a one time account's key is deleted at the latest.
    - `created_at` string, date-time, required
    - `updated_at` string, date-time
    - `connections` AccountConnection[], required
      - `id` string
      - `application_id` string
      - `domain` string
      - `status` string
    - `uses` string[], required: What the account's access is used for.
    - `can_manage` boolean, required: Whether the caller may change the account's access, scope or domains, connect domains with it and replace its key: an admin, an owner, or the member who connected it.

## Other responses

- `400`: Error envelope: {code, title, details}.
- `401`: Error envelope: {code, title, details}.
- `403`: Error envelope: {code, title, details}.
- `404`: Error envelope: {code, title, details}.
- `422`: The provider refused the key (`ProviderAuthenticationError`)
- `503`: Error envelope: {code, title, details}.

---

[API](https://skmtc.dev/customdomain/apis/customdomain-control-plane-api.md) · [All operations](https://skmtc.dev/customdomain/apis/customdomain-control-plane-api/llms.txt) · [OpenAPI document](https://skmtc.dev/customdomain/apis/customdomain-control-plane-api/revisions/34d89cb7a7cd?raw)
