Renommer ou déplacer une unité organisationnelle manuelle
PATCH/api/public/v1/org-units/{unit_id}
Manual units only — the root answers 409 ROOT_UNIT; another directory-owned unit answers 409 DIRECTORY_OWNED, because the next sync pass would undo the change. A reparent rewrites path and depth for the whole subtree in one transaction; a move that would push any descendant past level 10 is rejected whole, and a move under the unit's own descendant answers 409 UNIT_CYCLE.
curl --fail-with-body -X PATCH 'https://app.openlatch.ai/api/public/v1/org-units/<unit_id>' \ -H "Authorization: Bearer $OPENLATCH_API_KEY" \ -H 'Content-Type: application/json' \ -d '{"name":"<unit_name>-renamed"}'import jsonimport osimport urllib.request
body = '{"name":"<unit_name>-renamed"}'request = urllib.request.Request( 'https://app.openlatch.ai/api/public/v1/org-units/<unit_id>', method='PATCH', data=body.encode(), headers={ 'Authorization': 'Bearer ' + os.environ['OPENLATCH_API_KEY'], 'Content-Type': 'application/json', },)with urllib.request.urlopen(request) as response: text = response.read().decode() print(json.dumps(json.loads(text), indent=2) if text else response.status)#!/usr/bin/env bashset -euo pipefail
curl -sS --fail-with-body -X PATCH 'https://app.openlatch.ai/api/public/v1/org-units/<unit_id>' \ -H "Authorization: Bearer $OPENLATCH_API_KEY" \ -H 'Content-Type: application/json' \ -d '{"name":"<unit_name>-renamed"}' | jq .$headers = @{ Authorization = "Bearer $env:OPENLATCH_API_KEY"}$body = '{"name":"<unit_name>-renamed"}'Invoke-RestMethod -Method PATCH -Uri 'https://app.openlatch.ai/api/public/v1/org-units/<unit_id>' -Headers $headers -ContentType 'application/json; charset=utf-8' -Body $body | ConvertTo-Json -Depth 20Autorisation
Section intitulée « Autorisation »| Rôle dans l’organisation | Ce point de terminaison |
|---|---|
owner | Autorisé |
admin | Autorisé |
editor | Non autorisé |
viewer | Non autorisé |
Une clé porte le rôle que son propriétaire détient dans l’organisation. Voir Authentification.
Portée de clé d’API : org:write
Paramètres de chemin
Section intitulée « Paramètres de chemin »| Paramètre | Type | Description |
|---|---|---|
unit_id | string (uuid) | Obligatoire. |
Paramètres d’en-tête
Section intitulée « Paramètres d’en-tête »| Paramètre | Type | Description |
|---|---|---|
Idempotency-Key | string or null | Optional. Makes the request safe to retry: the same key and the same request, within 24 hours, returns the stored response with Idempotent-Replayed: true and runs once. |
Corps de la requête
Section intitulée « Corps de la requête »| Champ | Type | Description |
|---|---|---|
name | string or null | |
parent_id | string (uuid) or null |
- 200 OK — l’appel a réussi.
- 400 Bad Request —
BAD_REQUEST - 401 Unauthorized —
UNAUTHORIZED - 402 Payment Required —
license_expired - 403 Forbidden —
FEATURE_DISABLED,FORBIDDEN,INSUFFICIENT_SCOPE - 404 Not Found —
NOT_FOUND - 409 Conflict —
DIRECTORY_OWNED,IDEMPOTENCY_IN_PROGRESS,ROOT_UNIT,UNIT_CYCLE,UNIT_EXISTS - 422 Unprocessable Content —
DEPTH_EXCEEDED,IDEMPOTENCY_KEY_REUSED,INVALID_ID,INVALID_NAME,VALIDATION_ERROR - 429 Too Many Requests —
TOO_MANY_REQUESTS - 500 Internal Server Error —
INTERNAL_SERVER_ERROR,tenant_isolation_violation - 503 Service Unavailable —
FEATURE_STATE_UNAVAILABLE,SERVICE_UNAVAILABLE
Champs de la réponse
Section intitulée « Champs de la réponse »| Champ | Type | Description |
|---|---|---|
agents_count | integer | Obligatoire. |
agents_direct | integer or null | |
depth | integer | Obligatoire. |
effective_zone_id | string or null | |
id | string | Obligatoire. |
name | string | Obligatoire. |
parent_id | string or null | |
path | string | Obligatoire. |
policies_added_here | integer | Obligatoire. |
policies_in_force | integer | Obligatoire. |
short | string or null | |
source | string | Obligatoire. |
zone | object or null | |
zone.ask_mode | string or null | |
zone.effective_ask_mode | string | |
zone.id | string | Obligatoire. |
zone.is_default | boolean | Whether this is the organization's default zone: it serves agents with no owner and no pin. |
zone.is_root | boolean | Obligatoire. |
zone.limits | object or null |
Exemple de réponse
Section intitulée « Exemple de réponse »{ "agents_count": 3, "agents_direct": 3, "depth": 3, "effective_zone_id": "3f6c1a2e-8b4d-4c1f-9a7e-0d5b2c8e4f10", "id": "3f6c1a2e-8b4d-4c1f-9a7e-0d5b2c8e4f10", "name": "release-bot", "parent_id": "3f6c1a2e-8b4d-4c1f-9a7e-0d5b2c8e4f10", "path": "Engineering / Platform", "policies_added_here": 3, "policies_in_force": 3, "short": "string", "source": "string", "zone": { "ask_mode": "string", "effective_ask_mode": "both", "id": "3f6c1a2e-8b4d-4c1f-9a7e-0d5b2c8e4f10", "is_default": false, "is_root": false, "limits": { "cannot_prompt": 3, "in_scope": 3, "shell_only": 3 } }}