---
title: "Create Export Action"
method: POST
path: "/workspaces/{workspace_id}/contacts/export_actions"
tags: ["Contacts::ExportAction"]
---

# Create Export Action

`POST /workspaces/{workspace_id}/contacts/export_actions`

Export a collection of contacts to a CSV file. Supply `fields` to specify which contact columns appear in the CSV (including custom attribute keys). The action runs asynchronously — poll the returned record with `GET /api/v2/contacts/export_actions/{id}`. Once complete, `file_url` contains the download URL for the generated CSV.
Exactly one target selection must be supplied: `stable_id`, `stored_filter_id` (alias `filter_id`), `target_ids`, or `target_all`. Returns 422 if none is provided or if the supplied value is invalid.

## Path parameters

- `workspace_id` integer, required

## Request body

- object
  - `contacts_export_action` ContactsExportActionParameters — Contacts Export Actions
    - `fields` string[], required — The contact field keys to include as columns in the exported CSV. Standard keys include `email_address`, `first_name`, `last_name`, `tag_ids`, `phone_number`, etc. Custom attribute keys are also accepted. Required.
    - `stable_id` string — A URL-encoded Refine `stable_id` token — the standard gzip+base64 full-state format used by both the `contacts/filters` API endpoint and the server-rendered filter UI, making tokens interoperable. Returned by `POST /api/v2/workspaces/{workspace_id}/contacts/filters` in the `stable_id` field. Pass the token exactly as returned; do not decode or re-encode it. The server persists the decoded filter so the async job can re-derive the audience at perform time. Mutually exclusive with `stored_filter_id`, `target_ids`, and `target_all`.
    - `stored_filter_id` string — The `id` (integer) or `public_id` (string) of a saved `Refine::StoredFilter` scoped to this workspace (must be a ContactsFilter). Also accepted as `filter_id`. Mutually exclusive with `stable_id`, `target_ids`, and `target_all`.
    - `target_ids` string[] — Explicit list of contacts to export, as the `public_id` strings returned by the contacts endpoints. Numeric ids are also accepted. Mutually exclusive with `stable_id`, `stored_filter_id`, and `target_all`.
    - `target_all` boolean — Set to `true` to target every contact in the workspace. Use deliberately. Mutually exclusive with `stable_id`, `stored_filter_id`, and `target_ids`.
    - `scheduled_for` string, date-time — Optional ISO 8601 datetime. When supplied the action is deferred until this time. Omit (or pass `null`) to execute immediately.

## Response `201`

Created

- ContactsExportActionAttributes — Bulk CSV-export action targeting a collection of contacts
  - `id` integer — Export Action ID
  - `public_id` string, nullable — Export Action public ID
  - `workspace_id` integer — Workspace ID
  - `fields` string[], nullable — The contact field keys to include as columns in the exported CSV (e.g. `["email_address", "first_name", "tag_ids"]`). Custom attribute keys are also accepted.
  - `file_url` string, nullable — Download URL for the generated CSV file. `null` until the async export job completes.
  - `filter_id` integer, nullable — ID of the `Refine::StoredFilter` that drives target selection. Populated automatically when `stable_id` or `stored_filter_id` is supplied on create. `null` when the action targets explicit `target_ids` or `target_all`.
  - `target_all` boolean, nullable — When `true` the action targets every contact in the workspace. Mutually exclusive with `stable_id`, `stored_filter_id`, and `target_ids`.
  - `target_ids` integer[], nullable — Explicit list of targeted contacts as raw integer IDs. The response echoes the stored integer IDs, not the public IDs passed on create.
  - `target_count` integer, nullable — Total number of contacts selected for this action. `null` until the async job has resolved the audience size.
  - `performed_count` integer, nullable — Number of contacts processed so far. Poll this field alongside `target_count` to track async progress.
  - `created_by_id` integer, nullable — ID of the workspace membership that created this action.
  - `approved_by_id` integer, nullable — ID of the membership that approved this action (reserved for future use).
  - `scheduled_for` string, date-time, nullable — When set, the action will not execute until this datetime. `null` means execute immediately.
  - `started_at` string, date-time, nullable — Datetime the async job began processing contacts. `null` until started.
  - `completed_at` string, date-time, nullable — Datetime the async job finished. `null` until complete.
  - `created_at` string, date-time, nullable — Created at datetime
  - `updated_at` string, date-time, nullable — Updated at datetime

## Other responses

- `400` — Bad Request
- `401` — Unauthorized
- `422` — Unprocessable Entity — no target selection was supplied; or `stable_id` is not a valid Refine token or not a ContactsFilter; or `stored_filter_id` is unknown, invalid, or belongs to a different workspace.

---

[API](https://skmtc.dev/myclickfunnels/apis/clickfunnels-api.md) · [All operations](https://skmtc.dev/myclickfunnels/apis/clickfunnels-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/myclickfunnels/clickfunnels-api/revisions/ae6313eaa176/schema)
