v1

latestOpenAPI 3.1.0MIT2026-07-243952451019.0 KB
Contacts::EnrollAction

Create Enroll Action

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.

post/workspaces/{workspace_id}/contacts/enroll_actions

Path parameters

workspace_idinteger required

Request body

Example request

{
  "contacts_enroll_action": {
    "contacts_enroll_action": {
      "course_ids": [
        "QwdWoj"
      ],
      "stored_filter_id": "7"
    }
  }
}

Response

Created

idinteger

Enroll Action ID

public_idstring nullable

Enroll Action public ID

workspace_idinteger

Workspace ID

course_idsinteger[] nullable

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_idsinteger[] nullable

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_idinteger 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_allboolean nullable

When true the action targets every contact in the workspace. Mutually exclusive with stable_id, stored_filter_id, and target_ids.

target_idsinteger[] 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_countinteger nullable

Total number of contacts selected for this action. null until the async job has resolved the audience size.

performed_countinteger nullable

Number of contacts processed so far. Poll this field alongside target_count to track async progress.

created_by_idinteger nullable

ID of the workspace membership that created this action.

scheduled_forstring date-time nullable

When set, the action will not execute until this datetime. null means execute immediately.

started_atstring date-time nullable

Datetime the async job began processing contacts. null until started.

completed_atstring date-time nullable

Datetime the async job finished. null until complete.

created_atstring date-time nullable

Created at datetime

updated_atstring date-time nullable

Updated at datetime

Example response

{
  "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"
}