# Update Identity Provider

`PATCH /identity-providers/{epcId}` · Identity & Access · Federation

Partially updates a project-scoped end-user federation provider configuration. Mutable fields are `displayName`, `config`, `attributeMap`, `groupSync`, `jitProvisioning`, and `enabled`; the `type` field is immutable after creation. Credential fields in `config` follow the same plaintext-on-input / `*Ref`-on-output rule as creation. Requires `PROJECT_ADMIN`.

## Parameters

| Name | In | Required | Description |
|---|---|---|---|
| `epcId` | path | yes | The identity provider configuration's id (`epc_...`). Example: `"epc_demo00000001"`. |
| `projectSlug` | path | yes | The project's slug: the path segment after `@`. It is unique within the org. Example: `"storefront"`. |

## Request body

| Field | Type | Required | Description |
|---|---|---|---|
| `displayName` | string | no | A name for this configuration, 1 to 256 characters. |
| `clientId` | string | no | The client (application) id registered with the provider. |
| `clientSecretRef` | string | no | The provider's client secret itself, despite the name. It is encrypted at rest and never returned: reads show only `clientSecretSet`. For `apple` it is the Sign in with Apple signing bundle as a JSON string with `teamId`, `keyId` and `privateKey` (a P-256 PKCS#8 PEM). |
| `redirectUri` | string | no | The callback the provider redirects to. The platform derives it from the org and project slugs and the provider; omit it, or send exactly the derived value (anything else gets 400 `K9O_INVALID_FIELD_VALUE`). `scim`, `ldap` and `active_directory` have none and store `not-applicable`. |
| `metadataUrl` | object | no | The provider's discovery or metadata URL (for example an OIDC issuer's `.well-known/openid-configuration`, or a SAML metadata document), or null. Must not contain credentials. On update, changing it for `oidc` or `microsoft` without sending `clientSecretRef` again clears the stored secret. |
| _one of_ | | |  |
| _or_ | | |  |
| `attributeMap` | object | no | Maps platform claim names to the provider's attribute names, as `{ "<claim>": "<provider attribute>" }`. Read by the `saml`, `ldap` and `active_directory` providers: `email` (default `mail` for LDAP), `name` (default `cn` for LDAP) and `sub`. LDAP and Active Directory also read `search_base` and `search_filter_template` here. Default `{}`. |
| `enabled` | boolean | no | Whether end users can sign in with this provider. Default false on create. |
| `allowedRedirectUris` | object | no | The web origins (`https://host[:port]`, or `http://` on localhost only; no path, query or credentials) that SDK sign-in with this provider may return the end user to. Empty or null means SDK sign-in is refused until an origin is added. At most 64. |
| _one of_ | | |  |
| _or_ | | |  |
| `nativeRedirectUris` | object | no | Exact private-use-scheme URIs a native app receives sign-ins on (RFC 8252), such as `com.example.app:/oauth`: a lowercase reverse-domain scheme, a single slash and a path; no query, fragment or `//`. Matched character for character. Empty or null for none. At most 10. |
| _one of_ | | |  |
| _or_ | | |  |
| `directoryPullEnabled` | boolean | no | Turns on the scheduled user-directory sync. `google` only, and it needs `serviceAccountKey`, `directorySyncSubject` and `directorySyncIntervalMins`, sent in this request or already stored. Default false. |
| `directorySyncIntervalMins` | integer | no | Minutes between directory syncs, 5 to 1440. |
| `serviceAccountKey` | string | no | The Google service account key (JSON) the directory sync uses. Encrypted at rest and never returned. |
| `directorySyncSubject` | string | no | The Google Workspace admin user the directory sync acts as (domain-wide delegation). |

```json
{
  "displayName": "My Resource",
  "clientId": "string",
  "clientSecretRef": "string",
  "redirectUri": "string",
  "metadataUrl": null,
  "attributeMap": {},
  "enabled": true
}
```

## Responses

- **200**: Success

