Skip to content

Claim Mappers

import { Aside } from ‘@astrojs/starlight/components’;

Claim mappers are tenant-level rules that project user attributes into JWT access and/or ID tokens. Each mapper connects one attribute key to one claim name, with toggles for which token types include the claim.

Required scopes: claim_mappers:read for GET, claim_mappers:write for PUT and DELETE.


{
"attributeKey": "plan",
"claimName": "billing_plan",
"includeInAccess": true,
"includeInId": false
}
FieldTypeDescription
attributeKeystringThe user attribute key this mapper reads from
claimNamestringThe JWT claim name the value is projected into (max 128 chars)
includeInAccessbooleanWhether to include in access tokens
includeInIdbooleanWhether to include in ID tokens

GET /t/{slug}/api/v1/claim-mappers

Returns all claim mappers configured for the workspace.

Example request:

Terminal window
curl https://auth.yourdomain.com/t/my-app/api/v1/claim-mappers \
-H "Authorization: Bearer kauth_my-app_KEY"

Response 200 OK:

{
"mappers": [
{
"attributeKey": "plan",
"claimName": "billing_plan",
"includeInAccess": true,
"includeInId": false
},
{
"attributeKey": "department",
"claimName": "org_department",
"includeInAccess": true,
"includeInId": true
}
]
}

PUT /t/{slug}/api/v1/claim-mappers/{attributeKey}

Creates the mapper if it does not exist, or updates it if it does. This is an upsert operation.

Path parameters:

ParameterTypeDescription
attributeKeystringThe user attribute key to map

Request body:

{
"claimName": "billing_plan",
"includeInAccess": true,
"includeInId": false
}
FieldTypeRequiredDefaultDescription
claimNamestringYesJWT claim name (max 128 chars, must not be a reserved claim)
includeInAccessbooleanNotrueInclude this claim in access tokens
includeInIdbooleanNofalseInclude this claim in ID tokens

Example request:

Terminal window
curl -X PUT https://auth.yourdomain.com/t/my-app/api/v1/claim-mappers/plan \
-H "Authorization: Bearer kauth_my-app_KEY" \
-H "Content-Type: application/json" \
-d '{"claimName": "billing_plan", "includeInAccess": true, "includeInId": false}'

Response 204 No Content

Error responses:

StatusCondition
400 Bad RequestClaim name is a reserved OIDC/KotAuth claim (sub, iss, email, etc.)
409 ConflictAnother mapper already uses this claim name, or the 20-mapper limit is reached
422 Unprocessable EntityClaim name exceeds 128 characters or is empty

DELETE /t/{slug}/api/v1/claim-mappers/{attributeKey}

Removes the mapper. The mapped claim will no longer appear in newly issued tokens. Existing tokens are unaffected until they expire.

Path parameters:

ParameterTypeDescription
attributeKeystringThe attribute key of the mapper to remove

Example request:

Terminal window
curl -X DELETE https://auth.yourdomain.com/t/my-app/api/v1/claim-mappers/plan \
-H "Authorization: Bearer kauth_my-app_KEY"

Response 204 No Content

Error responses:

StatusCondition
404 Not FoundNo mapper exists for this attribute key