> This page is for Agent Handler.

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.merge.dev/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.merge.dev/_mcp/server.

# List API request logs

GET https://ah-api.merge.dev/api/v1/logs/api-calls/

Returns a cursor-paginated page of the organization's API request logs (outbound calls made during tool execution), ordered oldest-first. Poll repeatedly, passing the returned `next_cursor` as `cursor`, until `has_more` is false. Only the last 30 days of logs are available. Credential values in request/response headers (e.g. Authorization, API keys) are redacted. This endpoint is available on the Enterprise plan. Contact your account team to enable it.

Reference: https://docs.merge.dev/merge-agent-handler/agent-handler/logs/api-calls

## Authentication

- `Authorization` header (bearer token, required) — Token-based authentication with required prefix "Bearer"

## Request

### Query parameters

- `connector_id` (string, optional) — Filter by connector ID.
- `created_after` (datetime, optional) — Only logs at or after this timestamp (ISO 8601). Clamped to the last 30 days — older values are raised to the 30-day floor.
- `created_before` (datetime, optional) — Only logs at or before this timestamp (ISO 8601).
- `cursor` (string, optional) — Opaque cursor from a previous response's `next_cursor`.
- `method` (string, optional) — Filter by HTTP method (GET, POST, PUT, PATCH, DELETE).
- `page_size` (integer, optional) — Records per page (1-1000, default 100).
- `response_status` (integer, optional) — Filter by HTTP response status code.
- `toolcall_id` (string, optional) — Filter by the originating tool-call ID.

## Response

### 200

- `results` (list of ApiCallLogPublic, required)
- `next_cursor` (string, required, nullable)
- `has_more` (boolean, required)

## Types

### ApiCallLogPublic

A single API-request log record (one outbound call made during a tool call). Strict subset of the internal API-log payload (see ``LogDocument.to_api_dict``); omits the hydrated connector object and exposes its raw ID instead.

- `id` (string, required)
- `created_at` (datetime, required)
- `started_at` (datetime, optional, nullable)
- `ended_at` (datetime, optional, nullable)
- `request_id` (string, optional, nullable)
- `toolcall_id` (string, optional, nullable)
- `connector_id` (string, optional, nullable)
- `tool_name` (string, optional, nullable)
- `method` (string, optional, nullable)
- `url` (string, optional, nullable)
- `request_body` (string, optional, nullable)
- `request_headers` (string, optional, nullable)
- `response_body` (string, optional, nullable)
- `response_headers` (string, optional, nullable)
- `response_status` (integer, optional, nullable)

## Examples

**Response**

```json
{
  "results": [
    {
      "id": "string",
      "created_at": "2024-01-15T09:30:00Z",
      "started_at": "2024-01-15T09:30:00Z",
      "ended_at": "2024-01-15T09:30:00Z",
      "request_id": "string",
      "toolcall_id": "string",
      "connector_id": "string",
      "tool_name": "string",
      "method": "string",
      "url": "string",
      "request_body": "string",
      "request_headers": "string",
      "response_body": "string",
      "response_headers": "string",
      "response_status": 1
    }
  ],
  "next_cursor": "string",
  "has_more": true
}
```

**SDK Code**

```python
import requests

url = "https://ah-api.merge.dev/api/v1/logs/api-calls/"

headers = {"Authorization": "Bearer <token>"}

response = requests.get(url, headers=headers)

print(response.json())
```

```javascript
const url = 'https://ah-api.merge.dev/api/v1/logs/api-calls/';
const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://ah-api.merge.dev/api/v1/logs/api-calls/"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("Authorization", "Bearer <token>")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://ah-api.merge.dev/api/v1/logs/api-calls/")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.get("https://ah-api.merge.dev/api/v1/logs/api-calls/")
  .header("Authorization", "Bearer <token>")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://ah-api.merge.dev/api/v1/logs/api-calls/', [
  'headers' => [
    'Authorization' => 'Bearer <token>',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://ah-api.merge.dev/api/v1/logs/api-calls/");
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", "Bearer <token>");
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = ["Authorization": "Bearer <token>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://ah-api.merge.dev/api/v1/logs/api-calls/")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```