# Account linking

Source: https://www.pontive.com/docs/api-reference/management/account-linking

Base URL: `https://api.{region}.pontive.com/v1` (operations that name another server say so).

Authentication: send `Authorization: Bearer <token>` with a secret key (`pontive_sk_…`, which implies its instance) or an access token issued for this API. A token that can reach several instances also names one with `X-Pontive-Instance-ID: inst_…`. Secret keys are for servers only.

## Get account-linking settings

```http
GET https://api.{region}.pontive.com/v1/authn/account-linking-config
```

Get the instance's account-linking settings: what a first sign-in through a social or enterprise connection does when its email already belongs to an account. An instance that never saved them links by the defaults, both settings on. Linking always needs the address verified on both sides, by a provider trusted to vouch for it and on the account; no setting turns that off.

Operation ID: `GetAccountLinkingConfig`

### Responses

- `200` OK: AccountLinkingConfig
- `401` Unauthorized: ErrResponse
- `403` Forbidden: ErrResponse
- `500` Internal Server Error: ErrResponse

## Update account-linking settings

```http
PATCH https://api.{region}.pontive.com/v1/authn/account-linking-config
```

Patch the instance's account-linking settings. Omitted fields are left unchanged. auto_link_by_email off refuses every first provider sign-in whose email belongs to an existing account with 409 auth_provider_link_required; allow_manual_linking off refuses a signed-in user starting a link through POST /v1/me/external-identities.

Operation ID: `UpdateAccountLinkingConfig`

### Header parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `If-Match` | string |  | The ETag the document was read with: a stale one is refused 412 precondition_failed (D42) |

### Request body (`application/json`, required): UpdateAccountLinkingConfigRequest

Update payload

### Responses

- `200` OK: AccountLinkingConfig
- `400` Bad Request: ErrResponse
- `401` Unauthorized: ErrResponse
- `403` Forbidden: ErrResponse
- `412` precondition_failed: the document changed since it was read: ErrResponse
- `422` Unprocessable Entity: ErrResponse
- `500` Internal Server Error: ErrResponse

## Schemas

### AccountLinkingConfig

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `allow_manual_linking` | boolean |  | AllowManualLinking lets a signed-in user link a provider account to themselves, POST /v1/me/external-identities. Off, starting a link is refused 403 permission_denied. Default true. |
| `auto_link_by_email` | boolean |  | AutoLinkByEmail links a first provider sign-in to the account with the same email when the provider vouches for the address and the account has verified it. Off, every such sign-in is refused 409 auth_provider_link_required. Default true. |
| `object` | string |  |  |
| `updated_at` | string |  | UpdatedAt is null until the settings are first saved. |

### ErrResponse

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `error` | ErrBody |  |  |

### UpdateAccountLinkingConfigRequest

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `allow_manual_linking` | boolean |  |  |
| `auto_link_by_email` | boolean |  |  |

### ErrBody

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `code` | string |  | Code is the spec's machine-readable code for this error, in snake case: a domain code such as seat_limit_reached where the refusal has one, otherwise a generic one such as permission_denied, not_found, conflict, invalid_request or service_unavailable. |
| `details` | ErrDetail[] |  | Details are per-field findings, present only on a refusal that has them, e.g. a 422 invalid_theme names each invalid value by its path, a 422 package_invalid each problem, and a 409 capability_in_use each count by its name. |
| `doc_url` | string |  | DocURL links to documentation about this error, when available. |
| `message` | string |  | Message is a human-readable description of what went wrong. |
| `object` | string |  | Object is the discriminator; always "error". |
| `param` | string |  | Param names the request parameter this error refers to, when applicable. |
| `type` | "validation_error" \| "authentication_error" \| "authorization_error" \| "not_found" \| "conflict_error" \| "rate_limit_error" \| "internal_error" |  | Type is the error's category, set by its HTTP status: one of validation_error, authentication_error, authorization_error, not_found, conflict_error, rate_limit_error, internal_error. |

### ErrDetail

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `field` | string |  | Field is where the finding is: for a theme, its dotted path. |
| `message` | string |  | Message is what is wrong there. |
