
# Make an email address primary

`POST /fapi/v1/me/emails/{email_id}:set-primary` · called from the environment's sign-in host

Makes one of the authenticated user's verified email addresses the primary one. An unverified address cannot become primary; verify it first. After the change, the previous primary address and the user's other verified addresses receive a security notification with a "this wasn't me" link that opens account recovery. If the address is already primary, the answer is still `204` and nothing changes or is sent. Requires the authenticated user's `__Host-idp_session` cookie; if the cookie is missing, expired, or revoked, returns `401 unauthenticated`. A first-party app on another origin can instead send its front API access token (`Authorization: DPoP <token>` with a DPoP proof; see [Front API access token](/docs/api/fapi/front-api-token)).

The session must have been verified in the last 5 minutes. If the user has a second factor, the session must also have been opened with a second factor (`urn:idp:acr:mfa`).

## Request

Headers:

| Header | Required | Description |
| --- | --- | --- |
| `Idp-Client` | yes | SDK identifier. |
| `Origin` | yes | Must be exactly `https://<sign-in host>`. |

`email_id`: the email address identifier, the same value the management API's `/v1/users/{user_id}/emails` endpoints use (lowercase UUID).

No body.

## Response

`204 No Content`.

## Errors

| Status | Code | When |
| --- | --- | --- |
| 401 | `unauthenticated` | No valid session cookie. |
| 401 | `step_up_required` | Session was not verified in the last 5 minutes or a second factor is required; re-verify with `max_age=300` (and if applicable, `acr_values`) in the `WWW-Authenticate` header. |
| 403 | `origin_not_allowed` | `Origin` is missing or wrong. |
| 404 | `not_found` | No such email address for this user. |
| 409 | `primary_requires_verified` | The email address is not verified. |

## Example

```bash
curl -X POST https://example.keenauth.app/fapi/v1/me/emails/0190a5c4-1b2c-7d3e-8f40-516273849abc:set-primary \
  -H "Idp-Client: my-app/1.0.0 (node/22.0.0)" \
  -H "Origin: https://example.keenauth.app" \
  -b cookies.txt
```

## Personal data

This endpoint carries personal data: end-user profile. [Personal data in the KeenAuth APIs](/docs/policies/personal-data) describes what is stored, how long it is kept and how it is deleted. Do not send special categories of personal data (health, biometric data, religion, political opinions, sexual orientation) in any field.
