---
title: "identity.service-token-claims@1 · OpenVibe.Services"
canonical: "https://openvibe.services/docs/contracts/identity.service-token-claims"
updated: null
---

# identity.service-token-claims@1 · OpenVibe.Services

HTML: [identity.service-token-claims@1 · OpenVibe.Services](https://openvibe.services/docs/contracts/identity.service-token-claims)

# ServiceTokenClaims `identity.service-token-claims@1`

Generated at 2026-12-01 05:42:00 UTC from [`openvibe-contracts v0.454.0`](https://github.com/OpenVibers/OpenVibe.Contracts/tree/v0.454.0) and [`openvibe-sdk v0.193.0`](https://github.com/OpenVibers/OpenVibe.SDK/tree/v0.193.0).

- Version: 1.3.0
- Owner: network
- Visibility: public
- Status: active
- Compatibility: backward
- Decision: [ADR-003](/docs/adr/ADR-003)
- Schema: [`https://openvibe.network/contracts/identity/service-token-claims.v1.json`](/docs/contracts/identity.service-token-claims.json)

Claims of a short-lived RS256 client-credentials token issued by OpenVibe.Network to a service, app, mod, node or agent principal. Replaces X-Internal-Key. App tokens (actor\_type app) also carry project\_id and env; receivers refuse env=sandbox unless they opted in. Agent tokens (actor\_type agent, sub agent:agt\_<ULID>) are minted for the agent's host and also carry project\_id, env and on\_behalf\_of (the owner), and optionally cap\_confirm and act.

## Fields

| Field | Type | Required | Description | Constraints |
| --- | --- | --- | --- | --- |
| `iss` | string | yes | Issuer; https://openvibe.network in production. Receivers pass the issuer they expect to verifyServiceToken(). | - `format uri` |
| `sub` | string | yes |  | - `pattern ^(svc:[a-z][a-z0-9-]{1,39}\|app:app_[0-9A-HJKMNP-TV-Z]{26}\|mod:mod_[0-9A-HJKMNP-TV-Z]{26}\|link:lnk_[0-9A-HJKMNP-TV-Z]{26}\|agent:agt_[0-9A-HJKMNP-TV-Z]{26})$` |
| `actor_type` | enum | yes |  | - `one of "service", "app", "mod", "link", "agent"` |
| `aud` | array of string | yes |  | - `minItems 1`<br>- `items: pattern ^[a-z0-9.-]+$` |
| `cap` | array of string | yes | Granted capability ids; a trailing .\* grants a family. | - `items: pattern ^[a-z][a-z0-9_]*(\.[a-z0-9_*]+)+$` |
| `cap_confirm` | array of string |  | Agent tokens: capabilities the agent holds in confirm mode. Each use needs an approved network.confirmation-request@1, presented as OpenVibe-Confirmation: cnf\_<ULID> and consumed by the owning service. Never also in cap, so a receiver that does not know agents refuses those actions. | - `items: pattern ^[a-z][a-z0-9_]*(\.[a-z0-9_]+)+$` |
| `ns` | array of string |  | Namespace constraints, e.g. live.\* or mod.example.\*. A developer app token carries its project\_id (the whole project, as issued before namespaces were rows) and app.<project\_id>.\*: on Media, app.<project\_id> and app.<project\_id>.sandbox are the project's production and sandbox namespaces, with children below them. |  |
| `iat` | integer | yes |  |  |
| `exp` | integer | yes |  |  |
| `jti` | string | yes |  | - `minLength 8` |
| `project_id` | string |  | Developer project of an app or agent principal (ADR-014). Services key tenancy by it. Absent on first-party service tokens. | - `pattern ^prj_[0-9A-HJKMNP-TV-Z]{26}$` |
| `env` | enum |  | Environment of an app or agent principal. A receiver MUST refuse env=sandbox (401 token.sandbox\_refused) unless it opted in to sandbox tokens. Absent on first-party service tokens, which are production. | - `one of "sandbox", "production"` |
| `on_behalf_of` | string |  | The person who authorized an app through the authorization-code flow, or the owner an agent acts for (always present on agent tokens). Also present on a node token that asks for an audience where the machine acts for its owner (Agent Streams S1: openvibe.live and live.agent\_stream.publish); absent on every other client\_credentials token. | - `pattern ^usr_[0-9A-HJKMNP-TV-Z]{26}$` |
| `app_name` | string |  | Signed display name of a developer app, for attribution such as via <app>. | - `maxLength 80` |
| `consent` | array of enum |  | App tokens from the authorization-code flow (0.310.0): the purposes the person (on\_behalf\_of) granted this app at sign-in and that are still active when the token is issued, the claim network.consent-claim@1 defines. Present when the sign-in asked for consent:<purpose> scopes, \[\] when none is granted, absent otherwise. | - `maxItems 4`<br>- `unique items`<br>- `items: one of "ai.train", "data.public", "face.recognize", "app.data"` |
| `act` | object |  | Agent tokens: the host that runs the agent and the token was minted for (RFC 8693 actor claim), a service or an app. | - `no other fields` |
| `act.sub` | string | yes |  | - `pattern ^(svc:[a-z][a-z0-9-]{1,39}\|app:app_[0-9A-HJKMNP-TV-Z]{26})$` |

## Examples

From the contract's own test fixtures: valid ones validate, rejected ones must fail.

 Valid: agent-app-host-auto-only

~~~~
{
  "iss": "https://openvibe.network",
  "sub": "agent:agt_01J0000000000000000000000Z",
  "actor_type": "agent",
  "aud": [
    "openvibe.media"
  ],
  "cap": [
    "media.object.read"
  ],
  "ns": [
    "prj_01J0000000000000000000000Z",
    "app.prj_01J0000000000000000000000Z.*"
  ],
  "iat": 1790000000,
  "exp": 1790000300,
  "jti": "tok_agent002",
  "project_id": "prj_01J0000000000000000000000Z",
  "env": "sandbox",
  "on_behalf_of": "usr_01J0000000000000000000000Z",
  "act": {
    "sub": "app:app_01J0000000000000000000000Z"
  }
}
~~~~

Valid: agent-service-host

~~~~
{
  "iss": "https://openvibe.network",
  "sub": "agent:agt_01JAB2C3D4E5F6G7H8J9K0MNPQ",
  "actor_type": "agent",
  "aud": [
    "openvibe.chat"
  ],
  "cap": [
    "chat.presence.read"
  ],
  "cap_confirm": [
    "chat.message.send"
  ],
  "ns": [
    "prj_01JAB2C3D4E5F6G7H8J9K0MNPQ"
  ],
  "iat": 1790000000,
  "exp": 1790000300,
  "jti": "tok_agent001",
  "project_id": "prj_01JAB2C3D4E5F6G7H8J9K0MNPQ",
  "env": "production",
  "on_behalf_of": "usr_01JAB2C3D4E5F6G7H8J9K0MNPQ",
  "act": {
    "sub": "svc:actor"
  }
}
~~~~

Valid: app-consent-purposes

~~~~
{
  "iss": "https://openvibe.network",
  "sub": "app:app_01K6R3A1B2C3D4E5F6G7H8J9KD",
  "actor_type": "app",
  "aud": [
    "openvibe.media"
  ],
  "cap": [],
  "ns": [
    "prj_01J0000000000000000000000Z",
    "app.prj_01J0000000000000000000000Z.*"
  ],
  "iat": 1790000000,
  "exp": 1790000300,
  "jti": "tok_abcdef21",
  "project_id": "prj_01J0000000000000000000000Z",
  "env": "production",
  "on_behalf_of": "usr_01K6R2Z8C4V7M9Q3T5W1X2Y3Z4",
  "consent": [
    "ai.train",
    "app.data"
  ]
}
~~~~

Valid: app-project-namespaces

~~~~
{
  "iss": "https://openvibe.network",
  "sub": "app:app_01J0000000000000000000000Z",
  "actor_type": "app",
  "aud": [
    "openvibe.media"
  ],
  "cap": [
    "media.object.upload",
    "media.object.read",
    "media.object.list",
    "media.object.delete"
  ],
  "ns": [
    "prj_01J0000000000000000000000Z",
    "app.prj_01J0000000000000000000000Z.*"
  ],
  "iat": 1790000000,
  "exp": 1790000300,
  "jti": "tok_abcdef13",
  "project_id": "prj_01J0000000000000000000000Z",
  "env": "production"
}
~~~~

Valid: app-sandbox

~~~~
{
  "iss": "https://openvibe.network",
  "sub": "app:app_01J0000000000000000000000Z",
  "actor_type": "app",
  "aud": [
    "openvibe.media"
  ],
  "cap": [
    "media.object.upload",
    "media.object.read"
  ],
  "ns": [
    "live.*"
  ],
  "iat": 1790000000,
  "exp": 1790000300,
  "jti": "tok_abcdef12",
  "project_id": "prj_01J0000000000000000000000Z",
  "env": "sandbox",
  "on_behalf_of": "usr_01J0000000000000000000000Z"
}
~~~~

Valid: live-to-media

~~~~
{
  "iss": "https://openvibe.network",
  "sub": "svc:live",
  "actor_type": "service",
  "aud": [
    "openvibe.media"
  ],
  "cap": [
    "media.object.upload",
    "media.object.read"
  ],
  "ns": [
    "live.*"
  ],
  "iat": 1790000000,
  "exp": 1790000300,
  "jti": "tok_abcdef12"
}
~~~~

Valid: node-token

~~~~
{
  "iss": "https://openvibe.network",
  "sub": "link:lnk_01JAB2C3D4E5F6G7H8J9K0MNPQ",
  "actor_type": "link",
  "aud": [
    "openvibe.bot"
  ],
  "cap": [
    "network.link.self.manage"
  ],
  "iat": 1790000000,
  "exp": 1790000300,
  "jti": "tok_node0001"
}
~~~~

Rejected: agent-actor-with-service-sub

~~~~
{
  "iss": "https://openvibe.network",
  "sub": "svc:actor",
  "actor_type": "agent",
  "aud": [
    "openvibe.chat"
  ],
  "cap": [
    "chat.presence.read"
  ],
  "iat": 1790000000,
  "exp": 1790000300,
  "jti": "tok_agent005",
  "project_id": "prj_01JAB2C3D4E5F6G7H8J9K0MNPQ",
  "env": "production",
  "on_behalf_of": "usr_01JAB2C3D4E5F6G7H8J9K0MNPQ"
}
~~~~

Rejected: agent-bad-actor-claim

~~~~
{
  "iss": "https://openvibe.network",
  "sub": "agent:agt_01JAB2C3D4E5F6G7H8J9K0MNPQ",
  "actor_type": "agent",
  "aud": [
    "openvibe.chat"
  ],
  "cap": [
    "chat.presence.read"
  ],
  "iat": 1790000000,
  "exp": 1790000300,
  "jti": "tok_agent006",
  "project_id": "prj_01JAB2C3D4E5F6G7H8J9K0MNPQ",
  "env": "production",
  "on_behalf_of": "usr_01JAB2C3D4E5F6G7H8J9K0MNPQ",
  "act": {
    "sub": "agent:agt_01J0000000000000000000000Z"
  }
}
~~~~

Rejected: agent-sub-as-service

~~~~
{
  "iss": "https://openvibe.network",
  "sub": "agent:agt_01JAB2C3D4E5F6G7H8J9K0MNPQ",
  "actor_type": "service",
  "aud": [
    "openvibe.chat"
  ],
  "cap": [
    "chat.message.send"
  ],
  "iat": 1790000000,
  "exp": 1790000300,
  "jti": "tok_agent004"
}
~~~~

Rejected: agent-without-owner

~~~~
{
  "iss": "https://openvibe.network",
  "sub": "agent:agt_01JAB2C3D4E5F6G7H8J9K0MNPQ",
  "actor_type": "agent",
  "aud": [
    "openvibe.chat"
  ],
  "cap": [],
  "cap_confirm": [
    "chat.message.send"
  ],
  "iat": 1790000000,
  "exp": 1790000300,
  "jti": "tok_agent003",
  "project_id": "prj_01JAB2C3D4E5F6G7H8J9K0MNPQ",
  "env": "production",
  "act": {
    "sub": "svc:actor"
  }
}
~~~~

Rejected: app-consent-retired-purpose

~~~~
{
  "iss": "https://openvibe.network",
  "sub": "app:app_01K6R3A1B2C3D4E5F6G7H8J9KD",
  "actor_type": "app",
  "aud": [
    "openvibe.media"
  ],
  "cap": [],
  "ns": [
    "prj_01J0000000000000000000000Z",
    "app.prj_01J0000000000000000000000Z.*"
  ],
  "iat": 1790000000,
  "exp": 1790000300,
  "jti": "tok_abcdef21",
  "project_id": "prj_01J0000000000000000000000Z",
  "env": "production",
  "on_behalf_of": "usr_01K6R2Z8C4V7M9Q3T5W1X2Y3Z4",
  "consent": [
    "ai.looks"
  ]
}
~~~~

Rejected: app-without-project

~~~~
{
  "iss": "https://openvibe.network",
  "sub": "app:app_01J0000000000000000000000Z",
  "actor_type": "app",
  "aud": [
    "openvibe.media"
  ],
  "cap": [
    "media.object.upload",
    "media.object.read"
  ],
  "ns": [
    "live.*"
  ],
  "iat": 1790000000,
  "exp": 1790000300,
  "jti": "tok_abcdef12",
  "env": "sandbox",
  "on_behalf_of": "usr_01J0000000000000000000000Z"
}
~~~~

Rejected: no-audience

~~~~
{
  "iss": "https://openvibe.network",
  "sub": "svc:live",
  "actor_type": "service",
  "aud": [],
  "cap": [],
  "iat": 1,
  "exp": 2,
  "jti": "tok_abcdef12"
}
~~~~

Rejected: node-bad-id

~~~~
{
  "iss": "https://openvibe.network",
  "sub": "link:lnk_42",
  "actor_type": "link",
  "aud": [
    "openvibe.bot"
  ],
  "cap": [
    "network.link.self.manage"
  ],
  "iat": 1790000000,
  "exp": 1790000300,
  "jti": "tok_node0001"
}
~~~~

Rejected: non-uri-issuer

~~~~
{
  "iss": "openvibe network",
  "sub": "svc:live",
  "actor_type": "service",
  "aud": [
    "openvibe.media"
  ],
  "cap": [],
  "iat": 1,
  "exp": 2,
  "jti": "tok_abcdef12"
}
~~~~

Rejected: user-subject

~~~~
{
  "iss": "https://openvibe.network",
  "sub": "usr_01JAB2C3D4E5F6G7H8J9K0MNPQ",
  "actor_type": "service",
  "aud": [
    "openvibe.media"
  ],
  "cap": [],
  "iat": 1,
  "exp": 2,
  "jti": "tok_abcdef12"
}
~~~~

## Validate

~~~~
const contracts = require('openvibe-contracts');
contracts.validate('identity.service-token-claims@1', value);   // { valid, errors: [{ path, message }] }
~~~~
