AgentMessage
Guardrails

Dry-run a draft message against the guardrail stack

POST
/v1/guardrails/preflight

Runs the Compliance Guardrails stack against a draft message and returns severity-tagged findings (pass / warn / block) with suggested fixes, without sending the message. This is a read-only dry-run: no message is sent, no wallet is debited, no cadence is reserved, and no state is mutated.

Available guardrails are evaluated: the consent gate (a missing opt-in is a block), quiet hours (a deferred send is a warn), and Auto-Stamp (an info preview of the disclosure that would be appended). The source_breakdown shows which scope (number / pool / campaign / brand / use-case default / platform floor) supplied each tool's effective config, so precedence and pool-over-campaign shadowing are visible.

Only findings with severity block set can_submit to false; warn and info are advisory. A from-number that is not owned by your organization returns 404 NOT_FOUND (never 403).

Requires the org:read 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 POST "https://example.com/v1/guardrails/preflight" \  -H "Content-Type: application/json" \  -d '{    "from": "string",    "to": "string"  }'
{
  "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": {
    "can_submit": true,
    "llm_used": true,
    "generated_at": "2019-08-24T14:15:22Z",
    "counts": {
      "property1": 0,
      "property2": 0
    },
    "findings": [
      {
        "id": "string",
        "severity": "info",
        "category": "string",
        "field": "string",
        "title": "string",
        "detail": "string",
        "suggested_fix": "string",
        "source": "deterministic",
        "docs_url": "string"
      }
    ],
    "checked_urls": [
      {
        "url": "string",
        "field": "string",
        "reachable": true,
        "status": 0,
        "error": "string"
      }
    ],
    "source_breakdown": {
      "property1": "string",
      "property2": "string"
    }
  }
}
{
  "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": "VALIDATION_FAILED",
    "message": "validation failed",
    "request_id": "01JTBQH2FZ8K1RXC0WJ4Z9P3VM",
    "details": {
      "to": "must be E.164",
      "body": "must be 1..1600 chars"
    }
  }
}