# Best Practices for Exporting Clicks

This guide will help you optimize your `ClickExport` integration. Key topics include exporting data efficiently, refreshing data when needed, and avoiding unnecessary API usage or rate-limit issues.

### Implementation steps

1. Send a request to `/ClickExport` with your desired parameters. Click events continue processing throughout the day. To ensure your export includes all events, we recommend requesting data for any given date only on the next calendar day.

{% hint style="warning" %}
**Important:** Don't submit repeat requests with identical parameters. This will not refresh the data and will unnecessarily increase your API usage.
{% endhint %}

2. Track the status of the job in one of two ways after submitting your export request:

* Poll the `Jobs` API by using the URIs returned in the `/ClickExport` response to the call: `GET /Jobs/{JobId}`.
* Enable a postback webhook to receive automatic notifications when your job is complete. This approach will significantly reduce the number of API calls.

3. Once the job reaches a `COMPLETED` state, download the file by calling: `/Jobs/{JobId}/Download`.

All completed job results are cached indefinitely, meaning your data will remain available for download at any time in the future.

### Refresh report data

If you need refreshed or updated results for a previously completed job, use: `/Jobs/{JobId}/Replay`.

#### Replay best practices

* Only use replay when it is absolutely necessary. It should be reserved for cases where new or updated data is expected for the report, or the original job ended in a `FAILED` or `CANCELLED` state.
* Don't replay a job immediately after submitting a `/ClickExport` request. The initial request may still be in the queue for processing and the data will not have changed, so the replay will provide identical results while unnecessarily increasing API usage.
* Don't call `/ClickExport` again with the same parameters. This will not refresh the data and will count toward rate limits.
* Avoid integrations that repeatedly trigger replays or re-run the same report multiple times per day.

#### For the most up-to-date data

To ensure completeness, request exports later in the day or the following day when the underlying datasets have been fully updated.

### General tips

* Use smaller date ranges when downloading to improve performance and avoid unnecessary large exports.
* Avoid repeated `/ClickExport` calls with the same parameters. These count toward your API usage quota and can lead to rate limiting.
* Only replay exports when data changes justify it.

### Event postbacks

If you want to reduce the number of API calls required to track a job's progress, you can use Event Postbacks instead of polling the `Jobs` API. With postbacks enabled, your system will automatically receive a notification when the job status changes, removing the need to repeatedly call `GET /Jobs/{JobId}`. This alternative only replaces job-status polling; you will still use the `ClickExport` and `Jobs` APIs for submitting, replaying, and downloading results.

Use Event Postbacks to be notified when updates are available, then trigger the appropriate API request to download the completed job. Learn how to enable postbacks to significantly reduce the volume of calls required and help to avoid rate-limit issues.

### Frequently asked questions

Results are currently stored indefinitely. Use replay for:

* `FAILED` or `CANCELLED` jobs
* Cases where additional data may now be available
* Refreshing results without changing parameters

No, there is no specific limiter on polling, but we recommend exploring the use of webhooks (postbacks) to avoid excessive calls and receive real-time updates. This happens because an identical request with the exact same parameters has already been submitted. When the system detects a duplicate request, it returns the existing \`JobId\` instead of creating a new job. A new job will only be scheduled if:

* You change one or more of the input parameters.
* The query relies on default date ranges and a new calendar day has passed since the original request.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://integrations.impact.com/brand-api-reference/reference/clicks/best-practices-for-exporting-clicks.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
