Overview
Create a new subject (user, agent, API key, or service). Optionally add the subject to scopes and assign roles in a single request using inline memberships.
ID Format : All IDs use a namespaced UUIDv7 format: subject_{uuidv7}. You can optionally provide your own ID.
Request Body
Optional client-provided ID. Format: subject_{uuidv7}
Subject type. One of: user, api_key, service, agent
External identifier for the subject (e.g., user ID from your auth system)
Display name for the subject
Optional metadata to associate with the subject
Optional inline memberships with role assignments. Creates memberships and role assignments in a single request.
ID of the scope to add the subject to
Optional array of role IDs to assign to the membership
Response
Returns the created subject object. If memberships were provided, includes the created memberships with their role assignments.
cURL (Basic)
cURL (With Memberships)
Node.js
curl -X POST 'https://api.example.com/subjects' \
-H 'Authorization: Bearer YOUR_TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"subjectType": "user",
"externalId": "user-456",
"displayName": "John Doe",
"meta": {"email": "john@example.com"}
}'
Basic Response
Response with Memberships
{
"id" : "subject_0190a1b2-c3d4-7e5f-8a9b-0c1d2e3f4a5b" ,
"subjectType" : "user" ,
"externalId" : "user-456" ,
"displayName" : "John Doe" ,
"meta" : { "email" : "john@example.com" }
}