- Bulk Recurrence Operations
- Bulk Line Item Operations
- Bulk Work Assignment Operations
- Bulk Pay Stub Operations
- Batch Operations
Bulk Operations
Bulk operations- take criteria objects that define the criteria used to select the objects to perform the bulk operation on,
- find all objects matching the criteria, and
- perform the same operation on each object.
POST /remittance_account_enrollments/bulk/create
work_assignments. Setting overlap_strategy to replace_existing resolves overlapping enrollments for the same work assignment and provider: enrollments beginning before the new effective_from are end-dated, while those beginning on or after it are removed. Omit it and an overlap returns a validation error.
Example: Create earning line items on all non-contractor pay stubs in a payroll
POST /earning_line_items/bulk/create
POST /earning_line_items/bulk/update
POST /earning_line_items/bulk/delete
Scope Endpoints
Every bulk operation has a corresponding scope endpoint that previews which entities will be affected by the operation, without performing it. Scope endpoints accept the same request body as their corresponding bulk operation and return the entities that would be affected. The scope endpoint URL is the bulk operation URL with/scope appended:
What the scope endpoint returns depends on the operation:
- Create scope returns the parent entities the new entities will be created under (e.g. pay stubs for line items, work assignments for recurrences, payees for work assignments, work assignments for pay stubs).
- Update scope returns the entities that will be updated.
- Delete scope returns the entities that will be deleted.
Batch Operations
Batch operations take one object or ID for each entity to perform the batch operation on. For example, the batch upsert operations for line items take one object per line item, and will create or update each line item with that object’s properties. For example, the batch delete operations for line items take one ID per line item, and will delete the line item with that ID.Comparing Bulk and Batch Operations
Bulk operations take criteria objects and perform the operation on 0..n entities, all with the same properties. Batch operations take objects or IDs and perform the operation on each entity, 1:1, with different properties per object.Asynchronous Execution
All bulk and batch mutating operations are asynchronous: they return202 Accepted with an async_task handle. The task may or may not have completed by the time the response arrives. Partners must always check data.status (poll links.self, or subscribe to the async_task_completed webhook). See Batch Operations, Bulk Line Item Operations, Bulk Recurrence Operations, Bulk Work Assignment Operations, and Bulk Pay Stub Operations for the per-section details.
Scope endpoints are synchronous previews with no side effects.
Failed Tasks
Theasync_task_completed webhook fires when the task reaches its final state, whether the work succeeded or failed. It tells you the task is done, not that it worked. The payload carries no status, so fetch the task with the ID from the webhook and read data.status:
completed: the work succeeded.completed_atis set, anddata.resultslists the affected entities.error: the work failed.completed_atstaysnull.
data.results with status set to error and a message in error. id is null when the entity was being created:
This object was deleted after the batch was accepted.
An errored bulk task reports no per-entity detail: data.results is empty. The writes run in a single transaction, but the work that follows them (recalculating a payroll’s totals, for example) does not, so re-read the entities the operation targeted to see what landed before you retry.
