SecureAgentMail

Create policy

Creates a new security or compliance policy. Policies can be scoped globally (when `inbox_id` is null) or to a specific inbox. The `config` object shape varies by policy type.

POST
/policies

Authorization

BearerAuth
AuthorizationBearer <token>

API key passed as a Bearer token. Production keys start with am_live_ and sandbox keys start with am_test_.

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://secureagentmail.com/api/v1/policies" \  -H "Content-Type: application/json" \  -d '{    "name": "Block Competitor Domains",    "type": "domain_blocklist",    "action": "block",    "inbox_id": "inb_abc123",    "config": {}  }'
{
  "id": "pol_r2t5v8",
  "name": "Block Competitor Domains",
  "type": "domain_blocklist",
  "action": "block",
  "inbox_id": "inb_abc123",
  "enabled": true,
  "config": {},
  "created_at": "2026-01-20T12:00:00Z"
}
{
  "error": {
    "code": "unauthorized",
    "message": "Invalid or missing API key.",
    "status": 401
  }
}
{
  "error": {
    "code": "forbidden",
    "message": "Your API key does not have the required scope for this operation.",
    "status": 403
  }
}
{
  "error": {
    "code": "validation_error",
    "message": "The 'slug' field is required and must be a valid identifier.",
    "status": 422
  }
}
{
  "error": {
    "code": "rate_limited",
    "message": "Rate limit exceeded. Please retry after 30 seconds.",
    "status": 429
  }
}