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

# Update and cancel

> POST /v1/competitions/update and /cancel: change any rule of a competition at any time, recorded in its rules history, or cancel it.

## Update

`POST /v1/competitions/update`

Changes any rule of a competition at any time before it ends, also while it runs. Pass the `id` and only the fields you want to change, with the same values as in [Create a competition](https://docs.cabalspy.xyz/cabalspy-id/competitions-create.md#body).

Each real change raises `rules_version` by one, is recorded in the [rules history](https://docs.cabalspy.xyz/cabalspy-id/competitions-list.md#rules-history) with the phase it happened in and your note, and is sent as the `competition.updated` [webhook](https://docs.cabalspy.xyz/cabalspy-id/webhooks.md#competition-events). Fields sent with their current value are not a change; if nothing changes, the competition is returned as it is.

* Changing `duration_hours` while running moves `ends_at` to `started_at` plus the new duration.
* Switching `enrollment` to `all_users` enters every platform user.
* New metrics, minimums and wallet rules apply from the next standings computation.

**id** `string` *required*

The competition id.

**note** `string`

Why you changed it, at most 500 characters. Shown in the rules history and the webhook.

**name, description, chain, metric, wallet\_trust, enrollment, starts\_at, duration\_hours, min\_participants, max\_participants, min\_trades, min\_volume\_usd, late\_join, prizes** `any`

The fields to change. At least one.

```bash cURL theme={null}
curl -X POST "https://api-id.cabalspy.xyz/v1/competitions/update" \
  -H "Authorization: Bearer YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{"id": "9c1d2e3f-4a5b-4c6d-8e7f-0a1b2c3d4e5f", "duration_hours": 72, "note": "Extended by one day after the outage."}'
```

```python Python theme={null}
import requests

r = requests.post("https://api-id.cabalspy.xyz/v1/competitions/update", json={
    "id": "9c1d2e3f-4a5b-4c6d-8e7f-0a1b2c3d4e5f",
    "min_trades": 5,
    "note": "Raised the minimum to stop wash trades.",
}, headers={"Authorization": "Bearer YOUR_KEY"})
c = r.json()["data"]
print(c["rules_version"], c["changes"][-1])
```

```javascript JavaScript theme={null}
const res = await fetch("https://api-id.cabalspy.xyz/v1/competitions/update", {
  method: "POST",
  headers: { Authorization: "Bearer YOUR_KEY", "Content-Type": "application/json" },
  body: JSON.stringify({ id: "9c1d2e3f-4a5b-4c6d-8e7f-0a1b2c3d4e5f", prizes: [{ rank: 1, prize: "2,000 USDC" }] }),
});
const { data } = await res.json();
console.log(data.rules_version);
```

Returns the [competition object](https://docs.cabalspy.xyz/cabalspy-id/competitions-create.md#response) with its rules history.

## Cancel

`POST /v1/competitions/cancel`

Cancels a scheduled, waiting or running competition. Its status becomes `cancelled`, it no longer counts towards your 5 open competitions, and the `competition.ended` webhook is sent with `"cancelled": true` and no results.

**id** `string` *required*

The competition id.

```bash theme={null}
curl -X POST "https://api-id.cabalspy.xyz/v1/competitions/cancel" \
  -H "Authorization: Bearer YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{"id": "9c1d2e3f-4a5b-4c6d-8e7f-0a1b2c3d4e5f"}'
```

Returns the competition object with status `cancelled`.

## Errors

| Status | Code | Meaning |
| - | - | - |
| 400 | missing\_parameter | id missing, or no field to change. |
| 400 | invalid\_parameter | A field has an invalid value, or an unknown field was sent. |
| 401 | missing\_api\_key | API key missing. |
| 403 | invalid\_api\_key | API key invalid or not enabled for CabalSpy ID. |
| 404 | competition\_not\_found | No competition with this id in your instance. |
| 409 | competition\_closed | The competition already ended or was cancelled. |
| 429 | rate\_limit\_exceeded | Rate limit exceeded. |

See [Errors](https://docs.cabalspy.xyz/cabalspy-id/errors.md) for the full list.


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