
# Get the environment configuration

`GET /fapi/v1/environment` · called from the environment's sign-in host

Returns the public configuration a sign-in page needs before it opens a transaction: the first factors a new
transaction of the application will offer, the sign-up mode, the enabled languages and, when passkeys are offered, the
passkey `rp_id`. The response contains no personal data, reads no cookie and opens no transaction.

## Request

Headers:

| Header | Required | Description |
| --- | --- | --- |
| `Idp-Client` | yes | SDK identifier, `<package>/<version> (<runtime>/<version>)`. |

Query parameters:

| Parameter | Required | Description |
| --- | --- | --- |
| `client_id` | yes | The application's `client_id`. |

## Response

`200 OK`:

| Field | Description |
| --- | --- |
| `schema_version` | `1`. |
| `first_factors` | The methods a new transaction offers, in this order: `password`, `passkey`, `email_otp`, `magic_link`. Empty when the policy allows no method. |
| `sign_up` | Sign-up mode: `open`, `invite_only` or `closed`. |
| `locales` | `enabled` (enabled languages) and `default` (default language). |
| `passkey` | Only when passkey sign-in is offered: `rp_id`. |

The response carries `Cache-Control: max-age=60`; a policy change shows within a minute.

## Errors

| Status | Code | When |
| --- | --- | --- |
| 400 | `malformed_request` | `Idp-Client` is missing. |
| 403 | `environment_suspended` | The environment is suspended. |
| 403 | `headless_not_allowed` | The application is not first party. |
| 404 | `not_found` | The host belongs to no environment. |
| 422 | `validation_failed` | `client_id` is missing, too long or unknown (`/client_id`). |

## Example

```bash
curl "https://example.keenauth.app/fapi/v1/environment?client_id=app_01j9zq3k5m7n8p9r0s1t2v3w4x" \
  -H "Idp-Client: my-app/1.0.0 (node/22.0.0)"
```

```json
{
  "schema_version": 1,
  "first_factors": ["password", "passkey", "email_otp"],
  "sign_up": "open",
  "locales": {"enabled": ["tr", "en"], "default": "tr"},
  "passkey": {"rp_id": "example.keenauth.app"}
}
```
