---
title: "network.machine-roles-put@1 · OpenVibe.Services"
canonical: "https://openvibe.services/docs/contracts/network.machine-roles-put"
updated: null
---

# network.machine-roles-put@1 · OpenVibe.Services

HTML: [network.machine-roles-put@1 · OpenVibe.Services](https://openvibe.services/docs/contracts/network.machine-roles-put)

# NetworkMachineRolesPut `network.machine-roles-put@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: network
- Visibility: first-party
- Status: active
- Compatibility: backward
- Schema: [`https://openvibe.network/contracts/network/machine-roles-put.v1.json`](/docs/contracts/network.machine-roles-put.json)

network.machine-roles-put@1: the roles the owner gives a machine (PUT /api/v1/machines/:id/roles, capability machines.manage). The whole set, not a change: what is not named is turned off. Every id must be in the catalogue (network.machine-roles@1); an unknown role is refused and nothing is changed.

## Fields

| Field | Type | Required | Description | Constraints |
| --- | --- | --- | --- | --- |
| `roles` | array of string | yes | The machine's roles after the change. An empty array turns every role off. | - `maxItems 8`<br>- `unique items`<br>- `items: pattern ^[a-z][a-z0-9-]*\.[a-z][a-z0-9-]*$` |

## Examples

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

 Valid: none

~~~~
{
  "roles": []
}
~~~~

Valid: two-roles

~~~~
{
  "roles": [
    "codes.worker",
    "ai.host"
  ]
}
~~~~

Rejected: duplicate

~~~~
{
  "roles": [
    "codes.worker",
    "codes.worker"
  ]
}
~~~~

Rejected: missing

~~~~
{}
~~~~

Rejected: not-a-list

~~~~
{
  "roles": "codes.worker"
}
~~~~

## Validate

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