# Set a category's merchant codes

Source: https://immiscible.fly.dev/docs/api/put-api-w-wid-issuing-categories-category

`PUT /api/w/:wid/issuing/categories/:category`

Owners. Four-digit codes or ranges such as `3000-3999`; cash, transfer and gambling codes are refused. `null` or an empty list goes back to the built-in codes. Widening a category is a card change, so with colleagues in the workspace it is a proposal a second owner confirms (`202`); narrowing applies at once. Recorded in the ledger as `issuing_categories_changed`.

## 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
- `category` (string, required): The category

## Request

curl:

```bash
curl -X PUT "https://immiscible.fly.dev/api/w/$IMMISCIBLE_WORKSPACE/issuing/categories/category" \
  -H "cookie: __Host-sid=$IMMISCIBLE_SESSION" \
  -H "x-immiscible-csrf: 1" \
  -H "content-type: application/json" \
  -d '{
    "codes": [
      "7375",
      "8999"
    ]
  }'
```

Node:

```ts
const res = await fetch('https://immiscible.fly.dev/api/w/$IMMISCIBLE_WORKSPACE/issuing/categories/category', {
  method: 'PUT',
  headers: {
    cookie: `__Host-sid=${process.env.IMMISCIBLE_SESSION}`,
    'x-immiscible-csrf': '1',
    'content-type': 'application/json',
  },
  body: JSON.stringify({
    codes: ['7375', '8999'],
  }),
});
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/issuing/categories/category",
    headers={
        "cookie": f"__Host-sid={os.environ['IMMISCIBLE_SESSION']}",
        "x-immiscible-csrf": "1",
        "content-type": "application/json",
    },
    json={
        "codes": ["7375", "8999"],
    },
)
print(res.status_code, res.json())
```
