Skip to main content

Session verification

A personal agent sends the Poppy-Session header to your APIs, not to LumoAuth. The header is a JWT that the agent signs for that one request. Verifying it takes a metadata fetch, two signature checks and a Session record. LumoAuth does all of it in one call.

This page is part of Personal Agent Protocol. To control an OpenClaw or Hermes agent on your own machine, see Secure OpenClaw and Hermes agents instead.

POST /orgs/{orgId}/api/v1/poppy/sessions/verify
POST /orgs/{orgId}/api/v1/poppy/sessions/status
POST /orgs/{orgId}/api/v1/poppy/sessions/end

On a custom domain the paths are /api/v1/poppy/sessions/verify, /api/v1/poppy/sessions/status and /api/v1/poppy/sessions/end.

Who may call it​

Your service authenticates as one of your organization's confidential applications. Use HTTP Basic with the client id and secret, client_id and client_secret in the JSON body, or a private_key_jwt client assertion in the body.

The application's allowed scopes must include poppy:verify. Add the scope under Applications, on the application that your API uses. An administrator gives this permission on purpose: an application without it gets 403 insufficient_scope.

A personal agent can never call these endpoints. A client with a metadata document, or a public client, gets 401 invalid_client.

Verify a request​

Forward what you received: the method, the public URL and the protocol's headers.

curl -X POST https://app.lumoauth.dev/orgs/acme-corp/api/v1/poppy/sessions/verify \
-u "$SHOP_API_CLIENT_ID:$SHOP_API_CLIENT_SECRET" \
-H "Content-Type: application/json" \
-d '{
"method": "POST",
"url": "https://shop.example.com/api/orders/ord_1042/return",
"headers": {
"poppy-session": "eyJ0eXAiOiJwb3BweS1zZXNzaW9uK2p3dCIs…",
"poppy-version": "1.0",
"authorization": "Bearer eyJhbGciOi…Qp4w"
},
"required_scope": "orders:write"
}'
MemberRequiredMeaning
methodYesThe method of the request that you received.
urlYesThe address that the personal agent called, without the query. It must be https://. An http:// address is accepted only for localhost, 127.0.0.1 and [::1], so that you can run your API on your own machine.
headersYesThe request's headers by name, in any case. LumoAuth reads poppy-session, poppy-version, poppy-extensions, authorization and dpop. No other header is used.
required_scopeNoThe scopes that the operation needs: a space-separated string or a list.
resourceNoThe resource identifier of your service, when it takes only tokens issued for it. See Tokens for one service.
allow_replayNotrue accepts a Session JWT that was verified before. See Replays.

The answer is always 200 when your own call is valid. active says whether the request is verified.

A verified signed-out request​

{
"active": true,
"client_id": "https://agent.example/agent.json",
"client_name": "Example Agent",
"user_id": "usr_Q7c1vK",
"agent_id": null,
"session": {
"id": 4821,
"sid": "Yx2b7Qd_Kp8mR3vT1nWc4A",
"new": true,
"started_at": "2026-11-26T10:15:00+00:00"
},
"signed_in": false,
"account": null,
"version": "1.0",
"extensions": {}
}
MemberMeaning
client_id, client_nameThe personal agent. The name is the agent's own claim. The client_id is what was checked.
user_idThe agent's stable name for its user at your company. It is not an account.
agent_idSet when the personal agent runs several agents for one user and says which one this is.
session.idLumoAuth's id of the Session. Store your own Session state under it, such as a cart.
session.newtrue when this request started the Session.
signed_in, accountWhether the request carried a valid access token, and whose it is.
versionThe Poppy-Version of the request.
extensionsThe extensions that the request declares, as name and version.

A verified signed-in request​

{
"active": true,
"client_id": "https://agent.example/agent.json",
"client_name": "Example Agent",
"user_id": "usr_Q7c1vK",
"agent_id": null,
"session": {
"id": 4821,
"sid": "Yx2b7Qd_Kp8mR3vT1nWc4A",
"new": false,
"started_at": "2026-11-26T10:15:00+00:00"
},
"signed_in": true,
"account": {
"sub": "0193a5c2-7d1e-7c7a-9a52-3f0f2b6c9e11",
"scope": "orders:read orders:write",
"aud": ["https://agent.example/agent.json"],
"exp": 1795000000,
"token_type": "Bearer"
},
"version": "1.0",
"extensions": {}
}

account.sub is the id of the user in your LumoAuth organization. account.scope holds the scopes of the access token. When you pass required_scope, LumoAuth has already checked them.

A rejection​

A rejection carries the protocol's error and the exact response for the personal agent:

{
"active": false,
"error": "invalid_session",
"error_description": "The Session JWT was signed for another URL (htu).",
"response": {
"status": 400,
"headers": { "Cache-Control": "no-store" },
"body": {
"error": "invalid_session",
"error_description": "The Session JWT was signed for another URL (htu)."
}
}
}

