Mettre à jour un rôle d'organisation

PATCH /v1/organizations/{org_id}/roles/{role_id} · autorisation roles:write

Met à jour le rôle avec un JSON merge patch (RFC 7396, Content-Type: application/merge-patch+json). If-Match est obligatoire. key ne peut pas changer. Un rôle d'organisation ne peut pas devenir privilégié. Un patch qui ne change rien conserve la version. L'écriture est auditée sous role.updated.

Requête

Champ Type Obligatoire Description
org_id path oui Identifiant de l'organisation (org_…).
role_id path oui Identifiant du rôle (rol_…).
If-Match header oui ETag actuel du rôle.
name string non Nom d'affichage, jusqu'à 128 caractères.
description string non Jusqu'à 1024 caractères.
is_privileged boolean non Indicateur de rôle privilégié (doit rester false).
assignable_in_self_service boolean non Indique si le rôle peut être attribué en libre-service.

Réponse

200 OK avec le rôle et son nouvel ETag.

{
  "id": "rol_01j9xr7s1t2w6x8y0z2a4b6c8e",
  "organization_id": "org_01j9xk3m7q8r2s4t6v8w0y2z4a",
  "key": "billing-admin",
  "name": "Billing admin team",
  "description": "",
  "is_privileged": false,
  "assignable_in_self_service": true,
  "permission_ids": [],
  "created_at": "2026-10-12T09:31:00.123456Z",
  "updated_at": "2026-10-12T10:00:00Z",
  "version": 2
}

Erreurs

HTTP code Quand
400 unknown_field Le patch contient un champ qui ne peut pas être écrit (par exemple key).
404 not_found Le rôle n'existe pas dans ce périmètre.
412 precondition_failed If-Match ne correspond pas à la version actuelle.
422 validation_failed Un champ est invalide.
428 precondition_required If-Match est absent.
401 unauthenticated Le justificatif est absent, invalide ou révoqué.
403 insufficient_permissions Le justificatif ne dispose pas de l'autorisation requise.
429 rate_limited La limite de débit a été dépassée ; réessayez après la durée indiquée par Retry-After.
503 service_unavailable Une dépendance est temporairement indisponible ; réessayez après la durée indiquée par Retry-After.

Exemple

curl -i -X PATCH "https://api.eu.keenauth.com/v1/organizations/org_01j9xk3m7q8r2s4t6v8w0y2z4a/roles/rol_01j9xr7s1t2w6x8y0z2a4b6c8e" \
  -H "Authorization: Bearer $KEENAUTH_SECRET_KEY" \
  -H 'If-Match: "1"' \
  -H "Content-Type: application/merge-patch+json" \
  -d '{"name":"Billing admin team"}'