# List Logs

> GET /logs — list the API request logs for your account.

`GET /logs`

List the API request logs for your account. Each entry records a request made with one of your API keys — the `endpoint`, `method`, `response_status`, and originating `user_agent`. Use a log's `id` to fetch the full request and response bodies with [GET /logs/:id](https://www.sendping.co/docs/api/logs-get).

> **Note:** This endpoint is always paginated. See [Pagination](https://www.sendping.co/docs/api/pagination) for navigating with `limit`, `after`, and `before`.

## Query parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `limit` | number | No | Number of logs to retrieve per page. Default `20`, maximum `100`, minimum `1`. |
| `after` | string | No | The log `id` **after** which more logs are retrieved. The passed id is not included. Cannot be combined with `before`. |
| `before` | string | No | The log `id` **before** which more logs are retrieved. The passed id is not included. Cannot be combined with `after`. |
| `method` | string | No | Filter to an exact HTTP method, e.g. `POST` or `GET`. |
| `status` | number | No | Filter to an exact HTTP response status code, e.g. `200` or `429`. |

## Response fields

Each item in `data` is a log reference:

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `object` | string | No | Always `log`. |
| `id` | string | No | The log id — a numeric string (e.g. `"48213"`), not a UUID. Use it verbatim as an `after`/`before` cursor. |
| `created_at` | string | No | When the request was made. |
| `endpoint` | string | No | The request path, including the `/api` base (e.g. `/api/emails`). |
| `method` | string | No | The HTTP method (e.g. `POST`). |
| `response_status` | number | No | The HTTP status code returned. |
| `user_agent` | string | No | The `User-Agent` of the caller. |

## Request

**Node.js**

```js
import { SendPing } from 'sendping';

const mb = new SendPing('mb_xxxxxxxxx');

const { data, error } = await mb.logs.list();
console.log({ data, error });
```

**Ruby**

```ruby
require "sendping"

SendPing.api_key = "mb_xxxxxxxxx"

SendPing::Logs.list
```

**PHP**

```php
<?php
require 'vendor/autoload.php';

use SendPing\SendPing;

$sendping = SendPing::client('mb_xxxxxxxxx');

$sendping->logs->list();
```

**Python**

```python
import sendping

sendping.api_key = "mb_xxxxxxxxx"

sendping.Logs.list()
```

**Go**

```go
import "github.com/shekhu10/sendping-sdks/sendping-go"

client := sendping.NewClient("mb_xxxxxxxxx")

logs, err := client.Logs.List(nil)
```

**Rust**

```rust
use sendping::SendPing;

let mb = SendPing::new("mb_xxxxxxxxx");

let _logs = mb.logs.list(None).await?;
```

**Java**

```java
import co.sendping.SendPing;
import co.sendping.SendPingResponse;

SendPing sendping = new SendPing("mb_xxxxxxxxx");

SendPingResponse response = sendping.logs().list();
```

**.NET**

```csharp
using SendPing;

ISendPing sendping = SendPingClient.Create("mb_xxxxxxxxx");

var resp = await sendping.LogListAsync();
```

**cURL**

```bash
curl -X GET 'https://www.sendping.co/api/logs' \
  -H 'Authorization: Bearer mb_xxxxxxxxx'
```

**CLI**

```bash
sendping logs list
```

## Response

```json
{
  "object": "list",
  "has_more": false,
  "data": [
    {
      "object": "log",
      "id": "48213",
      "created_at": "2026-06-23T13:43:54.622Z",
      "endpoint": "/api/emails",
      "method": "POST",
      "response_status": 200,
      "user_agent": "curl/8.7.1"
    },
    {
      "object": "log",
      "id": "48212",
      "created_at": "2026-06-23T12:15:00.123Z",
      "endpoint": "/api/emails/4ef9a417-02e9-4d39-ad75-9611e0fcc33c",
      "method": "GET",
      "response_status": 200,
      "user_agent": "python-requests/2.31.0"
    }
  ]
}
```

## Errors

Returns `validation_error` if `limit` is outside 1–100 or if both `before` and `after` are supplied. A malformed or unknown cursor is **not** an error — it returns an empty page (`data: []`, `has_more: false`). See the [error reference](https://www.sendping.co/docs/api/errors).
