Créer l’Autonomy Zone d’une unité organisationnelle
POST/api/public/v1/org-units/{unit_id}/zone
The layer starts EMPTY and inherits everything above it — a layer only ever adds. An optional body {agent_ids} pins those agents to the new zone by hand in the same transaction (at most 5 000; an id that is not an agent of this organization answers 404 AGENT_NOT_FOUND). The bare call, with no body, stays valid. 409 ZONE_EXISTS when the unit already carries one.
curl --fail-with-body -X POST 'https://app.openlatch.ai/api/public/v1/org-units/<unit_id>/zone' \ -H "Authorization: Bearer $OPENLATCH_API_KEY"import jsonimport osimport urllib.request
request = urllib.request.Request( 'https://app.openlatch.ai/api/public/v1/org-units/<unit_id>/zone', method='POST', headers={ 'Authorization': 'Bearer ' + os.environ['OPENLATCH_API_KEY'], },)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 POST 'https://app.openlatch.ai/api/public/v1/org-units/<unit_id>/zone' \ -H "Authorization: Bearer $OPENLATCH_API_KEY" | jq .$headers = @{ Authorization = "Bearer $env:OPENLATCH_API_KEY"}Invoke-RestMethod -Method POST -Uri 'https://app.openlatch.ai/api/public/v1/org-units/<unit_id>/zone' -Headers $headers | 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 : zones: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 |
|---|---|---|
agent_ids | array of string or null | Agents pinned to the new zone by hand in the same transaction (at most 5 000; an id that is not an agent of this organization answers 404 AGENT_NOT_FOUND). |
- 201 Created — 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 —
AGENT_NOT_FOUND,NOT_FOUND - 409 Conflict —
ASSIGNMENT_BUSY,IDEMPOTENCY_IN_PROGRESS,ZONE_EXISTS - 422 Unprocessable Content —
IDEMPOTENCY_KEY_REUSED,INVALID_ID,SELECTION_TOO_LARGE,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 |
|---|---|---|
id | string | Obligatoire. |
is_default | boolean | |
is_root | boolean | Obligatoire. |
org_unit_id | string | Obligatoire. |
revision | integer | Obligatoire. |
Exemple de réponse
Section intitulée « Exemple de réponse »{ "id": "3f6c1a2e-8b4d-4c1f-9a7e-0d5b2c8e4f10", "is_default": false, "is_root": false, "org_unit_id": "3f6c1a2e-8b4d-4c1f-9a7e-0d5b2c8e4f10", "revision": 3}