---
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
    - [`KongPrincipalIdentityBase`](https://skmtc.dev/kong/apis/konnect-api-go-sdk/revisions/3b071797f6e4/schema?at=%2Fcomponents%2Fschemas%2FKongPrincipalIdentityBase)
    - object
      - `type` 'oidc', required
      - `issuer` string, required
      - `claim` object, required
        - `name` string, required
        - `value` string, required
  - KongPrincipalIdentityAuthServerClient
    - [`KongPrincipalIdentityBase`](https://skmtc.dev/kong/apis/konnect-api-go-sdk/revisions/3b071797f6e4/schema?at=%2Fcomponents%2Fschemas%2FKongPrincipalIdentityBase)
    - object
      - `type` 'auth_server_client', required
      - `auth_server_id` string, uuid, required
      - `client_id` string, required
  - KongPrincipalIdentityCPConsumer
    - [`KongPrincipalIdentityBase`](https://skmtc.dev/kong/apis/konnect-api-go-sdk/revisions/3b071797f6e4/schema?at=%2Fcomponents%2Fschemas%2FKongPrincipalIdentityBase)
    - object
      - `type` 'control_plane_consumer', required
      - `control_plane_id` string, required
      - `consumer_id` string, required
      - `workspace_id` string
  - KongPrincipalIdentityCustom
    - [`KongPrincipalIdentityBase`](https://skmtc.dev/kong/apis/konnect-api-go-sdk/revisions/3b071797f6e4/schema?at=%2Fcomponents%2Fschemas%2FKongPrincipalIdentityBase)
    - object
      - `type` 'custom', required
      - `key` string, required
      - `value` string, required

## Response `201`

A principal identity

- union
  - KongPrincipalIdentityOIDCResponse
    - [`KongPrincipalIdentityResponseBase`](https://skmtc.dev/kong/apis/konnect-api-go-sdk/revisions/3b071797f6e4/schema?at=%2Fcomponents%2Fschemas%2FKongPrincipalIdentityResponseBase)
    - object
      - `type` 'oidc', required
      - `issuer` string, required
      - `claim` object, required
        - `name` string, required
        - `value` string, required
  - KongPrincipalIdentityAuthServerClientResponse
    - [`KongPrincipalIdentityResponseBase`](https://skmtc.dev/kong/apis/konnect-api-go-sdk/revisions/3b071797f6e4/schema?at=%2Fcomponents%2Fschemas%2FKongPrincipalIdentityResponseBase)
    - object
      - `type` 'auth_server_client', required
      - `auth_server_id` string, uuid, required
      - `client_id` string, required
  - KongPrincipalIdentityCPConsumerResponse
    - [`KongPrincipalIdentityResponseBase`](https://skmtc.dev/kong/apis/konnect-api-go-sdk/revisions/3b071797f6e4/schema?at=%2Fcomponents%2Fschemas%2FKongPrincipalIdentityResponseBase)
    - object
      - `type` 'control_plane_consumer', required
      - `control_plane_id` string, required
      - `consumer_id` string, required
      - `workspace_id` string
      - `control_plane_type` 'api_gateway' | 'ai_gateway', required: The kind of control plane the linked consumer was found in.
  - KongPrincipalIdentityCustomResponse
    - [`KongPrincipalIdentityResponseBase`](https://skmtc.dev/kong/apis/konnect-api-go-sdk/revisions/3b071797f6e4/schema?at=%2Fcomponents%2Fschemas%2FKongPrincipalIdentityResponseBase)
    - object
      - `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-11-16** `a209c8bfa7b7`: 8 breaking, 8 info
  - the `type` request property const value `auth_server_client` was added
  - the `type` request property const value `control_plane_consumer` was added
  - the `type` request property const value `custom` was added
  - the `type` request property const value `oidc` was added
  - …12 more
- **2026-11-12** `d8bd04cfbaf7`: 12 breaking, 8 warning, 16 info
  - request property `oneOf[#/components/schemas/KongPrincipalIdentityAuthServerClient]/allOf[subschema #2]/type` was restricted to a list of enum values
  - request property `oneOf[#/components/schemas/KongPrincipalIdentityCPConsumer]/allOf[subschema #2]/type` was restricted to a list of enum values
  - request property `oneOf[#/components/schemas/KongPrincipalIdentityCustom]/allOf[subschema #2]/type` was restricted to a list of enum values
  - request property `oneOf[#/components/schemas/KongPrincipalIdentityOIDC]/allOf[subschema #2]/type` was restricted to a list of enum values
  - …32 more
- **2026-11-05** `ff8439091e5f`: 8 breaking, 8 info
  - the `type` request property const value `auth_server_client` was added
  - the `type` request property const value `control_plane_consumer` was added
  - the `type` request property const value `custom` was added
  - the `type` request property const value `oidc` was added
  - …12 more
- …earlier changes not shown

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

---

[API](https://skmtc.dev/kong/apis/konnect-api-go-sdk.md) - [All operations](https://skmtc.dev/kong/apis/konnect-api-go-sdk/llms.txt) - [OpenAPI document](https://skmtc.dev/kong/apis/konnect-api-go-sdk/revisions/3b071797f6e4?raw)
