Bulk Update Project Stage
The POST /api/v1/projects/bulk endpoint exists, but it only accepts operation: "delete" or operation: "restore" — it doesn’t apply patches. To move a batch of projects to a new status, iterate PATCH /api/v1/projects/{id} and use idempotency keys to make the loop safely retryable.
-
Build the id list.
List the projects you want to update with the regular cursor-paginated endpoint, filter client-side, and collect their ids.
async function listAllProjects(filter) {const out = [];let cursor = null;do {const url = new URL('https://app.buildworkpro.com/api/v1/projects');url.searchParams.set('limit', '100');if (cursor) url.searchParams.set('cursor', cursor);const res = await fetch(url, {headers: { Authorization: `Bearer ${process.env.BWP_KEY}` },});const body = await res.json();out.push(...body.data.filter(filter));cursor = body.meta.cursor;} while (cursor);return out;}const ids = (await listAllProjects((p) => p.status === 'in_progress')).map((p) => p.id); -
PATCH each project with an idempotency key.
Derive the key from a stable input — for example,
bulk-status-2026-04-25-${id}— so a retry of the same logical run hits the same key and returns the original result.for (const id of ids) {await fetch(`https://app.buildworkpro.com/api/v1/projects/${id}`, {method: 'PATCH',headers: {Authorization: `Bearer ${process.env.BWP_KEY}`,'Content-Type': 'application/json','Idempotency-Key': `bulk-status-2026-04-25-${id}`,},body: JSON.stringify({ status: 'completed' }),});} -
Track partial failures.
PATCH responses are 200 on success, 422 on validation error, 404 if the project was deleted between list and patch. Log the body of any non-2xx and decide whether to retry, skip, or surface for human review.
-
(For deletes only) use the bulk endpoint.
If you actually want to soft-delete or restore a batch — not patch —
POST /projects/bulkdoes it in one job:Terminal window curl -X POST https://app.buildworkpro.com/api/v1/projects/bulk \-H "Authorization: Bearer ${BUILDWORKPRO_API_KEY}" \-H "Content-Type: application/json" \-d '{ "operation": "delete", "ids": [11, 12, 13] }'