---
agentTools:
  projectIndex: https://developers.pipefy.com/llms.txt
---

# Retrieve Automation Logs

## Before You Begin

🔗 **Use the [GraphQL Playground](https://app.pipefy.com/graphiql)** to execute the queries in this guide.

## Prerequisites

1. **Authentication**: Use a [Service Account token](https://developers.pipefy.com/reference/service-accounts).
2. **Permissions**: Ensure your token has permissions to view automations.
3. **Automation ID**: Identify the automation to retrieve logs from.

## Step 1: Find Your Automation ID

### 1. Via Pipefy UI

* Open the Automation in your browser.
* The URL will include the Automation ID: `https://app.pipefy.com/pipes/1234/settings/automations/5678`.
* **Automation ID = `5678`** (the number after `/automations/`).

### 2. Via GraphQL Query

* Refer to our [Retrieve Automations](https://developers.pipefy.com/reference/retrieve-automations) for alternative methods.

## Step 2: Query Automation Logs

Use the `automationLogs` query to retrieve logs for a specific automation.

```graphql
{
  automationLogs(automationId: "123", status: finished, searchTerm: "error") {
    edges {
      node {
        uuid
        status
        automationId
        automationName
        cardId
        cardTitle
        datetime
      }
    }
    pageInfo {
      hasNextPage
      endCursor
    }
  }
}
```

* **`automationId`**: (Required) The automation to retrieve logs for.
* **`status`**: (Optional) Filter logs by status. The available status are: processing, failed and success.
* **`searchTerm`**: (Optional) Filter logs by a search term (minimum 3 characters).

### Key Fields Explained

The `automationsLogs` query uses pagination. Refer to our [Pagination basics page](https://developers.pipefy.com/reference/pagination-basics) to understand more about how it works.

* **`uuid`**: Log unique identifier.
* **`status`**: Status of the automation log.
* **`automationId`**: ID of the automation.
* **`automationName`**: Name of the automation.
* **`cardId`**: ID of the card involved (if any).
* **`cardTitle`**: Title of the card involved (if any).
* **`datetime`**: When the log was created.
* **`details`**: (Optional) Additional information about the log entry. This field may include error messages, debug information, or other context about the automation execution. The structure of `details` can vary depending on the automation type and the log status, but typically includes fields such as `errorType`, `message`, or other relevant metadata.

## Step 3: Execute and Interpret the Response

After running the query, you'll receive a structured JSON response. Here’s an example:

```json
{
  "data": {
    "automationLogs": {
      "edges": [
        {
          "node": {
            "uuid": "log-uuid",
            "status": "failed",
            "automationId": "123",
            "automationName": "My Automation",
            "cardId": "456",
            "cardTitle": "Card Title",
            "datetime": "2024-06-01T12:00:00Z",
            "details": {
              "errorType": "ValidationError",
              "message": "Required field is missing."
            }
          }
        }
      ],
      "pageInfo": {
        "hasNextPage": false,
        "endCursor": "WyJsb2ctdXVpZCIsMV0"
      }
    }
  }
}
```