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:
- Create an export using the
createAutomationJobsExportmutation. - Retrieve the export using the
automationJobsExportquery.
This flow allows you to request an export and then fetch its status and download link once processing is complete.
Prerequisites
- Authentication: Use a Service Account token.
- Permissions: Ensure your token has permission to export automation jobs.
- 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
- Refer to our Get resource IDs page for alternative methods.
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 isfinished).
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 isfinished).
Example Flow
- Run the mutation to create an export and note the returned
id. - Poll the query with the
iduntilstatusisfinishedorfailed. - Download the file from
fileUrlwhen 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
finishedorfailed. - The
fileUrlis only available when the export is complete.
