# API quickstart (/docs/getting-started/api-quickstart)



Execute a published decision with a `POST` to its key, authenticated with an API key.

## Create an API key [#create-an-api-key]

In the console, go to **Settings** and create an **API key**. Copy it immediately: it is shown
once and only its hash is stored. The key belongs to the project you are in and can only execute
that project's decisions.

Send it in the `x-api-key` header (an `Authorization: Bearer <key>` header works too).

## Execute a decision [#execute-a-decision]

The body is a JSON object validated against the decision's input model. The seeded
`transaction-monitoring` decision flags high-value transactions into high-risk countries:

```bash
curl -s -X POST http://localhost:3100/api/v1/decisions/transaction-monitoring/execute \
  -H 'content-type: application/json' \
  -H "x-api-key: $DECISION_API_KEY" \
  -d '{"customer_id":"C-1001","amount":15000,"currency":"USD","country":"DO"}'
```

```json
{
  "execution_id": "DEC-874981",
  "decision": "HOLD",
  "version": 1,
  "outputs": {
    "alert": true,
    "severity": "HIGH",
    "decision": "HOLD",
    "reason": "Transaction above 10,000 going to a high risk country"
  },
  "actions": ["createAlert", "sendWebhook"],
  "reasons": [
    { "rule": "Above 1,000?", "actual": 15000, "expected": "> 1000", "outcome": "matched" },
    {
      "rule": "Customer risk check / Amount",
      "actual": 15000,
      "expected": "> 10000",
      "outcome": "matched"
    },
    {
      "rule": "Customer risk check / Country",
      "actual": "DO",
      "expected": "in [DO, RU, NG]",
      "outcome": "matched"
    }
  ],
  "meta": { "status": "success", "duration_ms": 39, "trace_url": "/api/v1/executions/DEC-874981" }
}
```

The response carries the decision, the outputs, the requested actions and the reasons.

## Pin a version [#pin-a-version]

By default the call runs the version deployed to the key's environment (`latest`). Pin an exact
version, or a tag, with the query string or a header:

```bash
curl -s -X POST 'http://localhost:3100/api/v1/decisions/transaction-monitoring/execute?version=1' ...
curl -s -X POST 'http://localhost:3100/api/v1/decisions/transaction-monitoring/execute?version=tag:stable' ...
# or the X-Decision-Version header
```

## Next [#next]

* [Executing decisions](/docs/integrate/executing) — batch execution, rate limits and version pinning.
* [API keys](/docs/integrate/api-keys) — scopes and per-key limits.
