Export Automation Jobs

How to create and retrieve an automation jobs export using GraphQL

Overview

This guide explains how to export automation jobs using Pipefy's GraphQL API. The process involves two steps:

  1. Create an export using the createAutomationJobsExport mutation.
  2. Retrieve the export using the automationJobsExport query.

This flow allows you to request an export and then fetch its status and download link once processing is complete.

Prerequisites

  1. Authentication: Use a Service Account token.
  2. Permissions: Ensure your token has permission to export automation jobs.
  3. Organization ID: Identify the organization for which you want to export automation jobs.

Step 1: Find Your Organization ID

1. Via Pipefy UI

  • Open the Organization in your browser.
  • The URL will include the Organization ID: https://app.pipefy.com/organizations/123456789.
  • Organization ID = 123456789 (the number after /organizations/).

2. Via GraphQL Query

Step 2: Create an Automation Jobs Export

Use the createAutomationJobsExport mutation to request an export. You must provide the organizationId and the period filter.

mutation CreateAutomationJobsExport($organizationId: ID!, $filter: PeriodFilter!) {
  createAutomationJobsExport(organizationId: $organizationId, filter: $filter) {
    id
    status
    createdAt
    downloadUrl
  }
}

Variables example:

{
  "organizationId": "123456789",
  "filter": "last_month"
}

Available period filters

  • last_3_months
  • last_month
  • current_month

Key Fields Returned

  • id: The unique identifier for the export job. Use this to query the export status later.
  • status: The current status of the export job (e.g., created, processing, finished, failed).
  • fileUrl: The URL to download the export file (available when status is finished).

Step 3: Retrieve the Automation Jobs Export

After creating the export, use the automationJobsExport query to check the status and retrieve the download link.

query AutomationJobsExport($id: ID!) {
  automationJobsExport(id: $id) {
    id
    status
    fileUrl
  }
}

Variables example:

{
  "id": "the-id-returned-by-mutation"
}

Key Fields Returned

  • id: The export job identifier.
  • status: The current status (created, processing, finished, failed).
  • filedUrl: The URL to download the export file (present when status is finished).

Example Flow

  1. Run the mutation to create an export and note the returned id.
  2. Poll the query with the id until status is finished or failed.
  3. Download the file from fileUrl when available.

Example Response (Mutation)

{
  "data": {
    "createAutomationJobsExport": {
      "id": "export-uuid-123",
      "status": "created",
      "fileUrl": null
    }
  }
}

Example Response (Query)

{
  "data": {
    "automationJobsExport": {
      "id": "export-uuid-123",
      "status": "finished",
      "downloadUrl": "https://files.pipefy.com/exports/export-uuid-123.csv"
    }
  }
}

Notes

  • The export process may take some time. Poll the query until the status is finished or failed.
  • The fileUrl is only available when the export is complete.