# Connect a vendor for discovery

Source: https://immiscible.fly.dev/docs/api/put-api-w-wid-discovery-vendor

`PUT /api/w/:wid/discovery/:vendor`

Owners and admins. `:vendor` is `openai`, `anthropic` or `openrouter`. The credential is checked with the vendor first, then sealed; it is never shown again. A first sync runs at once unless `syncNow` is `false`.

| Field | Description |
|---|---|
| `secret` | an OpenAI admin key, an Anthropic admin key (`sk-ant-admin...`), or an OpenRouter management key |
| `policy` | for keys made outside Immiscible: `record` (default), `alert` (email the owners), or `revoke` (alert, and file a revocation proposal) |
| `syncHours` | how often the scheduled sync runs, 1 to 168 (default 6) |

## Authentication

Session cookie. A signed-in person: the console's session cookie. Every state-changing request also carries the header `x-immiscible-csrf: 1`, and the member's role decides what it may do. Bearer tokens are ignored on these routes, so no machine credential can reach them.

## Path parameters

- `wid` (string, required): Workspace id
- `vendor` (string, required): The vendor

## Request

curl:

```bash
curl -X PUT "https://immiscible.fly.dev/api/w/$IMMISCIBLE_WORKSPACE/discovery/vendor" \
  -H "cookie: __Host-sid=$IMMISCIBLE_SESSION" \
  -H "x-immiscible-csrf: 1" \
  -H "content-type: application/json" \
  -d '{
    "secret": "sk-admin-...",
    "policy": "alert",
    "syncHours": 6
  }'
```

Node:

```ts
const res = await fetch('https://immiscible.fly.dev/api/w/$IMMISCIBLE_WORKSPACE/discovery/vendor', {
  method: 'PUT',
  headers: {
    cookie: `__Host-sid=${process.env.IMMISCIBLE_SESSION}`,
    'x-immiscible-csrf': '1',
    'content-type': 'application/json',
  },
  body: JSON.stringify({
    secret: 'sk-admin-...',
    policy: 'alert',
    syncHours: 6,
  }),
});
const data = await res.json();
console.log(res.status, data);
```

Python:

```python
import os
import requests

res = requests.put(
    "https://immiscible.fly.dev/api/w/$IMMISCIBLE_WORKSPACE/discovery/vendor",
    headers={
        "cookie": f"__Host-sid={os.environ['IMMISCIBLE_SESSION']}",
        "x-immiscible-csrf": "1",
        "content-type": "application/json",
    },
    json={
        "secret": "sk-admin-...",
        "policy": "alert",
        "syncHours": 6,
    },
)
print(res.status_code, res.json())
```