| Field | Type | Required | Description |
|---|---|---|---|
| `data` | object | yes | An end-user identity provider configuration. Secrets are never included. |
| `data.id` | string | yes | The configuration's id (`epc_...`). |
| `data.projectId` | string | yes | The project's id (`proj_...`). |
| `data.idpProvider` | enum ("google", "github", "microsoft", "oidc", "saml", "scim", "ldap", "active_directory", "apple", "facebook", "twitter") | yes | The identity provider type. It cannot be changed after create: delete the configuration and create a new one instead. |
| `data.displayName` | string | yes | A name for this configuration, 1 to 256 characters. |
| `data.clientId` | string | yes | The client (application) id registered with the provider. |
| `data.clientSecretSet` | boolean | yes | Whether a client secret is stored. The secret itself is never returned. Always false for providers that use none (`saml`, `ldap`, `active_directory`, `scim`). |
| `data.redirectUri` | string | yes | The callback the provider redirects to, derived by the platform. Register it with the provider. `not-applicable` for `scim`, `ldap` and `active_directory`. |
| `data.metadataUrl` | object | yes | The provider's discovery or metadata URL, or null when none is set. |
| _one of_ | | |  |
| _or_ | | |  |
| `data.attributeMap` | object | yes | Maps platform claim names to the provider's attribute names, as `{ "<claim>": "<provider attribute>" }`. Read by the `saml`, `ldap` and `active_directory` providers: `email` (default `mail` for LDAP), `name` (default `cn` for LDAP) and `sub`. LDAP and Active Directory also read `search_base` and `search_filter_template` here. Default `{}`. |
| `data.enabled` | boolean | yes | Whether end users can sign in with this provider. |
| `data.allowedRedirectUris` | array of string | yes | The web origins SDK sign-in may return the end user to. Empty means SDK sign-in is refused. |
| `data.nativeRedirectUris` | array of string | yes | The native-app redirect URIs. Empty when there are none. |
| `data.directoryPullEnabled` | boolean | yes | Whether the scheduled directory sync is on. |
| `data.directorySyncSubject` | object | yes | The admin user the directory sync acts as, or null when unset. |
| _one of_ | | |  |
| _or_ | | |  |
| `data.directorySyncIntervalMins` | object | yes | Minutes between directory syncs, or null when unset. |
| _one of_ | | |  |
| _or_ | | |  |
| `data.directorySyncLastRunAt` | object | yes | When the directory sync last ran, or null if it never has. |
| _one of_ | | |  |
| _or_ | | |  |
| `data.directorySyncLastStatus` | object | yes | How the last directory sync ended, or null if it never ran. `ok`; `error`; `disabled_skipped` (the configuration was disabled); `credential_absent` (no service account key); `audit_write_failed` (the run stopped because its audit record could not be written). |
| _one of_ | | |  |
| _or_ | | |  |
| _or_ | | |  |
| _or_ | | |  |
| _or_ | | |  |
| _or_ | | |  |
| `data.createdAt` | string (date-time) | yes | When the configuration was created. |
| `data.updatedAt` | object | yes | When it last changed, or null if it never has. |
| _one of_ | | |  |
| _or_ | | |  |
| `meta` | object | yes | Request metadata: cost, timing and the request and trace ids. |


## Errors

| HTTP | Code | When |
|---|---|---|
| 401 | `K9O_SESSION_EXPIRED` | Your session has expired; authenticate again to continue. |
| 403 | `K9O_ACCESS_DENIED` | You do not have the required role to update this identity provider configuration. |
| 410 | `K9O_SLUG_GONE` | The project slug in the URL has been renamed; update your integration to use the current slug. |

## Code samples

### cURL

```bash
curl -X PATCH 'https://<org>.api-<region>.k9o.io/@storefront/identity-providers/<epcId>' \
  -H 'Authorization: Bearer $K9O_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{
  "displayName": "My Resource",
  "clientId": "string",
  "clientSecretRef": "string",
  "redirectUri": "string",
  "metadataUrl": null,
  "attributeMap": {},
  "enabled": true
}'
```

### fetch

```javascript
const res = await fetch('https://<org>.api-<region>.k9o.io/@storefront/identity-providers/<epcId>', {
  method: 'PATCH',
  headers: {
    'Authorization': `Bearer ${process.env.K9O_TOKEN}`,
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
  "displayName": "My Resource",
  "clientId": "string",
  "clientSecretRef": "string",
  "redirectUri": "string",
  "metadataUrl": null,
  "attributeMap": {},
  "enabled": true
}),
});
const { data, meta } = await res.json();
```

