> ## Documentation Index
> Fetch the complete documentation index at: https://read.sqwish.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Route a support request

> Classify a message, choose a team, and assess urgency in one request.

One customer message can answer several questions for your application. This
example combines D1’s three question types to help route a support request.

## Define the questions

Save this body as `prediction.json`:

```json prediction.json theme={null}
{
  "model": "default",
  "context": {
    "message": "My parcel arrived with a cracked mug. Please help.",
    "days_since_delivery": 1
  },
  "questions": [
    {
      "id": "needs_help",
      "type": "binary",
      "prompt": "Does the customer need support?"
    },
    {
      "id": "team",
      "type": "choice",
      "prompt": "Which team should handle this message?",
      "options": [
        { "id": "support", "description": "Customer support" },
        { "id": "sales", "description": "Sales" }
      ]
    },
    {
      "id": "urgency",
      "type": "score",
      "prompt": "How urgent is the issue?",
      "levels": ["Low urgency", "Moderate urgency", "High urgency"]
    }
  ]
}
```

## Send one request

Set `D1_API_URL` and `D1_API_KEY` as shown in the [quickstart](/quickstart).
Generate a fresh key once, then keep it with this request for any retries.

```bash theme={null}
export D1_OPERATION_KEY="$(python3 -c 'import uuid; print(uuid.uuid4())')"

curl --fail-with-body --connect-timeout 5 --max-time 40 \
  "$D1_API_URL/v1/predictions" \
  -H "Authorization: Bearer $D1_API_KEY" \
  -H 'Content-Type: application/json' \
  -H "Idempotency-Key: $D1_OPERATION_KEY" \
  --data-binary @prediction.json
```

## Use the answers

Answers arrive in the same order and retain the IDs you supplied.

| Question     | Read                     | Use it for                                             |
| ------------ | ------------------------ | ------------------------------------------------------ |
| `needs_help` | `probability_true`       | Decide whether to queue the message for support        |
| `team`       | `selected` and `options` | Route to a team and inspect the scores for each option |
| `urgency`    | `value`                  | Rank messages on the three-level rubric, from 0 to 2   |

A score can be fractional. Choose your own routing thresholds using representative
examples; model scores do not establish probability calibration.

<Note>
  Staging answers are simulated. Use them to test request handling and routing
  code, then evaluate a real model before making decisions from its scores.
</Note>

See [Create a prediction](/api-reference/predictions/create-a-prediction) for the
full response schema, or [reliable retries](/examples/reliable-retries) to handle
an interrupted request.
