# API: Private endpoints

| Method | Path | What it does | Scope |
|---|---|---|---|
| GET | `/v1/private-endpoints` | Your own model servers (private/<slug>): each one's address, model, limits, capabilities and last probe. A key is never shown. | `gateway:read` |
| POST | `/v1/private-endpoints` | Add your own OpenAI-compatible server (web app only): its https address must be public; the key is sealed and never shown again. It's probed at once. (web app only) | `gateway:write` |
| DELETE | `/v1/private-endpoints/:id` | Delete a private endpoint (web app only); its sealed key goes with it (web app only) | `gateway:write` |
| GET | `/v1/private-endpoints/:id` | One private endpoint | `gateway:read` |
| PATCH | `/v1/private-endpoints/:id` | Rename, change limits or capabilities, or disable a private endpoint. Changing its address or key and re-enabling it are done by a person in the web app. | `gateway:write` |
| POST | `/v1/private-endpoints/:id/probe` | Probe a private endpoint now: GET {base_url}/models with its key (5 s). The result is stored and shown; routing isn't blocked by it. | `gateway:write` |

## Examples

### GET /v1/private-endpoints

Your own model servers (private/<slug>): each one's address, model, limits, capabilities and last probe. A key is never shown.

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

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

### GET /v1/private-endpoints/$ID

One private endpoint

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

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

### PATCH /v1/private-endpoints/$ID

Rename, change limits or capabilities, or disable a private endpoint. Changing its address or key and re-enabling it are done by a person in the web app.

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

```js
const res = await fetch(`https://manage.restolayer.com/v1/private-endpoints/${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();
```

### POST /v1/private-endpoints/$ID/probe

Probe a private endpoint now: GET {base_url}/models with its key (5 s). The result is stored and shown; routing isn't blocked by it.

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

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

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