openapi: 3.2.0 info: title: ClickFunnels Contacts::Enroll Action API termsOfService: https://www.clickfunnels.com/terms-of-service contact: name: ClickFunnels API Team url: https://developers.myclickfunnels.com x-logo: url: https://statics.myclickfunnels.com/image/1126065/file/31edf05760fafe41a82f16a668ab251f.png description: 'The ClickFunnels REST API that powers webhooks, native integrations, and Zapier lets you manage your ClickFunnels data, automate your workflows, and recreate ClickFunnels functionality in your own apps. ' license: name: MIT url: https://opensource.org/licenses/MIT version: 2.0.0 servers: - url: https://{subdomain}.myclickfunnels.com/api/v2 description: ClickFunnels API variables: subdomain: default: myworkspace security: - BearerAuth: [] tags: - name: Contacts::EnrollAction description: '> Bulk-enroll contacts into course sections An Enroll Action enrolls an entire audience of contacts into one or more course sections in a single async operation. Pass `course_ids` to enroll in every section of those courses, or `section_ids` for specific sections (or both). **Target selection** — supply exactly one of: - `stable_id` — a URL-encoded Refine `stable_id` token. - `stored_filter_id` — the `id` or `public_id` of a saved `Refine::StoredFilter` (ContactsFilter). Also accepted as `filter_id`. - `target_ids` — an explicit array of contact public IDs. - `target_all` — `true` to target every contact in the workspace. **Progress tracking** — after creating an Enroll Action, poll it with `GET /api/v2/contacts/enroll_actions/{id}`. The response reflects async progress via `target_count` and `performed_count`. See [How a course is structured](https://accounts.myclickfunnels.com/.well-known/courses/skill.md#how-a-course-is-structured) in the [Courses Skill](https://accounts.myclickfunnels.com/.well-known/courses/skill.md) for what the `course_ids` and `section_ids` you target refer to and how to list them. ' paths: /workspaces/{workspace_id}/contacts/enroll_actions: get: tags: - Contacts::EnrollAction summary: List Enroll Actions description: List all Contact Enroll Actions for your workspace operationId: listContactsEnrollActions parameters: - name: workspace_id in: path required: true schema: type: string - $ref: '#/components/parameters/after' - $ref: '#/components/parameters/sort_order' - $ref: '#/components/parameters/sort_property' responses: '200': description: OK headers: Pagination-Next: $ref: '#/components/headers/PaginationNext' Link: $ref: '#/components/headers/Link' content: application/json: schema: type: array items: $ref: '#/components/schemas/ContactsEnrollActionAttributes' example: - id: 1 public_id: aB3cD4 workspace_id: 42000 course_ids: - QwdWoj section_ids: - Xk9pLm filter_id: 7 target_all: false target_ids: [] target_count: 200 performed_count: 200 created_by_id: 5 scheduled_for: null started_at: '2025-01-01T00:01:00.000Z' completed_at: '2025-01-01T00:02:00.000Z' created_at: '2025-01-01T00:00:00.000Z' updated_at: '2025-01-01T00:02:00.000Z' - id: 2 public_id: eF5gH6 workspace_id: 42000 course_ids: - QwdWoj section_ids: [] filter_id: null target_all: false target_ids: - cust_abc target_count: 1 performed_count: 0 created_by_id: 5 scheduled_for: null started_at: null completed_at: null created_at: '2025-01-02T00:00:00.000Z' updated_at: '2025-01-02T00:00:00.000Z' '401': description: Unauthorized content: application/json: schema: type: object properties: error: type: string example: error: API key missing or invalid '404': description: Not Found content: application/json: schema: type: object properties: error: type: string description: Not found - This usually happens when you try to access a record that does not exist in your account. It can also happen when the provided parent record is missing, e.g. you have put in a non-existent Workspaces parent ID. example: error: 'Not found: Record missing' post: tags: - Contacts::EnrollAction summary: Create Enroll Action description: 'Bulk-enroll a collection of contacts into course sections. Pass `course_ids` to enroll in every section of those courses, or `section_ids` for specific sections (or both). The action runs asynchronously — poll the returned record with `GET /api/v2/contacts/enroll_actions/{id}` to track progress via `target_count` and `performed_count`. 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. The `course_ids` and `section_ids` you target come from the course content tree; see [Reading back a course](https://accounts.myclickfunnels.com/.well-known/courses/skill.md#reading-back-a-course) in the [Courses Skill](https://accounts.myclickfunnels.com/.well-known/courses/skill.md).' operationId: createContactsEnrollActions parameters: - name: workspace_id in: path required: true schema: type: string requestBody: description: Information about a new Enroll Action required: true content: application/json: schema: type: object properties: contacts_enroll_action: type: object $ref: '#/components/schemas/ContactsEnrollActionParameters' example: contacts_enroll_action: course_ids: - QwdWoj stored_filter_id: '7' responses: '201': description: Created content: application/json: schema: $ref: '#/components/schemas/ContactsEnrollActionAttributes' example: id: 3 public_id: iJ7kL8 workspace_id: 42000 course_ids: - QwdWoj section_ids: - Xk9pLm filter_id: 7 target_all: false target_ids: [] target_count: null performed_count: 0 created_by_id: 5 scheduled_for: null started_at: null completed_at: null created_at: '2025-01-03T00:00:00.000Z' updated_at: '2025-01-03T00:00:00.000Z' '400': description: Bad Request content: application/json: schema: type: object properties: error: type: string example: error: 'Bad request: HTTP body must be valid JSON' '401': description: Unauthorized content: application/json: schema: type: object properties: error: type: string example: error: API key missing or invalid '422': description: 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. content: application/json: schema: type: object properties: error: type: string example: error: 'provide a selection: stable_id, stored_filter_id, target_ids, or target_all' /contacts/enroll_actions/{id}: get: tags: - Contacts::EnrollAction summary: Fetch Enroll Action description: Retrieve a single Contact Enroll Action and its current async progress operationId: getContactsEnrollActions parameters: - $ref: '#/components/parameters/id' responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/ContactsEnrollActionAttributes' example: id: 3 public_id: iJ7kL8 workspace_id: 42000 course_ids: - QwdWoj section_ids: - Xk9pLm filter_id: 7 target_all: false target_ids: [] target_count: 200 performed_count: 150 created_by_id: 5 scheduled_for: null started_at: '2025-01-03T00:00:30.000Z' completed_at: null created_at: '2025-01-03T00:00:00.000Z' updated_at: '2025-01-03T00:00:30.000Z' '401': description: Unauthorized content: application/json: schema: type: object properties: error: type: string example: error: API key missing or invalid '404': description: Not Found content: application/json: schema: type: object properties: error: type: string example: error: 'Not found: Record missing' delete: tags: - Contacts::EnrollAction summary: Remove Enroll Action description: Delete a Contact Enroll Action record operationId: removeContactsEnrollActions parameters: - $ref: '#/components/parameters/id' responses: '204': description: No Content '401': description: Unauthorized content: application/json: schema: type: object properties: error: type: string example: error: API key missing or invalid '404': description: Not Found content: application/json: schema: type: object properties: error: type: string example: error: 'Not found: Record missing' components: parameters: id: name: id in: path required: true schema: type: string sort_property: name: sort_property in: query description: 'Sort property of a list response. The default is id and thus the created_at order. If you sort by other properties, we additionally sort by id implicitly as a secondary sort property, so that you can rely on the sort order to be deterministic even if the main sort property ends up with the same values. ' required: false schema: type: string enum: - id - updated_at sort_order: name: sort_order in: query description: Sort order of a list response. Use 'desc' to reverse the default 'asc' (ascending) sort order. Examples [in our guides](https://developers.myclickfunnels.com/docs/pagination). required: false schema: type: string enum: - asc - desc after: name: after in: query required: false schema: type: string description: ID of item after which the collection should be returned. More examples and info about pagination [in our guides](https://developers.myclickfunnels.com/docs/pagination). schemas: ContactsEnrollActionParameters: type: object title: Contacts Enroll Actions description: Contacts Enroll Actions properties: course_ids: type: array items: type: string description: Public IDs of the courses to enroll contacts into. Contacts are enrolled into every section of each course. Provide `course_ids`, `section_ids`, or both. section_ids: type: array items: type: string description: Public IDs of specific course sections to enroll contacts into. Use when you want finer-grained control than `course_ids`. stable_id: type: string description: 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: type: string description: 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: type: array items: type: string description: Explicit list of contacts to enroll, 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: type: boolean description: 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: type: string format: date-time description: Optional ISO 8601 datetime. When supplied the action is deferred until this time. Omit (or pass `null`) to execute immediately. example: contacts_enroll_action: course_ids: - QwdWoj stored_filter_id: '7' ContactsEnrollActionAttributes: type: object title: Contacts Enroll Actions description: Bulk course-enrollment action targeting a collection of contacts properties: id: type: integer description: Enroll Action ID public_id: type: - string - 'null' description: Enroll Action public ID workspace_id: type: integer description: Workspace ID course_ids: type: - array - 'null' items: type: integer description: The raw integer IDs of the courses contacts were enrolled into. The response echoes stored integer IDs, not the public IDs passed on create. section_ids: type: - array - 'null' items: type: integer description: The raw integer IDs of the course sections contacts were enrolled into. The response echoes stored integer IDs, not the public IDs passed on create. filter_id: type: - integer - 'null' description: 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: type: - boolean - 'null' description: When `true` the action targets every contact in the workspace. Mutually exclusive with `stable_id`, `stored_filter_id`, and `target_ids`. target_ids: type: - array - 'null' items: type: integer description: 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: type: - integer - 'null' description: Total number of contacts selected for this action. `null` until the async job has resolved the audience size. performed_count: type: - integer - 'null' description: Number of contacts processed so far. Poll this field alongside `target_count` to track async progress. created_by_id: type: - integer - 'null' description: ID of the workspace membership that created this action. scheduled_for: type: - string - 'null' format: date-time description: When set, the action will not execute until this datetime. `null` means execute immediately. started_at: type: - string - 'null' format: date-time description: Datetime the async job began processing contacts. `null` until started. completed_at: type: - string - 'null' format: date-time description: Datetime the async job finished. `null` until complete. created_at: type: - string - 'null' format: date-time description: Created at datetime updated_at: type: - string - 'null' format: date-time description: Updated at datetime example: id: 1 public_id: aB3cD4 workspace_id: 42000 course_ids: - 4 section_ids: - 8 filter_id: 7 target_all: false target_ids: [] target_count: 200 performed_count: 50 created_by_id: 5 scheduled_for: null started_at: '2025-01-01T00:01:00.000Z' completed_at: null created_at: '2025-01-01T00:00:00.000Z' updated_at: '2025-01-01T00:01:00.000Z' required: - completed_at - course_ids - created_at - created_by_id - filter_id - id - performed_count - public_id - scheduled_for - section_ids - started_at - target_all - target_count - target_ids - updated_at - workspace_id headers: Link: description: A direct link to the next page for the cursor-based pagination. It includes the `after` and the Pagination-Next ID value. schema: type: string PaginationNext: description: ID of the last item in the current response after which more records exist. You can use it in an `after` query parameter for cursor-based pagination to get to the next page. schema: type: string securitySchemes: BearerAuth: type: http scheme: bearer externalDocs: description: More in-depth guides and further resources url: https://developers.myclickfunnels.com