# 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](/partner-api-reference/partner-v14/readme/rate-limits.md) 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.

   Important: Don't submit repeat requests with identical parameters. This will not refresh the data and will unnecessarily increase your API usage.
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.

### Frequently asked questions

<details>

<summary>How long are results available for download?</summary>

Results are currently stored indefinitely.

</details>

<details>

<summary>When should I use the Replay function?</summary>

Use replay for:

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

</details>

<details>

<summary>Is there a limit to how often I can poll for a status?</summary>

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.

</details>

<details>

<summary>Why am I getting the same JobId every time?</summary>

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.

</details>


---

# 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/partner-api-reference/partner-v14/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.
