# API: Guardrails

| Method | Path | What it does | Scope |
|---|---|---|---|
| GET | `/v1/guardrails/:scope/:id` | The guardrails set on the organization, a workspace or a key (requests follow all three: the strictest wins) | `gateway:read` |
| PUT | `/v1/guardrails/:scope/:id` | Set guardrails: model and provider allow/deny lists, data policy, EU-only, sensitive info and prompt injection. Agents may only tighten them. | `gateway:write` |
| GET | `/v1/guardrails/effective/:keyId` | What a key's requests actually follow: its organization's, workspace's and own guardrails merged | `gateway:read` |

## Examples

### GET /v1/guardrails/$SCOPE/$ID

The guardrails set on the organization, a workspace or a key (requests follow all three: the strictest wins)

```bash
curl -s "https://manage.restolayer.com/v1/guardrails/$SCOPE/$ID" \
  -H "Authorization: Bearer $LG_API_KEY"
```

```js
const res = await fetch(`https://manage.restolayer.com/v1/guardrails/${scope}/${id}`, {
  method: "GET",
  headers: { authorization: `Bearer ${process.env.LG_API_KEY}` },
});
const data = await res.json();
```

### PUT /v1/guardrails/$SCOPE/$ID

Set guardrails: model and provider allow/deny lists, data policy, EU-only, sensitive info and prompt injection. Agents may only tighten them.

```bash
curl -s -X PUT "https://manage.restolayer.com/v1/guardrails/$SCOPE/$ID" \
  -H "Authorization: Bearer $LG_API_KEY" \
  -H "content-type: application/json" \
  -d '{}'
```

```js
const res = await fetch(`https://manage.restolayer.com/v1/guardrails/${scope}/${id}`, {
  method: "PUT",
  headers: { authorization: `Bearer ${process.env.LG_API_KEY}`, "content-type": "application/json" },
  body: JSON.stringify({}), // fields: see the OpenAPI schema
});
const data = await res.json();
```

### GET /v1/guardrails/effective/$KEY_ID

What a key's requests actually follow: its organization's, workspace's and own guardrails merged

```bash
curl -s "https://manage.restolayer.com/v1/guardrails/effective/$KEY_ID" \
  -H "Authorization: Bearer $LG_API_KEY"
```

```js
const res = await fetch(`https://manage.restolayer.com/v1/guardrails/effective/${keyId}`, {
  method: "GET",
  headers: { authorization: `Bearer ${process.env.LG_API_KEY}` },
});
const data = await res.json();
```

Request and response schemas: [https://www.restolayer.com/openapi.json](https://www.restolayer.com/openapi.json). All resources: [API reference](https://www.restolayer.com/docs/api).
