# Batch files with curva map

> curva map answers the same questions for every state in a JSONL file, streaming it within your rate limits, and can be stopped and resumed at any point.

Source: https://docs.tarkova.com/curva/guides/batch/

`curva map` answers the same questions for every state in a JSONL file. It streams the file,
stays within your rate limits, and can be stopped and resumed at any point.

## Input

**`tickets.jsonl`**: one JSON state per line (blank lines are skipped).

```json
{"ticket": "I was charged twice for order A-104"}
{"ticket": "The app crashes on launch"}
```

**`questions.json`**: a JSON object of questions, exactly as in a
[`/v1/decide`](/curva/reference/http-api/#post-v1decide) request.

```json
{
  "team": {"type": "choice", "instructions": "Which team?",
           "options": {"billing": "payments, refunds", "technical": "bugs"}},
  "refund": {"type": "noul", "instructions": "The customer asks for a refund"}
}
```

## Run

```bash
export OPENROUTER_API_KEY=sk-or-v1-...
curva map tickets.jsonl -q questions.json -o answers.jsonl
```

Each output line has the input line number, the model that answered and the typed answers:

```json
{"line": 1, "model": "…", "answers": {"team": {"choice": "billing", "probabilities": {…}, "confidence": 0.99}, "refund": {"noul": 0.02}}}
```

## Resume

If the run stops (a daily quota, a network error, Ctrl-C), rerun the same command. It continues
after the last line written, so nothing is scored or paid for twice. Repeated states within a run
come from the cache.

## Options

```bash
curva map tickets.jsonl -q questions.json -o answers.jsonl \
  --model model-a,model-b          # a fallback chain
  # or: --council a,b | --cascade a,b --escalate-below 0.8 | --race a,b
  # plus: --mode auto|logprobs|verbal, --no-debias (half the calls)
```

The full list is in the [CLI reference](/curva/reference/cli/#curva-map). To cap spending on a
free tier, set `CURVA_DAILY_LIMIT` to the number of model calls allowed per day.
