Semaphor

Preview effective Unified Security

Resolves Unified Security for one actor and connection without saving anything. The optional draft replaces or adds exactly one definition or assignment in memory. It is never persisted.

HTTP success and policy success are separate. A well-formed, authorized request returns 200 with ok: true, including when preview.status is BLOCKED. Branch on preview.status, preview.activation.status, preview.compilation.status, and diagnostic codes; do not parse human-readable messages.

ignorePersistedAssignments cannot be combined with assignmentId or draft. A definition-create draft must use the same connectionId as the preview request.

POST
/api/management/v1/projects/{projectId}/unified-security/preview

Authorization

UnifiedSecurityBearerAuth
AuthorizationBearer <token>

A project-scoped access token generated for an organization Admin. Generate one with the Token API using the Admin's orgUserId. The token project must match the request path, and the user must currently be active and belong to the project organization. Dashboard tokens and tenant-user project tokens are not accepted.

In: header

Path Parameters

projectId*string

Your Semaphor project ID.

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

application/json

curl -X post "https://semaphor.cloud/api/management/v1/projects/string/unified-security/preview" \  -H "Content-Type: application/json" \  -d '{    "connectionId": "conn_123",    "actor": {      "kind": "TENANT",      "tenantId": "tenant_123"    }  }'

{
  "ok": true,
  "data": {
    "preview": {
      "status": "RESOLVED",
      "diagnostics": [],
      "activation": {
        "status": "ACTIVE",
        "definitionCount": 1,
        "ruleCount": 1
      },
      "compilation": {
        "status": "VERIFIED"
      },
      "effectiveRLS": {
        "rules": [
          {
            "name": "Region filter",
            "matcher": {
              "type": "ALL_TABLES_WITH_COLUMN",
              "column": "region"
            },
            "expression": "region = ANY({{ allowed_regions }})",
            "params": {
              "allowed_regions": {
                "kind": "ARRAY",
                "elementType": "STRING",
                "count": 2
              }
            }
          }
        ]
      },
      "provenance": []
    },
    "context": {
      "cls": {
        "filePathTemplates": {},
        "params": {}
      },
      "sls": {},
      "sources": {
        "cls": [],
        "sls": []
      }
    }
  }
}

{
  "ok": false,
  "error": {
    "code": "INTERNAL_ERROR",
    "message": "string",
    "requestId": "string",
    "issues": [
      {
        "code": "INVALID_JSON",
        "fieldPath": "string",
        "message": "string"
      }
    ],
    "retryable": true
  }
}
{
  "ok": false,
  "error": {
    "code": "INVALID_REQUEST",
    "message": "string",
    "details": {}
  }
}
{
  "ok": false,
  "error": {
    "code": "INVALID_REQUEST",
    "message": "string",
    "details": {}
  }
}
{
  "ok": false,
  "error": {
    "code": "INTERNAL_ERROR",
    "message": "string",
    "requestId": "string",
    "issues": [
      {
        "code": "INVALID_JSON",
        "fieldPath": "string",
        "message": "string"
      }
    ],
    "retryable": true
  }
}
{
  "ok": false,
  "error": {
    "code": "INTERNAL_ERROR",
    "message": "Failed to build Unified Security preview.",
    "requestId": "request_1",
    "retryable": true
  }
}