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

# 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](https://developers.pipefy.com/reference/service-accounts).
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

* Refer to our [Get resource IDs page](https://developers.pipefy.com/reference/get-resource-ids) 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.

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

**Variables example:**

```json
{
  "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.

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

**Variables example:**

```json
{
  "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)

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

## Example Response (Query)

```json
{
  "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.