# API: Provider keys

| Method | Path | What it does | Scope |
|---|---|---|---|
| GET | `/v1/provider-keys` | Your own provider keys (BYOK): used first for that provider's models, free of any fee. The secret is never shown. | `gateway:read` |
| POST | `/v1/provider-keys` | Add your key for a provider (web app only), sealed at rest and used only for your requests. Several active keys for one provider split its traffic by weight; replace: true disables the others. (web app only) | `gateway:write` |
| DELETE | `/v1/provider-keys/:id` | Delete a provider key (web app only); the sealed secret goes with it (web app only) | `gateway:write` |
| PATCH | `/v1/provider-keys/:id` | Rename or disable a provider key (re-enabling is done in the web app) | `gateway:write` |

## Examples

### GET /v1/provider-keys

Your own provider keys (BYOK): used first for that provider's models, free of any fee. The secret is never shown.

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

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

### PATCH /v1/provider-keys/$ID

Rename or disable a provider key (re-enabling is done in the web app)

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

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