# Preview a route

Source: https://immiscible.fly.dev/docs/api/post-v1-route-preview

`POST /v1/route/preview`

What the router would choose for a task class, estimate and objective, and why, without calling a model. `409` with `policy_conflict` when nothing qualifies, naming what relaxing would admit.

## Authentication

Workspace key. A gateway key (`ask_...`) issued under Keys in the console, sent as `Authorization: Bearer` or `x-api-key`. It binds traffic to a person or service, a team and optionally a task class.

## Request

curl:

```bash
curl -X POST "https://immiscible.fly.dev/v1/route/preview" \
  -H "authorization: Bearer $IMMISCIBLE_KEY" \
  -H "content-type: application/json" \
  -d '{
    "taskClass": "support.triage",
    "objective": "cost",
    "estimate": {
      "inputTokens": 1200,
      "outputTokens": 200
    }
  }'
```

Node:

```ts
const res = await fetch('https://immiscible.fly.dev/v1/route/preview', {
  method: 'POST',
  headers: {
    authorization: `Bearer ${process.env.IMMISCIBLE_KEY}`,
    'content-type': 'application/json',
  },
  body: JSON.stringify({
    taskClass: 'support.triage',
    objective: 'cost',
    estimate: {
      inputTokens: 1200,
      outputTokens: 200,
    },
  }),
});
const data = await res.json();
console.log(res.status, data);
```

Python:

```python
import os
import requests

res = requests.post(
    "https://immiscible.fly.dev/v1/route/preview",
    headers={
        "authorization": f"Bearer {os.environ['IMMISCIBLE_KEY']}",
        "content-type": "application/json",
    },
    json={
        "taskClass": "support.triage",
        "objective": "cost",
        "estimate": {
            "inputTokens": 1200,
            "outputTokens": 200,
        },
    },
)
print(res.status_code, res.json())
```