Return response unchanged: its status, its headers and its body. The protocol puts Session errors in a JSON body with status 400. It puts access token errors in WWW-Authenticate with no body, so body is then null.

errorresponse.statusresponse carriesWhen
invalid_session400JSON bodyThe header is missing or a check failed. Also when you do not accept the agent, or its token was issued to another client.
session_ended400JSON bodyThe Session was ended, or the request names another account than the Session used.
version_unsupported400JSON bodyPoppy-Version is missing or not compatible with 1.0.
account_required401WWW-Authenticate: Bearer scope="…"You passed required_scope and the request has no access token. The result also has scope.
invalid_token401WWW-Authenticate: Bearer error="invalid_token", …The access token is expired, revoked, not for your service, or its DPoP proof is missing or wrong.
insufficient_scope403WWW-Authenticate: Bearer error="insufficient_scope", scope="…"The access token lacks a scope of required_scope. The result also has scope.
too_many_requests429Retry-After, JSON bodyThe personal agent started too many Sessions.

Relay the answer​

One function in front of your API does the whole job.

const VERIFY_URL = 'https://app.lumoauth.dev/orgs/acme-corp/api/v1/poppy/sessions/verify';
const PUBLIC_ORIGIN = 'https://shop.example.com';
const BASIC = 'Basic ' + Buffer.from(
`${process.env.SHOP_API_CLIENT_ID}:${process.env.SHOP_API_CLIENT_SECRET}`,
).toString('base64');
const FORWARDED = ['poppy-session', 'poppy-version', 'poppy-extensions', 'authorization', 'dpop'];

// Express middleware. Use it as: app.get('/api/orders', poppy('orders:read'), handler)
function poppy(requiredScope = '') {
return async (req, res, next) => {
const headers = {};
for (const name of FORWARDED) {
if (typeof req.headers[name] === 'string') headers[name] = req.headers[name];
}
const answer = await fetch(VERIFY_URL, {
method: 'POST',
headers: { 'Content-Type': 'application/json', Authorization: BASIC },
body: JSON.stringify({
method: req.method,
// The path as the personal agent sent it: req.path is relative to a router's mount point.
url: PUBLIC_ORIGIN + req.originalUrl.split('?')[0],
headers,
...(requiredScope ? { required_scope: requiredScope } : {}),
}),
});
if (answer.status !== 200) return next(new Error(`Verification failed: ${answer.status}`));

const who = await answer.json();
if (!who.active) {
// The response that the personal agent must get, unchanged.
res.status(who.response.status).set(who.response.headers);
return who.response.body === null ? res.end() : res.json(who.response.body);
}
req.poppy = who; // who.client_id, who.user_id, who.session.id, who.account
next();
};
}

A status other than 200 from the verification endpoint is about your call, not about the personal agent. Do not relay it. Answer the personal agent with a 5xx status and fix your configuration.

What LumoAuth checks​

The checks run in this order. Each failure is invalid_session unless the list says otherwise.

  1. Shape. The JWT has typ poppy-session+jwt, alg ES256, a kid and a delegation in poppy_dlg. Every required claim is present.
  2. Audience. aud is your Company identifier, character for character, as one string.
  3. The request. htm is the method and htu is the URL that you sent. iat is at most 60 seconds old, with 30 seconds of clock skew.
  4. The token binding. ath is the hash of the access token. Without a token, ath is absent.
  5. The personal agent. LumoAuth fetches its metadata document and applies your allowed domains and blocks.
  6. The delegation. A key of the agent's key set signed it, with ES256 or PS384. Its typ is poppy-delegation+jwt, its iss is the JWT's iss, it has not expired, and it lasts at most 24 hours.
  7. The signature. The key in the delegation's cnf.jwk signed the Session JWT, and kid is that key's thumbprint. A Session JWT that a key of the key set signed directly is rejected.
  8. The version. Poppy-Version is compatible with 1.0, or the answer is version_unsupported.
  9. Replay. The JWT was not verified before.
  10. The access token. It is active, it was issued to the JWT's iss, and it may be used at your service. A wrong token is invalid_token. Then LumoAuth applies required_scope.
  11. The Session. LumoAuth starts it or continues it, or answers session_ended.

LumoAuth also rejects a delegated key that signed for one User ID and then signs for another.

The public URL​

htu is the address that the personal agent used. Behind a proxy or a load balancer, your server sees another host or path. Build url from your configured public origin and the request path. Never build it from the Host header.

Use the path as the personal agent sent it. Many frameworks also offer a path that is already decoded, or a path relative to the place where a router is mounted. Neither one equals htu for every request. In Express, use req.originalUrl without the query, not req.path.

LumoAuth verifies an address of up to 2,048 characters. A longer one is rejected with invalid_session.

Replays​

A Session JWT is good for one verification. A second call with the same JWT gets invalid_session. Verify each request once, at your gateway or in one middleware, and pass the result inward.

