# API: Presets

| Method | Path | What it does | Scope |
|---|---|---|---|
| GET | `/v1/presets` | Your presets (the live version of each): a model, its routing and a system prompt, used as @preset/<name> | `gateway:read` |
| POST | `/v1/presets` | Save a new preset (version 1). It can't loosen your organization's guardrails: those still apply. | `gateway:write` |
| DELETE | `/v1/presets/:id` | Archive a preset (web app only): requests naming it stop resolving; its versions are kept (web app only) | `gateway:write` |
| GET | `/v1/presets/:id` | One preset: its live version and the earlier ones | `gateway:read` |
| PATCH | `/v1/presets/:id` | Change a preset: saves the result as a new version (the earlier ones stay) | `gateway:write` |

## Examples

### GET /v1/presets

Your presets (the live version of each): a model, its routing and a system prompt, used as @preset/<name>

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

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

### POST /v1/presets

Save a new preset (version 1). It can't loosen your organization's guardrails: those still apply.

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

```js
const res = await fetch(`https://manage.restolayer.com/v1/presets`, {
  method: "POST",
  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/presets/$ID

One preset: its live version and the earlier ones

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

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

### PATCH /v1/presets/$ID

Change a preset: saves the result as a new version (the earlier ones stay)

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

```js
const res = await fetch(`https://manage.restolayer.com/v1/presets/${id}`, {
  method: "PATCH",
  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();
```

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).
