# Stop an integration.

> Cancels its check or resolver agent.
> https://koi.dog/docs/api/crews/cancel-integration/

`POST /api/v1/integrations/{id}/cancel` · Scope: `crews`

The branch stays in the mirror where it got to.

## Path parameters.

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | `string` | yes | The integration's id. |

## Headers.

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `Idempotency-Key` | `string` | no | Retry the same request with the same key. [Retry rules](https://koi.dog/docs/api/#retries). |

## Response.

200 OK · JSON object

## Request.

```sh
curl -X POST "https://api.koi.dog/api/v1/integrations/$ID/cancel" \
    -H "Authorization: Bearer $KOIDOG_API_KEY" \
    -H "Idempotency-Key: $(uuidgen)"
```

```js
const res = await fetch(`https://api.koi.dog/api/v1/integrations/${process.env.ID}/cancel`, {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.KOIDOG_API_KEY}`,
    "Idempotency-Key": crypto.randomUUID(),
  },
});
console.log(await res.json());
```

```python
import os
import uuid

import requests

r = requests.post(
    f"https://api.koi.dog/api/v1/integrations/{os.environ['ID']}/cancel",
    headers={
        "Authorization": f"Bearer {os.environ['KOIDOG_API_KEY']}",
        "Idempotency-Key": str(uuid.uuid4()),
    },
)
r.raise_for_status()
print(r.json())
```

## Response example.

```json
{
  "id": "string",
  "crewId": "string",
  "projectId": "string",
  "state": "merging",
  "stateReason": "string",
  "branch": "string",
  "baseSha": "string",
  "tipSha": "string",
  "branches": [],
  "checks": {
    "declared": false,
    "passed": false,
    "checkedSha": "string",
    "taskId": "string",
    "runId": "string",
    "results": []
  },
  "options": {
    "resolveConflicts": false,
    "openPr": false
  },
  "pullRequest": {
  },
  "by": {
  },
  "createdAt": "string",
  …
}
```