Some services check one request in several places. For those, send "allow_replay": true. A copied JWT then still works only for the same method, URL and access token, and only for about a minute. Make your writes safe to repeat.

DPoP​

When the access token is bound to a DPoP key, include the dpop header. LumoAuth verifies the proof against the method and URL that you sent. A missing or wrong proof is invalid_token, and the response carries a DPoP challenge next to the Bearer one. account.token_type says whether the token is DPoP or Bearer.

Tokens for one service​

By default one access token works at all of your services. A service that takes only tokens issued for it publishes its own protected resource metadata. An MCP server does that.

Such a service passes its resource identifier:

{
"method": "POST",
"url": "https://mcp.shop.example.com/mcp",
"headers": { "poppy-session": "…", "poppy-version": "1.0", "authorization": "Bearer …" },
"resource": "https://mcp.shop.example.com/mcp"
}
  • With resource, the token's audience must contain that value. The default token is rejected with invalid_token.
  • Without resource, LumoAuth accepts the default token and a token for one of your Company domains. A token that was issued for another service is rejected.

The personal agent gets a token for your service with resource on its token request. See Tokens for one service.

End a Session​

End a Session when your own rules call for it, for example after a fraud signal. Later requests with its sid get session_ended, and the personal agent starts a new Session. The user stays signed in.

curl -X POST https://app.lumoauth.dev/orgs/acme-corp/api/v1/poppy/sessions/end \
-u "$SHOP_API_CLIENT_ID:$SHOP_API_CLIENT_SECRET" \
-H "Content-Type: application/json" \
-d '{
"personal_agent": "https://agent.example/agent.json",
"sid": "Yx2b7Qd_Kp8mR3vT1nWc4A"
}'
{ "ended": true }

ended is false when the Session had ended before. An unknown Session gets 404 not_found. An administrator can also end a Session under AI Agents → Personal agents → Sessions, or through the Admin API.

To end an agent's access to an account, do not end its Sessions. Revoke its tokens or block the agent, as Client ID Metadata Documents describes.

Look up a Session​

Sometimes you must know the state of a Session when the personal agent sent no request. The main case is a website that joined a browser to a Session. Its cookie must stop acting for the account when the user signs out or disconnects the personal agent. Ask LumoAuth on each page request.

curl -X POST https://app.lumoauth.dev/orgs/acme-corp/api/v1/poppy/sessions/status \
-u "$SHOP_API_CLIENT_ID:$SHOP_API_CLIENT_SECRET" \
-H "Content-Type: application/json" \
-d '{
"personal_agent": "https://agent.example/agent.json",
"sid": "Yx2b7Qd_Kp8mR3vT1nWc4A"
}'
{
"status": "active",
"user_id": "usr_Q7c1vK",
"agent_id": null,
"account": "0195c7e2-5b1c-7d41-9a3e-0f6c2b7a9d10",
"signed_in": true,
"last_seen_at": "2026-11-26T10:15:00+00:00"
}
FieldMeaning
statusactive, ended, or unknown when no Session has that sid. A Session that nothing used for the idle period is forgotten, and is unknown after that.
accountThe id of the account that the Session used, or null.
signed_intrue while the Session is active, it used an account, and the personal agent still holds a valid refresh token for that account.

signed_in becomes false when the personal agent revokes its refresh tokens, when the user removes the agent under Authorized apps, and when an administrator blocks the agent. The Session itself continues signed out, so status stays active.

For a joined browser, apply these rules:

  • status is not active: drop the cookie. The browser is a visitor again.
  • signed_in is false, or account is not the account of the join: keep the Session, and treat the browser as signed out.

Errors of your own call​

StatuserrorMeaning
400invalid_requestThe body is not a JSON object, or method, url, headers, required_scope or resource is missing or malformed.
401invalid_clientYour application did not authenticate, or it is not a confidential application of this organization.
403insufficient_scopeYour application lacks the poppy:verify scope.
404not_foundUnknown organization, or the protocol is switched off.
429too_many_requestsMore than 6,000 calls in 60 seconds from one application. The response has Retry-After.

Using the result​

  • Signed-out state. Store it under session.id. To recognize a visitor across Sessions, store it under client_id and user_id together.
  • Account data. Use account.sub. Never use user_id to find an account: the personal agent chose that value.
  • Scopes. Pass required_scope for each operation. For a finer rule, read account.scope.
  • Rate limits by agent. Count by client_id only after a verified answer.
  • Logs. Log client_id and session.id. Never log the headers that you forwarded.
  • Caching. Do not cache an answer. Each request has its own Session JWT.

Use it for a browser-session endpoint​

The second step of the protocol's browser join is a request from the personal agent with a Session header. Verify it like any other request. Pass "required_scope": "poppy:browser-sign-in" only when the request carries an Authorization header. Keep client_id and session.sid of the answer with your cookie, and look up the Session on each page request. The sample Company shows all three steps.