---
title: "Create an identity for a principal"
method: POST
path: "/v2/directories/{directoryId}/principals/{principalId}/identities"
tags: ["KongPrincipalIdentity"]
---

# Create an identity for a principal

`POST /v2/directories/{directoryId}/principals/{principalId}/identities`

## Request

- Base URL: `https://global.api.konghq.com`
- URL: `https://global.api.konghq.com/v2/directories/{directoryId}/principals/{principalId}/identities`
- Auth: one of:
  - HTTP bearer
  - HTTP bearer
  - HTTP bearer
  - HTTP bearer

Creates a new identity association for the specified principal.

## Path parameters

- `directoryId` string, uuid, required
- `principalId` string, uuid, required

## Request body

- union
  - KongPrincipalIdentityOIDC
    - `id` string, uuid: Contains a unique identifier used for this resource.
    - `labels` Labels: Labels store metadata of an entity that can be used for filtering an entity list or for searching across entity types. Keys must be of length 1-63 characters, and cannot start with "kong", "konnect", "mesh", "kic", or "_".
    - `managed_by` ManagedBy: Stores information about what manages this entity, such as the tool or system responsible for its lifecycle (for example, `terraform`). Keys must be 1–63 characters long, start and end with an alphanumeric character, and may contain dashes (`-`), underscores (`_`), and dots (`.`). Values must be 1–127 characters long and must not be empty. Keys and values must not contain spaces or control characters.
    - `created_at` string, date-time: An ISO-8601 timestamp representation of entity creation date.
    - `updated_at` string, date-time: An ISO-8601 timestamp representation of entity update date.
    - `type` 'oidc', required
    - `issuer` string, required
    - `claim` object, required
      - `name` string, required
      - `value` string, required
  - KongPrincipalIdentityAuthServerClient
    - `id` string, uuid: Contains a unique identifier used for this resource.
    - `labels` Labels: Labels store metadata of an entity that can be used for filtering an entity list or for searching across entity types. Keys must be of length 1-63 characters, and cannot start with "kong", "konnect", "mesh", "kic", or "_".
    - `managed_by` ManagedBy: Stores information about what manages this entity, such as the tool or system responsible for its lifecycle (for example, `terraform`). Keys must be 1–63 characters long, start and end with an alphanumeric character, and may contain dashes (`-`), underscores (`_`), and dots (`.`). Values must be 1–127 characters long and must not be empty. Keys and values must not contain spaces or control characters.
    - `created_at` string, date-time: An ISO-8601 timestamp representation of entity creation date.
    - `updated_at` string, date-time: An ISO-8601 timestamp representation of entity update date.
    - `type` 'auth_server_client', required
    - `auth_server_id` string, uuid, required
    - `client_id` string, required
  - KongPrincipalIdentityCPConsumer
    - `id` string, uuid: Contains a unique identifier used for this resource.
    - `labels` Labels: Labels store metadata of an entity that can be used for filtering an entity list or for searching across entity types. Keys must be of length 1-63 characters, and cannot start with "kong", "konnect", "mesh", "kic", or "_".
    - `managed_by` ManagedBy: Stores information about what manages this entity, such as the tool or system responsible for its lifecycle (for example, `terraform`). Keys must be 1–63 characters long, start and end with an alphanumeric character, and may contain dashes (`-`), underscores (`_`), and dots (`.`). Values must be 1–127 characters long and must not be empty. Keys and values must not contain spaces or control characters.
    - `created_at` string, date-time: An ISO-8601 timestamp representation of entity creation date.
    - `updated_at` string, date-time: An ISO-8601 timestamp representation of entity update date.
    - `type` 'control_plane_consumer', required
    - `control_plane_id` string, required
    - `consumer_id` string, required
    - `workspace_id` string, nullable
  - KongPrincipalIdentityCustom
    - `id` string, uuid: Contains a unique identifier used for this resource.
    - `labels` Labels: Labels store metadata of an entity that can be used for filtering an entity list or for searching across entity types. Keys must be of length 1-63 characters, and cannot start with "kong", "konnect", "mesh", "kic", or "_".
    - `managed_by` ManagedBy: Stores information about what manages this entity, such as the tool or system responsible for its lifecycle (for example, `terraform`). Keys must be 1–63 characters long, start and end with an alphanumeric character, and may contain dashes (`-`), underscores (`_`), and dots (`.`). Values must be 1–127 characters long and must not be empty. Keys and values must not contain spaces or control characters.
    - `created_at` string, date-time: An ISO-8601 timestamp representation of entity creation date.
    - `updated_at` string, date-time: An ISO-8601 timestamp representation of entity update date.
    - `type` 'custom', required
    - `key` string, required
    - `value` string, required

## Response `201`

A principal identity

