---
title: "media.media-ref@1 · OpenVibe.Services"
canonical: "https://openvibe.services/docs/contracts/media.media-ref"
updated: null
---

# media.media-ref@1 · OpenVibe.Services

HTML: [media.media-ref@1 · OpenVibe.Services](https://openvibe.services/docs/contracts/media.media-ref)

# MediaRef `media.media-ref@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.0.0
- Owner: media
- Visibility: public
- Status: active
- Compatibility: backward
- Decision: [ADR-006](/docs/adr/ADR-006)
- Schema: [`https://openvibe.network/contracts/media/media-ref.v1.json`](/docs/contracts/media.media-ref.json)

Reference to a Media object. Canonical ids (med\_<ULID>) arrive with the Wave 4 object model; until then legacy:<app>:<kind>:<id> addresses today's VOD/clip/file/paste/thumbnail rows.

## Fields

| Field | Type | Required | Description | Constraints |
| --- | --- | --- | --- | --- |
| `media_id` | string | yes |  | - `pattern ^(med_[0-9A-HJKMNP-TV-Z]{26}\|legacy:[a-z][a-z0-9-]{1,39}:(vod\|clip\|file\|paste\|thumbnail\|avatar):[A-Za-z0-9._/-]{1,200})$` |
| `role` | string |  |  | - `pattern ^[a-z][a-z0-9_]{1,39}$` |
| `variant` | string |  |  | - `pattern ^[a-z0-9][a-z0-9_-]{0,39}$` |

## Examples

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

 Valid: canonical

~~~~
{
  "media_id": "med_01JAB2C3D4E5F6G7H8J9K0MNPQ",
  "role": "attachment"
}
~~~~

Valid: legacy

~~~~
{
  "media_id": "legacy:live:vod:1203",
  "variant": "720p"
}
~~~~

Rejected: bare-integer

~~~~
{
  "media_id": "1203"
}
~~~~

Rejected: unknown-kind

~~~~
{
  "media_id": "legacy:live:song:1"
}
~~~~

## Validate

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