# List Logs

> Paginate through logs of published messages

## Endpoint

`GET https://qstash-{region}.upstash.io/v2/logs`

## Parameters

- `cursor` (query, string): By providing a cursor you can paginate through all of the logs
- `messageId` (query, string): Filter logs by message ID
- `state` (query, enum<string>): Filter logs by message state

|Value	|Description|
|-------|------------|
| CREATED	|The message has been accepted and stored in QStash|
| ACTIVE	|The task is currently being processed by a worker.|
| RETRY	|The task has been scheduled to retry.|
| ERROR	|The execution threw an error and the task is waiting to be retried or failed.|
| IN_PROGRESS	|The task is in one of ACTIVE, RETRY or ERROR state.|
| DELIVERED	|The message was successfully delivered.|
| FAILED	|The task has errored too many times or encountered an error that it cannot recover from.|
| CANCEL_REQUESTED	|The cancel request from the user is recorded.|
| CANCELLED	|The cancel request from the user is honored.|

- `url` (query, string): Filter logs by destination URL
- `topicName` (query, string): Filter logs by URL Group name
- `scheduleId` (query, string): Filter logs by schedule ID
- `queueName` (query, string): Filter logs by queue name
- `fromDate` (query, integer): Filter logs by starting date, in milliseconds (Unix timestamp). This is inclusive.
- `toDate` (query, integer): Filter logs by ending date, in milliseconds (Unix timestamp). This is inclusive.
- `count` (query, integer): The number of log entries to return.
- `label` (query, string[]): Filter logs by label. Supports multi-value filtering. You can pass multiple values to match messages with any of the given labels (OR logic).

Examples:
- `label=my_label`
- `label=label_1&label=label_2`


## Responses

### 200 - List of logs

- `cursor` (string): A cursor which you can use in subsequent requests to paginate through all logs. 
If no cursor is returned, you have reached the end of the logs.

- `logs` (object[])
  - `time` (integer): The timestamp of the log entry in Unix milliseconds
  - `messageId` (string): The message ID associated with the log entry
  - `header` (object): The headers of the message.
  - `body` (string): Base64 encoded body of the message.
  - `state` (enum<string>): The state of the message at the time of the log entry.
  - `error` (string): The error message if the log entry corresponds to an error state.
  - `nextDeliveryTime` (integer): The next scheduled time of the message. (Unix timestamp in milliseconds)
  - `url` (string): The URL to which the message is being delivered.
  - `topicName` (string): The URL Group (a.k.a. topic) name if this message was sent to a URL Group.
  - `endpointName` (string): The endpoint name of the message if the endpoint is given a name within the URL group.
  - `scheduleId` (string): The scheduleId of the message if the message is triggered by a schedule
  - `queueName` (string): The name of the queue if the message is enqueued to a queue.
  - `responseStatus` (integer): The status code of the response. Only set if the state is ERROR
  - `responseBody` (string): The base64 encoded body of the response. Only set if the state is ERROR
  - `responseHeaders` (object): The headers of the response. Only set if the state is ERROR
  - `timeout` (integer): The timeout(in milliseconds) of the outgoing http requests, after which Qstash cancels the request
  - `method` (string): HTTP method of the message for outgoing request
  - `callback` (string): Callback is the URL address where QStash sends the response of a publish
  - `callbackHeaders` (object): The headers sent to the callback URL
  - `failureCallback` (string): Failur eCallback is the URL address where QStash sends the response of a failed message after all retries are exhausted
  - `failureCallbackHeaders` (object): The headers sent to the failure callback URL
  - `maxRetries` (integer): The maximum number of retries for the message
  - `retryDelayExpression` (string): The retry delay expression used for calculating retry delays
  - `label` (string): The label assigned to the message. Deprecated in favor of `labels`.
  - `labels` (string[]): The list of labels assigned to the message.

## cURL

```bash
curl --request GET \
  --url https://qstash-{region}.upstash.io/v2/logs \
  --header 'Authorization: Bearer <token>'
```
