---
schema_version: "1"
id: 5304e44dc12476e341cd97b199ed6653c230fe9f0147b5367f85c92a401ef679
title: Get Started with Salesforce Spiff Reporting API
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/sales-cloud/spiff/guides/reporting-api-get-started.md
canonical_url: https://developer.salesforce.com/docs/sales/spiff/guide/reporting-api-get-started.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 3326b342a50ab21831a92844b1b08b24fe3bee1d11da36756c82835da7a51dbe
products:
  - Salesforce Spiff
  - Sales Cloud
---
# Get Started with Salesforce Spiff Reporting API

Integrate Salesforce Spiff commission data with other systems, such as automated payroll or analytics tools. The Salesforce Spiff Reporting API provides endpoints for exporting and downloading Spiff custom reports as uncompressed .csv files or compressed .csv.gz files. Before you start an export, you can call the export readiness endpoint to confirm that reporting data has settled. These endpoints require OAuth 2.0 authentication with a bearer token that you generate with a Client ID and Client Secret from Spiff.

## 1. Create an API Report

1. Log in to Spiff as a user with the Company Admin role.
2. On the Reporting tab in Spiff, select **Reports**.
3. Click **Create Report**.
4. Enter a report name.
5. For report use case, select **API**.
6. Click **Create Report**.

**note:** If you use custom roles, enable the **Custom API Reports: Manage** permission, under Reporting, on the Role Management page. This permission lets you access and export reports by using the Custom Report Export API.
![Role Management option in Spiff](https://developer.salesforce.com/docs/media/spiff/reporting-role-management-menu.png '{"class": "image-full"}')

![Reporting permissions page in Spiff, showing the Custom API Reports: Manage permission](https://developer.salesforce.com/docs/media/spiff/reporting-custom-api-reports.png '{"class": "image-full"}')

## 2. Generate a Client ID and Client Secret

1. On the Admin tab in Spiff, select **Settings** and then select **API Access Management**.
2. Enter an application name, select the **Custom Reports Export** application scope, and click **Create**.
3. From the window that appears, copy the Client ID and Client Secret.
   The Client ID appears in the Connected APIs list, but you can't view the Client Secret again. There's no way to recover these values, but you can generate new values.

## 3. Generate a Bearer Token

1. Make a `POST` call with the [getAccessToken](/docs/sales/spiff/references/spiff-reporting-api-reference?meta=getAccessToken) endpoint and pass the Client ID and Client Secret that you copied.

```
 curl -d "client_secret=CLIENT_SECRET&client_id=CLIENT_ID&audience=https://SUBDOMAIN.spiff.com/api/v1&grant_type=client_credentials" -H "Content-Type: application/x-www-form-urlencoded" -X POST https://SUBDOMAIN.spiff.com/api/v1/oauth2/token
```

Replace these values:

- `CLIENT_SECRET`: The OAuth 2.0 Client Secret that you generated and copied from Spiff Settings.
- `CLIENT_ID`: The OAuth 2.0 Client ID that you generated and copied from Spiff Settings.
- `SUBDOMAIN`: The subdomain for your Spiff environment.
  - If you're in the US, use `us1`.
  - If you're in the EU, use `eu1`.

1. Retrieve `access_token` from the results.
2. To verify that the bearer token is valid, make a `GET` call with the [getReports](/docs/sales/spiff/references/spiff-reporting-api-reference?meta=getReports) endpoint.

```
 curl "https://SUBDOMAIN.spiff.com/api/v1/reports" -H "Authorization: Bearer YOUR_BEARER_TOKEN"
```

Replace `YOUR_BEARER_TOKEN` with the token you retrieved.

## 4. Check Export Readiness

Before you call [requestExport](/docs/sales/spiff/references/spiff-reporting-api-reference?meta=requestExport), make a `GET` call with the [getExportReadiness](/docs/sales/spiff/references/spiff-reporting-api-reference?meta=getExportReadiness) endpoint to confirm that reporting data is ready to export.

```
 curl "https://SUBDOMAIN.spiff.com/api/v1/reports/export/readiness" -H "Authorization: Bearer YOUR_BEARER_TOKEN"
```

Replace `YOUR_BEARER_TOKEN` with the token you retrieved.

A successful response returns HTTP 200 and includes a `ready` field.

- If `ready` is `true`, call [requestExport](/docs/sales/spiff/references/spiff-reporting-api-reference?meta=requestExport).
- If `ready` is `false`, wait at least 30 seconds and call [getExportReadiness](/docs/sales/spiff/references/spiff-reporting-api-reference?meta=getExportReadiness) again. Don't start the export yet.

**note:** Export readiness is advisory. The export process re-checks calculation status and can still wait, especially if calculations start again after this check.

You can now use other endpoints in the Reporting API to access, export, and download API reports. Also, review [limitations for the Reporting API](https://developer.salesforce.com/docs/sales/spiff/guide/reporting-api-limits.md).

**See Also**

- _Salesforce Help_: [User Roles and Permissions in Salesforce Spiff](https://help.salesforce.com/s/articleView?id=sales.spiff_users_roles_and_permissions.htm)
- _Salesforce Help_: [Reports and Dashboards in Salesforce Spiff](https://help.salesforce.com/s/articleView?id=sales.spiff_report.htm)
- _Trailhead_: [Deliver Smarter Incentives with Salesforce Spiff](https://trailhead.salesforce.com/content/learn/trails/deliver-smarter-incentives-with-salesforce-spiff)
