Export Pipe Audit Logs Report

How to export a pipe audit logs report using GraphQL mutation

Overview

This guide explains how to export pipe audit logs reports using Pipefy's GraphQL API. The exportPipeAuditLogsReport mutation allows you to export audit logs and activity data for a specific pipe, providing insights into user actions and system events.

This mutation creates an asynchronous export job that processes pipe audit logs and generates a downloadable report file.

Prerequisites

  1. Authentication: For this mutation specifically, you need to provide the id_token of your cookie session of pipefy.
  2. Permissions: Ensure you have permission to manage pipe (Pipe admin).
  3. Pipe UUID: Required. You must provide the UUID of the pipe that you want to export the logs.

Step 1: Find Your Pipe UUID

To execute this mutation, you’ll need the UUID of the pipe.

Step 2: Export Pipe Audit Logs Report

Use the exportPipeAuditLogsReport mutation to request an audit logs report export. You must provide the pipeUuid and can optionally include a search term to filter audit logs of a specific user based on user name and email.

mutation ExportPipeAuditLogsReport(
  $pipeUuid: ID!
  $searchTerm: String
) {
  exportPipeAuditLogsReport(
    pipeUuid: $pipeUuid
    searchTerm: $searchTerm
  ) {
    success
  }
}

Variables example:

{
  "pipeUuid": "87654321-4321-4321-4321-cba987654321",
  "searchTerm": "John"
}

Arguments Explained

Required Arguments

  • pipeUuid: The UUID of the pipe for which to generate the audit logs report

Optional Arguments

  • searchTerm: A search term to filter audit logs (defaults to empty string if not provided)
    • Filters audit logs of a specific user based on user name and email
    • Case-insensitive search across audit log data

Key Fields Returned

  • success: Boolean indicating whether the mutation was successful
    • true: The export job was created successfully
    • false: The export job creation failed

Step 3: Understanding the Export Process

The exportPipeAuditLogsReport mutation creates an asynchronous export job that:

  1. Fetches Audit Logs: Retrieves pipe audit logs from the last 30 days (excluding today)
  2. Applies Filters: If a search term is provided, filters audit logs of the specific user based on the term
  3. Export Report: Creates a structured report with the following columns:
    • User: The user who performed the action
    • Action: Description of the action performed
    • Date: Timestamp when the action occurred

Example Response

{
  "data": {
    "exportPipeAuditLogsReport": {
      "success": true
    }
  }
}

Error Handling

If the mutation fails, you'll receive an error response:

{
  "data": {
    "exportPipeAuditLogsReport": null
  },
  "errors": [
    {
      "message": "You don't have permission to perform this action",
      "locations": [
        {
          "line": 2,
          "column": 3
        }
      ],
      "path": [
        "exportPipeAuditLogsReport"
      ]
    }
  ]
}

Common Error Scenarios

  1. Permission Denied: User doesn't have the required permissions
  2. Invalid UUIDs: Pipe UUID doesn't exist or user doesn't have access
  3. Authentication Issues: Missing or invalid authentication token

File Format

The export generates a structured file in a CSV format