# Release something a tool call rented, now.

> Asks Monid to release it (safe to repeat).
> https://koi.dog/docs/api/tools/release-tool-lease/

`POST /api/v1/tool-leases/{id}/release` · Scope: `config`

Answers the lease: `releasing` until Monid says it is released, or `release_failed` with `lastError` (Koidog asks again). `409 conflict` when it is already released. `409 not_configured` on a server without Monid turned on: nothing is asked and nothing recorded (release it at Monid). The timeline records the key ID, action and outcome.

## Path parameters.

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | `string` | yes | The tool lease'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/tool-leases/$ID/release" \
    -H "Authorization: Bearer $KOIDOG_API_KEY" \
    -H "Idempotency-Key: $(uuidgen)"
```

```js
const res = await fetch(`https://api.koi.dog/api/v1/tool-leases/${process.env.ID}/release`, {
  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/tool-leases/{os.environ['ID']}/release",
    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",
  "runId": "string",
  "callId": "string",
  "toolProvider": "string",
  "resourceType": "string",
  "resourceId": "string",
  "identifier": "string",
  "state": "active",
  "rent": "string",
  "chargedUsd": 0,
  "createdAt": "string",
  "releasedAt": "string",
  "observedAt": "string",
  …
}
```
