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

# Duplicate Pipe Report

Copy an existing pipe report into the same pipe

## Before You Begin

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

➡️ **New to GraphQL?** Learn how to navigate the Playground with our **[Playground Basics Guide](https://developers.pipefy.com/reference/exploring-the-playground)**.

## Prerequisites

1. **Authentication**: Use a [Service Account token](https://developers.pipefy.com/reference/service-accounts) (Personal Access Tokens are deprecated).
2. **Permissions**: Ensure your token has the necessary permissions to create reports in the pipe that owns the report you are copying.
3. **Report ID**: Identify the report you want to duplicate.

## When To Use This

Use `duplicatePipeReport` when you want a variant of a report that already exists: the
same filter with an extra column, the same columns over a different date range, or a
colleague's report as a starting point for your own. The copy is created with the
source's full configuration, so you only have to change what actually differs.

## Step 1: Find The Report ID

Use the [Get pipe reports](./get-pipe-reports) query to list the reports in a pipe and
read the `id` of the one you want to copy.

```graphql
query {
  pipeReports(pipeUuid: "01234567-89ab-cdef-0123-456789abcdef") {
    edges {
      node {
        id
        name
      }
    }
  }
}
```

## Step 2: Duplicate The Report

Execute the `duplicatePipeReport` mutation:

```graphql
mutation {
  duplicatePipeReport(input: { id: "456789123" }) {
    pipeReport {
      id
      name
      cardCount
      color
      createdAt
      fields
      filter
      featuredField
      sortBy {
        field
        direction
      }
      selectedFormulaFields {
        indexName
        selectedFormula
      }
    }
  }
}
```

### Response Example

```json
{
  "data": {
    "duplicatePipeReport": {
      "pipeReport": {
        "id": "456789124",
        "name": "Sales Pipeline Overview (copy)",
        "cardCount": 1250,
        "color": "blue",
        "createdAt": "2024-03-13T15:30:00Z",
        "fields": ["title", "status", "assignee", "due_date", "priority"],
        "filter": "{\"operator\":\"and\",\"queries\":[{\"field\":\"status\",\"operator\":\"contains\",\"value\":[\"in_progress\"]}]}",
        "featuredField": "field_1_number",
        "sortBy": {
          "field": "card_id",
          "direction": "asc"
        },
        "selectedFormulaFields": [
          {
            "indexName": "field_1_number",
            "selectedFormula": "sum"
          }
        ]
      }
    }
  }
}
```

## Arguments Explained

### Required Arguments

* `id`: The ID of the report to duplicate. The copy is always created in the same pipe
  as the source; there is no argument to copy a report into a different pipe.

The mutation takes no other arguments. The copy's name is generated for you (see
below); to give it a different name, follow up with
[Update pipe report](./update-pipe-report).

## What Gets Copied

The copy carries the source report's configuration:

* `fields`: the column selection
* `filter`: the filter criteria
* `formulas` and `featuredField`: the formula aggregations and the highlighted one
* `sortBy`: the sort field and direction

The copy differs from its source in four ways:

* **`id`**: a new report, independent of the source. Editing or deleting either one
  leaves the other untouched.
* **`name`**: the source name with a copy suffix, in the language of your request:
  `Sales Pipeline Overview (copy)`. If that name is taken, the suffix is numbered:
  `(copy 2)`, `(copy 3)`, and so on.
* **`color`**: a new color is picked at random, so the copy is easy to tell apart from
  its source in the reports list.
* **owner**: the copy belongs to whoever calls the mutation, not to the source's
  author. You can duplicate a report created by a colleague, and the resulting copy is
  yours to edit.

Past exports of the source report are not copied. The new report starts with no export
history.

## Key Fields Explained

### Report Information

* `id`: Unique identifier for the new report
* `name`: Display name of the copy, including its copy suffix
* `cardCount`: Total number of cards included in the report (calculated in real time)
* `color`: The report's color name, for example `blue` or `green`
* `createdAt`: Timestamp when the copy was created, not when the source was

### Report Configuration

* `fields`: Array of field names shown as report columns
* `filter`: The filter criteria, returned as a **JSON-encoded string**. Parse it before
  reading its contents.
* `featuredField`: The formula field highlighted as the report's summary
* `sortBy`: How the report's cards are ordered
  * `field`: The sort field
  * `direction`: `asc` or `desc`
* `selectedFormulaFields`: Formula fields included in the report
  * `indexName`: The formula field identifier
  * `selectedFormula`: The aggregation applied, for example `sum`

## Errors

| Error code           | When it happens                                                   |
| -------------------- | ----------------------------------------------------------------- |
| `RESOURCE_NOT_FOUND` | No report matches the given `id`, or the report has been deleted  |
| `PERMISSION_DENIED`  | Your token cannot create reports in the pipe that owns the report |