AgentMessage
Guardrails

Bind or rebind a scope to a guardrail profile

PUT
/v1/guardrails/bindings

Binds a profile to a scope, or rebinds an existing scope to a new profile (an upsert keyed by scope). Set exactly one of brand_id, campaign_id, phone_number_id, or pool_id for a concrete scope, or set none of them to bind the organization default. Setting more than one returns 422 VALIDATION_FAILED.

The scope target and the profile must both belong to your organization; a target that does not returns 404 NOT_FOUND.

Requires the org:admin:write scope.

AuthorizationBearer <token>

Authenticate by sending your API key as a bearer token: Authorization: Bearer am_live_.... Every request is automatically scoped to the organization that owns the key and to the scopes granted to that key.

In: header

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

application/json

application/json

curl -X PUT "https://example.com/v1/guardrails/bindings" \  -H "Content-Type: application/json" \  -d '{    "profile_id": "bfcb6779-b1f9-41fc-92d7-88f8bc1d12e8"  }'
{
  "success": true,
  "error": {
    "code": "string",
    "message": "string",
    "request_id": "string",
    "details": {
      "property1": "string",
      "property2": "string"
    }
  },
  "meta": {
    "total": 0,
    "limit": 0,
    "offset": 0,
    "next_cursor": "eyJjcmVhdGVkX2F0IjoiMjAyNi0wNC0yNlQxMjowMDowMFoiLCJpZCI6IjAxOTAwMDAwLTAwMDAtMDAwMC0wMDAwLTAwMDAwMDAwMDAwMSJ9",
    "last_event_at": "2019-08-24T14:15:22Z"
  },
  "data": {
    "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
    "org_id": "a40f5d1f-d889-42e9-94ea-b9b33585fc6b",
    "scope_kind": "use_case_default",
    "brand_id": "1bb61461-e5e3-4ebb-8cc6-5b0c37f1b7da",
    "campaign_id": "78614b6c-fe7c-41e2-8e25-c9b3a3c91904",
    "phone_number_id": "54afc7b8-17df-415a-9fb0-21ee66219576",
    "pool_id": "bd9ee216-b2f2-496a-bbe1-31b86a2c3c43",
    "profile_id": "bfcb6779-b1f9-41fc-92d7-88f8bc1d12e8",
    "created_at": "2019-08-24T14:15:22Z",
    "updated_at": "2019-08-24T14:15:22Z"
  }
}
{
  "success": false,
  "error": {
    "code": "UNAUTHORIZED",
    "message": "authentication failed",
    "request_id": "01JTBQH2FZ8K1RXC0WJ4Z9P3VM"
  }
}
{
  "success": false,
  "error": {
    "code": "FORBIDDEN",
    "message": "missing required scope",
    "request_id": "01JTBQH2FZ8K1RXC0WJ4Z9P3VM"
  }
}
{
  "success": false,
  "error": {
    "code": "NOT_FOUND",
    "message": "not found",
    "request_id": "01JTBQH2FZ8K1RXC0WJ4Z9P3VM"
  }
}

{
  "success": false,
  "error": {
    "code": "ATTESTATION_REQUIRED",
    "message": "loosening the freq_cap guardrail at profile scope requires an attestation, an explicit human statement that your organization accepts responsibility for this change",
    "request_id": "01JTBQH2FZ8K1RXC0WJ4Z9P3VM",
    "details": {
      "profile.attestation": "required to loosen the freq_cap guardrail",
      "tool": "freq_cap",
      "scope_kind": "profile"
    }
  }
}