---
title: "run.session.ended@1 · OpenVibe.Services"
canonical: "https://openvibe.services/docs/contracts/run.session.ended"
updated: null
---

# run.session.ended@1 · OpenVibe.Services

HTML: [run.session.ended@1 · OpenVibe.Services](https://openvibe.services/docs/contracts/run.session.ended)

# RunSessionEndedPayload `run.session.ended@1`

Generated at 2026-11-13 06:25:48 UTC from [`openvibe-contracts v0.419.0`](https://github.com/OpenVibers/OpenVibe.Contracts/tree/v0.419.0) and [`openvibe-sdk v0.161.0`](https://github.com/OpenVibers/OpenVibe.SDK/tree/v0.161.0).

- Version: 1.0.0
- Owner: run
- Visibility: first-party
- Status: active
- Compatibility: backward
- Schema: [`https://openvibe.network/contracts/events/payloads/run.session.ended.v1.json`](/docs/contracts/run.session.ended.json)

run.session.ended v1 (OpenVibe.Run; the Desks plan's D6). A session ended (end.reason ended, ttl, idle, host\_lost, unplaceable or failed), its desk stopped and its lease given back; usage.desk\_seconds is final. The session as run.session@1 has it. Envelope: subject { type: session, id: <session id> }, visibility internal, priority low, actor service:run.

## Fields

| Field | Type | Required | Description | Constraints |
| --- | --- | --- | --- | --- |
| `id` | `https://openvibe.network/contracts/run/session.v1.json#/$defs/session_id` | yes |  |  |
| `owner` | [identity.subject-ref](/docs/contracts/identity.subject-ref) | yes |  |  |
| `via` | `https://openvibe.network/contracts/run/session.v1.json#/properties/via` | yes |  |  |
| `kind` | `https://openvibe.network/contracts/run/session.v1.json#/properties/kind` | yes |  |  |
| `state` | const | yes |  | - `= "ended"` |
| `size` | `https://openvibe.network/contracts/run/session.v1.json#/$defs/size` | yes |  |  |
| `ttl_s` | `https://openvibe.network/contracts/run/session.v1.json#/properties/ttl_s` | yes |  |  |
| `idle_s` | `https://openvibe.network/contracts/run/session.v1.json#/properties/idle_s` | yes |  |  |
| `placement` | one of | yes |  |  |
| `timings` | `https://openvibe.network/contracts/run/session.v1.json#/$defs/timings` | yes |  |  |
| `end` | `https://openvibe.network/contracts/run/session.v1.json#/$defs/end` | yes |  |  |
| `usage` | `https://openvibe.network/contracts/run/session.v1.json#/$defs/usage` | yes |  |  |
| `idempotency_key` | `https://openvibe.network/contracts/run/session.v1.json#/properties/idempotency_key` | yes |  |  |
| `task_id` | `https://openvibe.network/contracts/run/session.v1.json#/properties/task_id` |  |  |  |
| `curtain` | `https://openvibe.network/contracts/run/session.v1.json#/properties/curtain` |  |  |  |

## Examples

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

 Valid: idle

~~~~
{
  "id": "ses_01JD2C3D4E5F6G7H8J9K0MNPQR",
  "owner": {
    "type": "user",
    "id": "usr_01JAB2C3D4E5F6G7H8J9K0MNPQ"
  },
  "via": "service:actor",
  "kind": "browser",
  "state": "ended",
  "size": {
    "width": 1280,
    "height": 800
  },
  "ttl_s": 3600,
  "idle_s": 900,
  "placement": {
    "machine": "dev_01J8Z4M2Q0R7T9YV3K6N8P1W2X",
    "desk": "desk-s0mnpqr",
    "trust": "community",
    "offer_id": "desk:dev_01J8Z4M2Q0R7T9YV3K6N8P1W2X",
    "region": "eu",
    "reasons": [
      "a shared desk host with room"
    ]
  },
  "timings": {
    "created_at": "2026-10-28T10:00:00Z",
    "started_at": "2026-10-28T10:00:04Z",
    "last_used_at": "2026-10-28T10:05:00Z",
    "ended_at": "2026-10-28T10:20:00Z"
  },
  "end": {
    "reason": "idle",
    "detail": "no command for 900 s"
  },
  "usage": {
    "desk_seconds": 1196
  },
  "idempotency_key": null
}
~~~~

Rejected: no-end

~~~~
{
  "id": "ses_01JD2C3D4E5F6G7H8J9K0MNPQR",
  "owner": {
    "type": "user",
    "id": "usr_01JAB2C3D4E5F6G7H8J9K0MNPQ"
  },
  "via": "service:actor",
  "kind": "browser",
  "state": "ended",
  "size": {
    "width": 1280,
    "height": 800
  },
  "ttl_s": 3600,
  "idle_s": 900,
  "placement": {
    "machine": "dev_01J8Z4M2Q0R7T9YV3K6N8P1W2X",
    "desk": "desk-s0mnpqr",
    "trust": "community",
    "offer_id": "desk:dev_01J8Z4M2Q0R7T9YV3K6N8P1W2X",
    "region": "eu",
    "reasons": [
      "a shared desk host with room"
    ]
  },
  "timings": {
    "created_at": "2026-10-28T10:00:00Z",
    "started_at": "2026-10-28T10:00:04Z",
    "last_used_at": "2026-10-28T10:05:00Z",
    "ended_at": "2026-10-28T10:20:00Z"
  },
  "end": null,
  "usage": {
    "desk_seconds": 1196
  },
  "idempotency_key": null
}
~~~~

## Validate

~~~~
const contracts = require('openvibe-contracts');
contracts.validate('run.session.ended@1', value);   // { valid, errors: [{ path, message }] }
~~~~
