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

# Funds & Credentials

> Spending funds and exchange API credentials

**Funds** cap how much capital a strategy can commit. **Credentials** are the
exchange API keys Krisis uses to place live orders on your behalf. Both are
optional at create time — but a strategy that places real orders needs
credentials for its exchange, and linking a fund is how you bound its risk.
Set both up before you arm anything you expect to trade.

All endpoints require `Authorization: Bearer <jwt>`.

## How a funding or credential failure surfaces

<Note>
  **Gotcha: a missing fund or credential does not fail any request.** Because
  both are optional at create time, a strategy arms happily without them and the
  shortfall only surfaces when it tries to fire. The engine records that attempt
  as an execution with `action_taken: false` and a `skip_reason`, and returns no
  error to anyone. A strategy can sit "armed" for days and never trade.
</Note>

| `skip_reason` | When it happens | What to do |
| - | - | - |
| `no_fund` | The strategy references a fund that is missing or inactive | Recreate the fund or set `is_active: true` |
| `insufficient_balance` | The fund has no headroom left for the order's cost | Raise `balance_limit`, or wait for reservations to release |
| `no_credentials` | No active credential stored for the strategy's `exchange_id` | [Add a credential](#add-or-update-a-credential) for that exchange |
| `invalid_action_config` | The strategy's [`action_config`](/krisis/strategies#action_config) is missing or unusable | Fix it via `PUT /api/v1/strategies/{id}` |
| `cooldown` | The strategy fired too recently | Nothing — it will re-evaluate |

Poll [`GET /api/v1/executions`](/krisis/positions-pnl#list-executions) or watch the
`trigger` events on [the SSE stream](/krisis/positions-pnl#real-time-events) — both
carry `skip_reason` — to see why a strategy is armed but not trading.

## Funds

A fund is a named spending limit. When a strategy with a `fund_id` fires, the
order cost is reserved against the fund; the reservation is released on a
terminal order state. A strategy can only fire while its fund has headroom.

<Note>
  **Gotcha: a fund is not the only cap.** A strategy can also carry its own
  allocation in [`action_config.total_capital`](/krisis/strategies#action_config), which
  is what the `strategy_capital_remaining` and `strategy_spent`
  [DSL variables](/krisis/strategies#dsl-variables) read. Absent, that allocation is
  uncapped and only the fund (if any) bounds the strategy — so a strategy with
  neither is unbounded.
</Note>

### List funds

```
GET /api/v1/funds
```

#### Response

Array of fund objects.

| Field | Type | Description |
| - | - | - |
| `id` | uuid | Fund id |
| `name` | string | Display name |
| `balance_limit` | number | Spending cap |
| `balance_used` | number | Currently reserved / committed |
| `is_active` | boolean | Whether the fund can back new orders |
| `created_at` | string | ISO 8601 |
| `updated_at` | string | ISO 8601 |

### Create fund

```
POST /api/v1/funds
```

Returns `201 Created` with the fund object.

#### Request

| Name | Type | Required | Default | Description |
| - | - | - | - | - |
| `name` | string | Yes | — | Display name |
| `balance_limit` | number | Yes | — | Spending cap; must be `> 0`. Also accepted as `balance` |

#### Example

```bash theme={null}
curl -X POST https://krisis.kairos.trade/api/v1/funds \
  -H "Authorization: Bearer $JWT" \
  -H "Content-Type: application/json" \
  -d '{ "name": "BTC desk", "balance_limit": 5000 }'
```

### Get fund

```
GET /api/v1/funds/{id}
```

Returns one fund object, or `404`.

### Update fund

```
PUT /api/v1/funds/{id}
```

Returns the updated fund object.

#### Request

All fields optional.

| Name | Type | Required | Default | Description |
| - | - | - | - | - |
| `name` | string | No | unchanged | Rename |
| `balance_limit` | number | No | unchanged | New cap; must be `> 0` |
| `is_active` | boolean | No | unchanged | Enable / disable the fund |

Disabling a fund makes every strategy linked to it skip with `no_fund` — see
[the table above](#how-a-funding-or-credential-failure-surfaces).

### Delete fund

```
DELETE /api/v1/funds/{id}
```

Returns `204 No Content`.

## Credentials

Credentials are per-exchange API keys. Krisis encrypts the secret material at
rest and only ever returns a redacted hint — the raw key and secret are never
echoed back, so store your own copy.

### List credentials

```
GET /api/v1/credentials
```

#### Response

Array of credential objects.

| Field | Type | Description |
| - | - | - |
| `exchange_id` | string | `"kalshi"` or `"polymarket"` |
| `client_id` | string | Exchange client id |
| `api_key_hint` | string | Redacted key — last 4 characters only (e.g. `"****abcd"`) |
| `is_active` | boolean | Whether the credential is usable |
| `created_at` | string | ISO 8601 |
| `updated_at` | string | ISO 8601 |

### Add or update a credential

```
POST /api/v1/credentials
```

Upserts the credential for an exchange — **posting again for the same
`exchange_id` replaces the stored key**, it does not create a second one.
Returns `201 Created` with the credential object (redacted hint only).

#### Request

| Name | Type | Required | Default | Description |
| - | - | - | - | - |
| `exchange_id` | string | Yes | — | `"kalshi"` or `"polymarket"` |
| `client_id` | string | Yes | — | Exchange client id |
| `api_key` | string | Yes | — | API key — encrypted before storage |
| `api_secret` | string | Yes | — | API secret — encrypted before storage |

#### Example

```bash theme={null}
curl -X POST https://krisis.kairos.trade/api/v1/credentials \
  -H "Authorization: Bearer $JWT" \
  -H "Content-Type: application/json" \
  -d '{
    "exchange_id": "kalshi",
    "client_id": "your-client-id",
    "api_key": "…",
    "api_secret": "…"
  }'
```

### Delete a credential

```
DELETE /api/v1/credentials/{exchange_id}
```

Returns `204 No Content`. Strategies on that exchange then skip with
`no_credentials`.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.