# Search and retrieve tool execution logs

**Documentation:** /reference/api-reference/logs/postLogsToolExecution

Search and retrieve tool execution logs with filtering, pagination, and time range support.

---

## POST `/api/v3.1/logs/tool_execution`

**Endpoint:** `https://backend.composio.dev/api/v3.1/logs/tool_execution`

**Summary:** Search and retrieve tool execution logs

Search and retrieve tool execution logs with filtering, pagination, and time range support.

### Authentication

**ApiKeyAuth** - API Key in `header` header `x-api-key` OR **UserApiKeyAuth** - API Key in `header` header `x-user-api-key`

### Request Body

**Schema:**

- `limit` (number)
- `cursor` (string,null)
- `filters` (array<object>)
  - Array items:
    - `field` (enum: "tool_slug" | "toolkit_slug" | "connected_account_id" | ...) *(required)*
    - `operator` (enum: "==" | "!=" | "contains" | ...) *(required)*
    - `value` (string) *(required)*
- `time_range` (object)
  - `from` (number) *(required)*: Start time in epoch milliseconds
  - `to` (number) *(required)*: End time in epoch milliseconds

**Example:**

```json
{
  "limit": 20,
  "cursor": null,
  "filters": [],
  "time_range": {
    "from": 1,
    "to": 1
  }
}
```

### Responses

#### 200 - Successfully retrieved tool logs

**Response Schema:**

- `logs` (array<object>) *(required)*
  - Array items:
    - `id` (string) *(required)*
    - `timestamp` (string (date-time)) *(required)*: ISO 8601 timestamp
    - `type` (string) *(required)*: Log event type, e.g. tool.execution, trigger.message, connected_account.created
    - `status` (enum: "success" | "failed") *(required)*
    - `level` (enum: "info" | "error" | "warn") *(required)*
    - `message` (string)
    - `metadata` (object) *(required)*
      - `[key: string]` (any)
    - `metrics` (object) *(required)*
      - `[key: string]` (any)
    - `parent` (object,null) *(required)*
- `next_cursor` (string,null) *(required)*

**Example Response:**

```json
{
  "logs": [
    {
      "id": "string",
      "timestamp": "2024-01-15T10:30:00Z",
      "type": "string",
      "status": "success",
      "level": "info",
      "message": "string",
      "metadata": {
        "key": "..."
      },
      "metrics": {
        "key": "..."
      },
      "parent": null
    }
  ],
  "next_cursor": null
}
```

#### 400 - Bad request

**Response Schema:**

- `error` (object) *(required)*
  - `message` (string) *(required)*
  - `code` (number) *(required)*
  - `slug` (string) *(required)*
  - `status` (number) *(required)*
  - `request_id` (string)
  - `suggested_fix` (string)
  - `errors` (array<string>)

#### 401 - Unauthorized

**Response Schema:**

- `error` (object) *(required)*
  - `message` (string) *(required)*
  - `code` (number) *(required)*
  - `slug` (string) *(required)*
  - `status` (number) *(required)*
  - `request_id` (string)
  - `suggested_fix` (string)
  - `errors` (array<string>)

#### 500 - Internal server error

**Response Schema:**

- `error` (object) *(required)*
  - `message` (string) *(required)*
  - `code` (number) *(required)*
  - `slug` (string) *(required)*
  - `status` (number) *(required)*
  - `request_id` (string)
  - `suggested_fix` (string)
  - `errors` (array<string>)

### Example cURL Request

```bash
curl -X POST "https://backend.composio.dev/api/v3.1/logs/tool_execution" \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "limit": 20,
    "cursor": null,
    "filters": [],
    "time_range": {
      "from": 1,
      "to": 1
    }
  }'
```