> ## Documentation Index
> Fetch the complete documentation index at: https://docs.notifique.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# API Logs

> Learn how to query API call history to audit integrations and debug errors.

<Tip>
  API logs are your integration **bank statement**: every HTTP call is recorded with request, response, and status. When something breaks, you see exactly what went in and what the API returned.
</Tip>

## What are API logs?

They are the history of **every call** made to the API in your workspace: method, endpoint, request body, response, and HTTP status.

Think of a card statement: it does not show whether the message reached the customer, but it shows **every transaction** between your system and Notifique.

## What are they for?

With logs you can:

* **Debug** 401, 403, or 400 errors in your integration
* **Audit** which API Key made each call
* **View** exact request and response (with sensitive data masked)
* **Filter** by status, method, date, or key
* **Cross-check** with [Error responses](/guides/conceitos/resposta-de-erros) to understand the returned `code`

## Logs vs webhooks

They complement each other; one does not replace the other:

| Situation                                 | API logs | Webhooks |
| ----------------------------------------- | -------- | -------- |
| Understand why the API returned 403       | **Yes**  | No       |
| Know which key made the call              | **Yes**  | No       |
| See HTTP request and response             | **Yes**  | No       |
| Know if the message reached the customer  | No       | **Yes**  |
| React in real time to delivery or failure | No       | **Yes**  |

<Note>
  **Webhooks** notify what happened to a **message** (delivered, failed, read). **API logs** record **who called the API** and what the API returned at request time.
</Note>

## How to query

### In the dashboard

1. Open **Logs** in the sidebar (or from **Developer Hub**)
2. Select the workspace (if you have more than one)
3. Filter by status, method, or date
4. Click an item to see full request and response

### Via API

#### 1. Permission

The key needs scope **`logs:read`**. Logs are limited to the key's **workspace**.

#### 2. List logs

Returns paginated history for the workspace.

```http theme={null}
GET https://api.notifique.dev/v1/logs?page=1&limit=20
Authorization: Bearer sk_live_xxxxx
```

Paginated response (`pagination.total`, `pagination.page`, `pagination.limit`, `pagination.totalPages`). Each item includes:

| Field                          | What it is                                 |
| ------------------------------ | ------------------------------------------ |
| `endpoint`                     | Path called (e.g. `/v1/whatsapp/messages`) |
| `method`                       | `GET`, `POST`, etc.                        |
| `status`                       | HTTP status returned                       |
| `requestBody` / `responseBody` | JSON sent and received                     |
| `requestQuery`                 | Query string, when present                 |
| `duration`                     | Request time in ms                         |
| `apiKeyId`                     | Key that made the call                     |
| `instanceId`                   | Related instance, if any                   |
| `userAgent` / `ip`             | Request metadata                           |
| `createdAt`                    | UTC timestamp                              |

#### 3. Filter results

| Parameter                   | Use                                                         |
| --------------------------- | ----------------------------------------------------------- |
| **page**                    | Page number (default 1)                                     |
| **limit**                   | Items per page (max 100)                                    |
| **status**                  | HTTP codes comma-separated (e.g. `200,202,403`)             |
| **startDate** / **endDate** | ISO 8601 range                                              |
| **method**                  | e.g. `GET,POST`                                             |
| **apiKeyId**                | Filter by workspace key (must belong to the same workspace) |

Example filtering 403 errors on POST:

```http theme={null}
GET https://api.notifique.dev/v1/logs?status=403&method=POST&startDate=2025-02-20T00:00:00.000Z&endDate=2025-02-20T23:59:59.000Z
Authorization: Bearer sk_live_xxxxx
```

<Warning>
  Tokens and sensitive data in logs appear as `[REDACTED]` before storage. See [Security and reliability](/guides/conceitos/seguranca-e-confiabilidade).
</Warning>

***

## Next steps

* [Error responses](/guides/conceitos/resposta-de-erros): HTTP codes and `code`
* [API Keys](/guides/api-key/index): scopes and `logs:read`
* [Webhooks](/guides/webhooks/index): real-time delivery status
* [Workspaces](/guides/workspaces/index): where workspace logs live