- union
  - KongPrincipalIdentityOIDCResponse
    - `id` string, uuid, required: Contains a unique identifier used for this resource.
    - `labels` Labels, required: Labels store metadata of an entity that can be used for filtering an entity list or for searching across entity types. Keys must be of length 1-63 characters, and cannot start with "kong", "konnect", "mesh", "kic", or "_".
    - `managed_by` ManagedBy, required: Stores information about what manages this entity, such as the tool or system responsible for its lifecycle (for example, `terraform`). Keys must be 1–63 characters long, start and end with an alphanumeric character, and may contain dashes (`-`), underscores (`_`), and dots (`.`). Values must be 1–127 characters long and must not be empty. Keys and values must not contain spaces or control characters.
    - `created_at` string, date-time, required: An ISO-8601 timestamp representation of entity creation date.
    - `updated_at` string, date-time, required: An ISO-8601 timestamp representation of entity update date.
    - `type` 'oidc', required
    - `issuer` string, required
    - `claim` object, required
      - `name` string, required
      - `value` string, required
  - KongPrincipalIdentityAuthServerClientResponse
    - `id` string, uuid, required: Contains a unique identifier used for this resource.
    - `labels` Labels, required: Labels store metadata of an entity that can be used for filtering an entity list or for searching across entity types. Keys must be of length 1-63 characters, and cannot start with "kong", "konnect", "mesh", "kic", or "_".
    - `managed_by` ManagedBy, required: Stores information about what manages this entity, such as the tool or system responsible for its lifecycle (for example, `terraform`). Keys must be 1–63 characters long, start and end with an alphanumeric character, and may contain dashes (`-`), underscores (`_`), and dots (`.`). Values must be 1–127 characters long and must not be empty. Keys and values must not contain spaces or control characters.
    - `created_at` string, date-time, required: An ISO-8601 timestamp representation of entity creation date.
    - `updated_at` string, date-time, required: An ISO-8601 timestamp representation of entity update date.
    - `type` 'auth_server_client', required
    - `auth_server_id` string, uuid, required
    - `client_id` string, required
  - KongPrincipalIdentityCPConsumerResponse
    - `id` string, uuid, required: Contains a unique identifier used for this resource.
    - `labels` Labels, required: Labels store metadata of an entity that can be used for filtering an entity list or for searching across entity types. Keys must be of length 1-63 characters, and cannot start with "kong", "konnect", "mesh", "kic", or "_".
    - `managed_by` ManagedBy, required: Stores information about what manages this entity, such as the tool or system responsible for its lifecycle (for example, `terraform`). Keys must be 1–63 characters long, start and end with an alphanumeric character, and may contain dashes (`-`), underscores (`_`), and dots (`.`). Values must be 1–127 characters long and must not be empty. Keys and values must not contain spaces or control characters.
    - `created_at` string, date-time, required: An ISO-8601 timestamp representation of entity creation date.
    - `updated_at` string, date-time, required: An ISO-8601 timestamp representation of entity update date.
    - `type` 'control_plane_consumer', required
    - `control_plane_id` string, required
    - `consumer_id` string, required
    - `workspace_id` string, nullable
    - `control_plane_type` 'api_gateway' | 'ai_gateway', required: The kind of control plane the linked consumer was found in.
  - KongPrincipalIdentityCustomResponse
    - `id` string, uuid, required: Contains a unique identifier used for this resource.
    - `labels` Labels, required: Labels store metadata of an entity that can be used for filtering an entity list or for searching across entity types. Keys must be of length 1-63 characters, and cannot start with "kong", "konnect", "mesh", "kic", or "_".
    - `managed_by` ManagedBy, required: Stores information about what manages this entity, such as the tool or system responsible for its lifecycle (for example, `terraform`). Keys must be 1–63 characters long, start and end with an alphanumeric character, and may contain dashes (`-`), underscores (`_`), and dots (`.`). Values must be 1–127 characters long and must not be empty. Keys and values must not contain spaces or control characters.
    - `created_at` string, date-time, required: An ISO-8601 timestamp representation of entity creation date.
    - `updated_at` string, date-time, required: An ISO-8601 timestamp representation of entity update date.
    - `type` 'custom', required
    - `key` string, required
    - `value` string, required

## Other responses

- `400`: Bad Request
- `401`: Unauthorized
- `403`: Forbidden
- `404`: Not Found
- `409`: Conflict

## Changes

- **2026-12-03** `9c8d300657bd`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/kong/apis/konnect-api-beta/changes/v2/directories/:directoryId/principals/:principalId/identities/post.md)

---

[API](https://skmtc.dev/kong/apis/konnect-api-beta.md) - [All operations](https://skmtc.dev/kong/apis/konnect-api-beta/llms.txt) - [OpenAPI document](https://skmtc.dev/kong/apis/konnect-api-beta/revisions/9c8d300657bd?raw)
