---
title: "How to export data from Pigment with APIs"
slug: "export-data-with-apis"
description: "Learn how to export data from Pigment using the REST API, including setup, authentication, and output formats for Metric, List, and Table Blocks."
tags: ["Data Export", "Importing Exporting Data", "Pigment API", "View ID"]
updated: 2025-11-14T17:47:27Z
published: 2025-11-14T17:47:27Z
---

> ## Documentation Index
> Fetch the complete documentation index at: https://kb.pigment.com/llms.txt
> Use this file to discover all available pages before exploring further.

# How to export data from Pigment with APIs

Pigment allows users to automatically export data from Metric, List and Table Blocks with our REST API. This article provides all the information you need to configure a data export from Pigment with APIs.

## Information you need to trigger the export

To trigger an export from the Pigment export API, you need two types of information:

- ***Pigment Export API key****:*this secret key is used to authenticate the service calling the API. Use the [Integration page](/v1/docs/manage-api-keys) to get one.
- ***View ID****:* ID of the view you want to export. Follow the guidance in step 1 below to get this.

## Swagger / OpenAPI specification

Pigment has a Swagger page with all the publicly available API endpoints: [https://pigment.app/api/swagger](https://pigment.app/api/swagger/).

> [!WARNING]
> **⚠️**Important
> 
> The Pigment public API enforces rate limits to ensure fair usage. The limit is 500 requests per 5-minute window per IP address. For more information, see [Rate Limits for Pigment Public API](/v1/docs/rate-limits-for-pigment-public-api).

## Export Metric, Table and List data

> [!NOTE]
> ℹ️ **Note**
> 
> When exporting from a Block with Scenarios activated, Pigment uses the default Scenario. To export from other Scenarios, navigate to [page options](/v1/docs/hide-widget-selectors-display-mode) and set the Default items to the Scenarios you wish to export from.

### Description

*URL*

Here is the GET API URL:

`https://pigment.app/api/v1/export/view/{viewId}`

*Parameters*

1. `{viewId}` is found by opening the Block (Metric, List or Table) within Pigment’s UI and copying the URL. It should look like `https://pigment.app/application/{applicationId}/tables/{blockId}?displayMode=Grid&amp;viewId={viewId}`. Retrieve the View ID from that URL as indicated.
2. `dateFormat` is a query parameter that allows you to pick from:
  - `Legacy` (the default option): outputs different formats based on the Block exported:

| Block type | Date Format |
| --- | --- |
| Table | 10/25/2024 00:00:00 +00:00 |
| Metric | 10/25/2024 00:00:00 +00:00 |
| List | 10/25/2024 |
  - `Iso8601`: always outputs the same format: 2024-11-21
3. `fieldDelimiter` is a query parameter to use in csv exports. Pick from:
  - `Semicolon` (the default option): for output using `;` separators
  - `Comma`: for output using `,` separators

> [!NOTE]
> ℹ️ **Note**
> 
> Create a dedicated view for your API export and retrieve the View ID in the URL.

To authenticate yourself to the API, use `bearer {token}` as your `authorization` method in the API call’s HTTP headers.

> [!WARNING]
> **⚠️ Important**
> 
> If your API Key has the old format with dashes (e.g. `3jp2e232-9875-42f4-9fcf-63fe2ce568jp`) then you need to generate a new key from Pigment following [these instructions](/v1/docs/manage-api-keys).

*Output*

The API call returns a CSV with `;` or `,` separators depending which field delimiter you picked in Step 3 above. Your data is flattened and not formatted.

The output looks as if all Dimensions in rows and columns were set in rows and Metrics were set in columns.

Here is an example of a view with the expected flattened output.

![](https://cdn.document360.io/e47cfe35-dc28-40c7-a083-6cf003073d8e/Images/Documentation/54af5e3e-e59c-4eae-a2c8-e3a6ec9d8f7f.png)

```plaintext
Country;Month;Cost;Revenue;Margin
FR;Jan 21;50.00;150.00;100.00
FR;Feb 21;50.00;150.00;100.00
FR;Mar 21;60.00;180.00;120.00
FR;Apr 21;65.00;195.00;130.00
FR;May 21;55.00;165.00;110.00
FR;Jun 21;50.00;150.00;100.00
FR;Jul 21;25.00;75.00;50.00
FR;Aug 21;40.00;120.00;80.00
FR;Sep 21;60.00;180.00;120.00
FR;Oct 21;60.00;180.00;120.00
FR;Nov 21;65.00;195.00;130.00
FR;Dec 21;75.00;225.00;150.00
DE;Jan 21;16.66666666666667;50.00;33.33333333333333
DE;Feb 21;16.66666666666667;50.00;33.33333333333333
DE;Mar 21;20.00;60.00;40.00
DE;Apr 21;21.66666666666667;65.00;43.33333333333333...
```

### cURL Example

```plaintext
# Template variables
PIGMENT_API_KEY="CHANGE ME"
VIEW_ID="CHANGE ME"

# Get the CSV
curl -X GET "https://pigment.app/api/export/view/${VIEW_ID}" \
-H "Authorization: Bearer ${PIGMENT_API_KEY}"
```

## Which data can be accessed through API?

> [!CAUTION]
> **🛡️****Warning**
> 
> Export API keys have no dedicated access rights associated with them. Instead, they impersonate the access rights of the API key owner. For example, if you export data from Pigment by calling the Export API using a key created by John, the API returns the data as seen by John.
