---
title: "Update a directory"
method: PATCH
path: "/directories/{directory_id}"
tags: ["Directories"]
---

# Update a directory

`PATCH /directories/{directory_id}`

Updates a directory.

## Path parameters

- `directory_id` string, required

## Request body

- object
  - `name` string — A human-friendly name for the directory.
  - `enabled` boolean — Whether the directory is enabled.
  - `provider` string — The identity provider for this directory.
  - `attribute_mapping` object — Attribute-to-directory-path entries to merge into the directory's attribute mapping. Set a key to `null` to remove it from the mapping.
  - `group_role_mapping_enabled` boolean — Whether group-to-role mapping is enabled for this directory.

## Response `200`

A directory

- Directory — A directory configuration for provisioning users from an identity provider.
  - `object` 'directory', required — String representing the object's type. Always "directory".
  - `id` string, required — Unique identifier for the directory.
  - `name` string, required — A human-friendly name for the directory.
  - `enterprise_connection_id` string, nullable — The ID of the associated enterprise connection.
  - `endpoint_url` string, required — The provisioning endpoint URL for this directory.
  - `provider` string, required — The identity provider for this directory.
  - `enabled` boolean, required — Whether the directory is enabled.
  - `group_role_mapping_enabled` boolean, required — Whether group-to-role mapping is enabled for this directory.
  - `attribute_mapping` object, required — Mapping of user attributes to the directory attribute paths they are extracted from.
  - `custom_attributes` object[] — Custom attributes to map from the IdP to the user's profile via directory sync. Requires the custom attributes feature to be enabled for the instance.
    - `name` string — Display name for the custom attribute
    - `key` string — Key used to store the attribute in the user's public/private/unsafe metadata
    - `sso_path` string — Path to extract the attribute value from SSO claims (SAML assertions or OIDC claims)
    - `scim_path` string — The legacy name for `directory_path`. Carries the same value.
    - `directory_path` string — GJSON path to extract the attribute value from directory sync user resources
    - `multi_valued` boolean — When true, the attribute supports multiple values; values from the IdP are written to public_metadata as an array. Defaults to false.
  - `api_key` string, nullable — The API key for authenticating provisioning requests. Only returned when the directory is created or the key is rotated.
  - `created_at` integer, required — Unix timestamp when the directory was created.
  - `updated_at` integer, required — Unix timestamp when the directory was last updated.

## Other responses

- `400` — Request was not successful
- `401` — Authentication invalid
- `403` — Authorization invalid
- `404` — Resource not found
- `422` — Invalid request parameters

---

[API](https://skmtc.net/clerk/apis/clerk-backend-api.md) · [All operations](https://skmtc.net/clerk/apis/clerk-backend-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/clerk/clerk-backend-api/revisions/7d969765e49a/schema)