### k9o CLI

```bash
k9o org idp configure
```

### @k9o/core

```typescript
// const k9o = new K9o({ orgSlug: 'playground', projectSlug: 'storefront', apiKey: 'k9o_…' })
const { data } = await k9o.org.gate.idpProviders.configure('epc_demo00000001', {
  displayName: 'My Resource',
  clientId: 'string',
  clientSecretRef: 'string',
  redirectUri: 'string',
  metadataUrl: null,
  attributeMap: {},
  enabled: true
})
```

### k9o

```python
# k9o = create_client(org_slug="playground", project_slug="storefront", api_key="k9o_…")
response = k9o.org.gate.idp_providers.configure("epc_demo00000001", {
    "displayName": "My Resource",
    "clientId": "string",
    "clientSecretRef": "string",
    "redirectUri": "string",
    "metadataUrl": None,
    "attributeMap": {},
    "enabled": True
})
```

### sdk-go

```go
// ctx := context.Background()
// client, _ := k9o.NewClient(k9o.ClientOpts{OrgSlug: "playground", ProjectSlug: "storefront", APIKey: "k9o_…"})
data, _, kerr := client.Org.Gate.IdpProviders.Configure(ctx, "epc_demo00000001", map[string]any{"displayName": "My Resource", "clientId": "string", "clientSecretRef": "string", "redirectUri": "string", "metadataUrl": nil, "attributeMap": map[string]any{}, "enabled": true})
```

### k9o

```rust
// let k9o = Client::new(ClientOpts { org_slug: "playground".into(), project_slug: "storefront".into(), api_key: "k9o_…".into() })?;
let resp = k9o.org.gate.idp_providers.configure("epc_demo00000001", json!({"displayName": "My Resource", "clientId": "string", "clientSecretRef": "string", "redirectUri": "string", "metadataUrl": null, "attributeMap": json!({}), "enabled": true})).await?
```

### dev.k9o:core

```java
// K9o k9o = K9o.createClient(K9o.Opts.builder().orgSlug("playground").projectSlug("storefront").apiKey("k9o_…").build());
var response = k9o.org().gate().idpProviders().configure("epc_demo00000001", Map.of("displayName", "My Resource", "clientId", "string", "clientSecretRef", "string", "redirectUri", "string", "metadataUrl", null, "attributeMap", Map.of(), "enabled", true))
```

### K9o.Core

```c#
// var k9o = K9oClient.Create(new K9oOptions { OrgSlug = "playground", ProjectSlug = "storefront", ApiKey = "k9o_…" });
var response = await k9o.Org.Gate.IdpProviders.ConfigureAsync("epc_demo00000001", new Dictionary<string, object> { ["displayName"] = "My Resource", ["clientId"] = "string", ["clientSecretRef"] = "string", ["redirectUri"] = "string", ["metadataUrl"] = null, ["attributeMap"] = new Dictionary<string, object> {  }, ["enabled"] = true })
```

### k9o

```ruby
# k9o = K9o.create_client(org_slug: "playground", project_slug: "storefront", api_key: "k9o_…")
response = k9o.org.gate.idp_providers.configure("epc_demo00000001", { displayName: "My Resource", clientId: "string", clientSecretRef: "string", redirectUri: "string", metadataUrl: nil, attributeMap: {  }, enabled: true })
```

### k9o/sdk

```php
// $k9o = K9oClient::create(['org_slug' => 'playground', 'project_slug' => 'storefront', 'api_key' => 'k9o_…']);
$response = $k9o->org->gate->idp_providers->configure('epc_demo00000001', ['displayName' => 'My Resource', 'clientId' => 'string', 'clientSecretRef' => 'string', 'redirectUri' => 'string', 'metadataUrl' => null, 'attributeMap' => [], 'enabled' => true])
```


Canonical page: https://docs.kilimanjaro.dev/api-playground/identity-access/update-identity-provider
