Skip to content
POST/api/v1/firewall/import-policy

Convert policy text to firewall guardrails

Accepts natural-language policy text (optionally tied to a framework) and synthesizes firewall guardrails. Returns generated guardrails, coverage percent, unmapped section count, and a summary.

Authentication

Send Authorization: Bearer YOUR_API_KEY on every request. Generate API keys at /dashboard/api-keys.

Request body required

Example

{
  "policyText": "<Natural-language policy text to convert.>",
  "framework": "<Optional framework id; defaults to 'auto>"
}
Schema
{
  "application/json": {
    "schema": {
      "type": "object",
      "properties": {
        "policyText": {
          "type": "string",
          "minLength": 10,
          "maxLength": 500000,
          "description": "Natural-language policy text to convert."
        },
        "framework": {
          "type": "string",
          "maxLength": 120,
          "description": "Optional framework id; defaults to 'auto'."
        }
      },
      "required": [
        "policyText"
      ],
      "additionalProperties": false
    }
  }
}

Response

200 example

{
  "success": true
}

All status codes

200Generated guardrails + coverage.
400(no description)
401(no description)
429(no description)

Code samples

cURL

curl -X POST \
  https://evalguard.ai/api/v1/firewall/import-policy \
  -H "Authorization: Bearer $EVALGUARD_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "policyText": "<Natural-language policy text to convert.>", "framework": "<Optional framework id; defaults to 'auto>" }'

TypeScript

import { EvalGuard } from "@evalguard/sdk";

const client = new EvalGuard({ apiKey: process.env.EVALGUARD_API_KEY });

const response = await client.request({
  method: "POST",
  path: "/api/v1/firewall/import-policy",
  body: {
    "policyText": "<Natural-language policy text to convert.>",
    "framework": "<Optional framework id; defaults to 'auto>"
  },
});
console.log(response);

Python

from evalguard import EvalGuard
import os

client = EvalGuard(api_key=os.environ["EVALGUARD_API_KEY"])

response = client.request(
    method="POST",
    path="/api/v1/firewall/import-policy",
    body={
    "policyText": "<Natural-language policy text to convert.>",
    "framework": "<Optional framework id; defaults to 'auto>"
},
)
print(response)

Go

package main

import (
	"context"
	"fmt"
	"net/http"
	"os"
	"strings"
)

func main() {
	body := strings.NewReader(`{"policyText":"<Natural-language policy text to convert.>","framework":"<Optional framework id; defaults to 'auto>"}`)
	req, _ := http.NewRequestWithContext(context.Background(), "POST", "https://evalguard.ai/api/v1/firewall/import-policy", body)
	req.Header.Set("Authorization", "Bearer "+os.Getenv("EVALGUARD_API_KEY"))
	req.Header.Set("Content-Type", "application/json")
	resp, err := http.DefaultClient.Do(req)
	if err != nil { panic(err) }
	defer resp.Body.Close()
	fmt.Println(resp.Status)
}

Errors

400401429

Other Firewall endpoints