# Make

> Call Curva from a Make scenario over HTTP and route bundles on its typed, calibrated answer with a Router.

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

Call Curva from a Make scenario and route bundles on the typed answer with a Router.

:::note[Generic HTTP, no official app yet]
There is no Curva app in Make's marketplace yet. This guide uses Make's built-in **HTTP**
and **JSON** apps to call the [HTTP API](/curva/reference/http-api/). Your Curva server must be
reachable from the internet (see [Self-hosting](/curva/self-hosting/)) and should have an API key.
:::

## 1. Build the request body

Mapped text can hold quotes and newlines, so build the body with **JSON → Create JSON** rather
than typing JSON around mapped values. Create a data structure with the request fields (or paste
the example below into the structure generator), then map your trigger's fields into `state`:

```json
{
  "project": "support",
  "state": {"subject": "…", "body": "…"},
  "questions": {
    "department": {
      "type": "choice",
      "instructions": "Which team should handle this",
      "options": {"billing": "Payments, refunds", "technical": "Bugs", "sales": "Pricing"},
      "min_confidence": 0.8
    },
    "refund": {"type": "noul", "instructions": "The customer explicitly asks for a refund"}
  }
}
```

## 2. Call `/v1/decide`

Add **HTTP → Make a request**:

| Field | Value |
|---|---|
| URL | `https://curva.example.com/v1/decide` |
| Method | `POST` |
| Headers | `Authorization` = `Bearer curva_…` |
| Body type | Raw, content type `JSON (application/json)` |
| Request content | the **JSON string** output of step 1 |
| Parse response | Yes |

Run it once so Make learns the response shape. The answers are then mappable as
`Data → answers → department → choice`, `… → confidence`, `… → abstain`,
`Data → answers → refund → noul`, and the decision id as `Data → id`.

## 3. Route on the answer

Add a **Router** after the HTTP module, with a filter on each route:

| Route | Filter |
|---|---|
| Human review | `answers.department.abstain`, Boolean operators: Equal to, `true` |
| Billing | `answers.department.choice`, Text operators: Equal to, `billing` |
| Technical | `answers.department.choice`, Text operators: Equal to, `technical` |

Make runs every route whose filter passes, so give the choice routes a second condition,
`abstain` not equal to `true`, and an unsure answer only reaches the human route. `abstain` is
set because the question has `min_confidence`; on that route, create a task for a person. A Noul
is a probability: filter on `answers.refund.noul` with Numeric operators: Greater than `0.9`.

Store `Data → id` (the decision id) with whatever the scenario creates.

## 4. Send feedback

When the true answer is known, send it with another **HTTP → Make a request**, `POST` to
`https://curva.example.com/v1/feedback`, same header, raw JSON body:

```json
{"decision_id": "dec_…", "question": "department", "label": "billing"}
```

From 30 labels for a question, its answers are calibrated whenever that makes them more accurate. See
[Calibrate with feedback](/curva/guides/feedback/).

## Check an action or screen a text

The same **HTTP → Make a request** to `/v1/decide` checks an action before a later module takes
it, or screens an email or form text before an AI module reads it. Build the body with
**JSON → Create JSON**:

```json
{"ask": "check", "state": {"action": {"tool": "refund", "amount": 500}, "policy": "Refunds above $200 need a manager's approval."}}
{"ask": "guard", "state": "…"}
```

Add a **Router**: for the check, `answers.check.abstain` equal to `true` → a person, then
`answers.check.choice` equal to `allow` or `block`; for the screen, `answers.verdict.abstain`
equal to `true` or `answers.verdict.choice` equal to `review` → a person, `block` → stop. The
fields and the default policy are in
[Check an action or screen a text](/curva/guides/any-http-tool/#check-an-action-or-screen-a-text).

## Errors and retries

Curva errors are JSON with a 4xx or 5xx status, which makes the HTTP module fail. Add an error
handler (**Break** with retries) for `429` (it carries `Retry-After`) and `502`. See the
[error list](/curva/reference/http-api/#errors).
