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

# Export result sets

> Use the general export service to turn supported API result sets into downloadable JSON, CSV, or XLSX files.

Use the export service when you need a complete result set as a file instead of paginated API responses. The export service is asynchronous: you create a job, poll it, then download the file when it is complete.

<Info>
  Export service IDs are not fixed. Each environment assigns them when the catalog is seeded, so always call `list_export_services` first and use the `id` returned there. Match the service by stable fields such as `name`, `alias`, or `slug`.
</Info>

### When to use it

Use this flow for result sets that appear in the export catalog. The source guide tells you which result identifier to pass in `args` — for example a search ID, task ID, analysis ID, or another source-specific key.

Do not use this for original leak source files. Those use the separate [Download leak files](/api/guides/leak-file-downloads) flow and are limited to files under 10 MB. Also check the source guide for specialized export endpoints: [Filtered credentials](/api/guides/credentials-filtered#export-the-results), [monitoring matches](/api/guides/monitoring-matches#export), [Telegram](/api/guides/expert-telegram), and [reports](/api/guides/reports) each document their own file flow.

### Export a result set

<Steps>
  <Step title="List export services">
    [`list_export_services`](https://client-api.leak.center/scalar-docs/#tag/export/GET/api/service/list_export_services/) returns the export catalog.

    ```bash theme={"dark"}
    curl https://client-api.leak.center/api/service/list_export_services/ \
      -H "Authorization: Bearer YOUR_ACCESS_TOKEN"
    ```

    Each entry carries the fields you need for the next step:

    ```json theme={"dark"}
    {
      "id": 12,
      "name": "StealerLogs",
      "alias": "stealer_logs",
      "slug": "stealer-logs",
      "is_active": true,
      "allowed_types": ["json", "csv", "xlsx"],
      "args": {
        "params": [
          {
            "name": "search_id",
            "type": "Int",
            "required": true,
            "description": "Stealer log search id to enrich and export"
          }
        ]
      }
    }
    ```

    Read `allowed_types` before choosing a format. Read `args` before creating the export; those parameters are different per service.
  </Step>

  <Step title="Create the export">
    [`create_export`](https://client-api.leak.center/scalar-docs/#tag/export/POST/api/service/create_export/) starts the job. Pass:

    * `service` — the service `id` from the catalog.
    * `type` — one of the service's `allowed_types`, usually `json`, `csv`, or `xlsx`.
    * `args` — the service-specific arguments from the catalog.

    ```bash theme={"dark"}
    curl https://client-api.leak.center/api/service/create_export/ \
      -X POST \
      -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
      -H "Content-Type: application/json" \
      -d '{"service": 12, "type": "csv", "args": {"search_id": 4471}}'
    ```

    The response includes the export `id`, `service`, `type`, `status`, `created_at`, and `organization`.
  </Step>

  <Step title="Poll until complete">
    [`get_export`](https://client-api.leak.center/scalar-docs/#tag/export/GET/api/service/get_export/) reads the job by query parameter `id`.

    ```bash theme={"dark"}
    curl "https://client-api.leak.center/api/service/get_export/?id=9876" \
      -H "Authorization: Bearer YOUR_ACCESS_TOKEN"
    ```

    Status moves through:

    | Status        | Meaning                                                                        |
    | ------------- | ------------------------------------------------------------------------------ |
    | `IN_PROGRESS` | The file is still being prepared. Poll again.                                  |
    | `COMPLETE`    | The file is ready to download.                                                 |
    | `FAILED`      | The export did not finish. Check the arguments and create a new job if needed. |
  </Step>

  <Step title="Download">
    [`download_export`](https://client-api.leak.center/scalar-docs/#tag/export/GET/api/service/download_export/) returns the file once the job is `COMPLETE`.

    ```bash theme={"dark"}
    curl -L "https://client-api.leak.center/api/service/download_export/?id=9876" \
      -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
      -OJ
    ```
  </Step>
</Steps>

### List previous exports

[`list_exports`](https://client-api.leak.center/scalar-docs/#tag/export/GET/api/service/list_exports/) returns your export jobs. Filter by `status`, `type`, `services`, `from_date`, and `to_date`.

```bash theme={"dark"}
curl "https://client-api.leak.center/api/service/list_exports/?status=COMPLETE&page_size=20" \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"
```

Use this when you need to pick up an export created earlier, or when a workflow creates exports on behalf of several users in the same organization.

### Common mistakes

| Mistake                                                  | Fix                                                                                                              |
| -------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- |
| Hard-coding a service ID                                 | Call `list_export_services` and match by `name`, `alias`, or `slug`.                                             |
| Passing the wrong `args` key                             | Read the service's `args` schema from the catalog. The export service does not guess source-specific parameters. |
| Calling `download_export` while the job is still running | Poll `get_export` until `status` is `COMPLETE`.                                                                  |
| Exporting when you only need a few rows                  | Page the source results and keep the filtered rows you actually need.                                            |
| Trying to export an original leak source file            | Use [Download leak files](/api/guides/leak-file-downloads), and only for files under 10 MB.                      |
