Pular para o conteúdo principal

Identify

POST /agent/identify

Upserts who the app's current user is — a name and a handful of free-form identifiers — so that if the conversation is escalated to a human, your support queue can show a real person instead of an opaque session id.

Auth: required.

This endpoint is write-only and scoped to the calling project: it can only upsert the user the request claims to be. It cannot read, list, or delete the identity registry — that's a dashboard-only capability. See Dashboard: Projects & API keys and the rest of the Dashboard section for operator-side user management.

Body

FieldTypeRequiredDescription
userIdstringYesYour identifier for the user.
namestringNoDisplay name to show in escalation/operator tooling.
identifiersobject (Record<string, string>)NoFree-form lookup keys, e.g. email, phone. Keep this to a handful of fields.

A request that fails body validation (e.g. missing userId) returns 422 with error.code: "VALIDATION_ERROR".

Response — 200

{
"success": true,
"data": { "identified": true }
}

Privacy

User identifiers are never sent to the model.

curl

curl https://api.appilots.com/api/v1/agent/identify \
-X POST \
-H "Authorization: Bearer ak_xxxxxxxxxxxx..." \
-H "Content-Type: application/json" \
-d '{
"userId": "user_123",
"name": "Jordan Lee",
"identifiers": { "email": "jordan@example.com" }
}'

TypeScript

const res = await fetch("https://api.appilots.com/api/v1/agent/identify", {
method: "POST",
headers: {
Authorization: "Bearer ak_xxxxxxxxxxxx...",
"Content-Type": "application/json",
},
body: JSON.stringify({
userId: "user_123",
name: "Jordan Lee",
identifiers: { email: "jordan@example.com" },
}),
});
const { data } = await res.json();