---
title: "Bulk Set Item Distribution Link By Ids"
method: POST
path: "/claims/{claim_id}/expenditures/items/bulk-distribution-link-by-ids"
tags: ["expenditures"]
---

# Bulk Set Item Distribution Link By Ids

`POST /claims/{claim_id}/expenditures/items/bulk-distribution-link-by-ids`

## Request

- Base URL: `https://api.claimkit.co` (the document declares no server; this is the origin it was published from)
- URL: `https://api.claimkit.co/claims/{claim_id}/expenditures/items/bulk-distribution-link-by-ids`
- Auth: none declared

Stamp ``scope`` onto every live item in ``item_ids`` and materialise the
derived splits. Per-item semantics are exactly :func:`set_item_distribution_link`'s
— 'all'/'engineering' link (an unavailable scope is accepted; the sync
no-ops until the aggregate exists), 'none' is the explicit opt-out that
keeps the last computed split and is not recaptured by a future subgroup
link, and NULL (follow-subgroup) is never written. An item already
following via its subgroup is still stamped: the selection is an explicit
per-item instruction, so the link outlives the subgroup's.

Mirrors :func:`bulk_set_item_apportionments_by_ids` for auth/scoping: the
``claim_id``-scoped query is the authorization boundary (ids on another
claim match nothing). Synthetic salary ids and real salary-category rows
are skipped (employees are apportioned on the Salary tab), as are
already-removed, asset-promoted, linked refund (derived — they follow their
original via the mirror), and unknown ids. ``updated_count`` counts items
whose stored scope actually changed, so re-applying the same scope reports 0
— except under 'none', which also counts rows whose R&D it zeroed (an
already-opted-out row can still be carrying a derived split to clear).

## Path parameters

- `claim_id` integer, required

## Request body

- BulkSetDistributionLinkByIdsRequest: Link an explicit list of item ids to an employee distribution, or opt them out. Backs the checkbox toolbars' "Follow employee distribution" action on both expenditure tabs, where the ticked rows may span categories/subgroups — so neither the per-item PUT nor the subgroup-scoped POST can express the selection.
  - `item_ids` integer[], required
  - `scope` 'all' | 'engineering' | 'none', required

## Response `200`

Successful Response

- BulkUpdateResponse
  - `updated_count` integer, required

## Other responses

- `422`: Validation Error

---

[API](https://skmtc.dev/claimkit/apis/claimkit-api.md) - [All operations](https://skmtc.dev/claimkit/apis/claimkit-api/llms.txt) - [OpenAPI document](https://skmtc.dev/claimkit/apis/claimkit-api/revisions/94dc85ba5326?raw)
