---
title: "Add targets to collection"
method: POST
path: "/public/v1/collections/{collectionId}/targets"
tags: ["Collections - Targets"]
---

# Add targets to collection

`POST /public/v1/collections/{collectionId}/targets`

Add multiple targets (suppliers, customers, etc.) to a collection.

Targets are identified by their unique `prewaveTargetId` (target's `infotag_id`). If a target is already in the collection,
it will be ignored (no duplicate entries). All target IDs must be valid and accessible to the user.

This operation is atomic - either all targets are added successfully, or none are added.

**Getting Collection ID:**
- To find available collections and their IDs, use the Collections Management API:
  - `GET /public/v1/collections` - List all collections accessible to you (returns collections with `id` field)
  - `GET /public/v1/collections/{collectionId}` - Get a specific collection by ID
- The `id` field in collection responses is the `collectionId` used in this endpoint's path parameter

**Getting Target IDs (prewaveTargetId):**
- To get current target IDs, use the Supplier Sites API:
  - `GET /public/v2/suppliers/sites` - List all suppliers with their current `prewaveTargetId` values
  - `GET /public/v2/suppliers/sites/find-by-identifier?prewaveId={prewaveTargetId}` - Get a specific supplier by `prewaveTargetId`
- The `prewaveTargetId` field in supplier responses is the target ID used in the request body

**Important: Target ID Stability**

⚠️ **The target `id` (prewaveTargetId) may change** due to target merges or data consolidation. When this happens:
- The target's edge numbers, edge data, and collection memberships are automatically moved to a new target
- Using an outdated target ID will result in a `404 Not Found` error

💡 **Best Practice for Integrations:**
- **Always refresh target IDs** before adding targets to a collection by calling `GET /public/v2/suppliers/sites` to get the latest `prewaveTargetId` values
- Match suppliers by supplier identifiers (your external system identifiers) rather than storing `prewaveTargetId` values long-term
- If you receive a `404 Not Found` error, use `GET /public/v2/suppliers/sites` to find the current `prewaveTargetId` by matching your supplier identifiers

**Audit Trail:**
- All changes are audited for compliance and tracking purposes
- Every action is recorded in the audit log with:
  - The user who performed the operation
  - Timestamp of the operation
  - Details about which targets were added to the collection
  - Reference to the public API endpoint used

**Required Permissions**: `manage_collection` and `update` on the collection.

## Path parameters

- `collectionId` integer, required

## Request body

- integer[]

## Response `200`

Targets added to collection successfully. All changes have been audited.

- PublicCollectionDTO
  - `id` integer, required
  - `uuid` string, uuid, required
  - `scope` 'User' | 'Customer' | 'Featured', required
  - `type` 'Default' | 'Commodity' | 'Ariba', required
  - `name` string, required
  - `count` integer, nullable
  - `lanes` boolean, required
  - `tiersEnabled` boolean, required
  - `parentId` integer, nullable
  - `children` PublicCollectionDTO[], required
  - `updatedAt` string, date-time, nullable

## Other responses

- `400` — Invalid request - Invalid target IDs, empty request body, or malformed JSON
- `403` — 403 Forbidden - Authentication or authorization failure. This status code is returned when: (1) the request lacks valid authentication credentials (missing or invalid X-Auth-Token header), or (2) the authenticated user does not have the required permission to access this resource.
- `404` — Collection not found or some target IDs are invalid or not accessible. This may occur if: (1) the collection doesn't exist or is not accessible to your organization, (2) one or more target IDs don't exist, (3) one or more target IDs are not accessible to your organization, or (4) a target ID has changed due to a target merge (in which case, use GET /public/v2/suppliers/sites to find the new ID by matching supplier identifiers).
- `429` — 429 Too Many Requests - API rate limit exceeded. The request has been rejected because the rate limit for this endpoint has been exceeded. Default rate limits: GET requests - 100 per 10 seconds, 500 per minute; POST/PUT/PATCH/DELETE requests - 20 per 10 seconds, 100 per minute. For increased access, please contact customer success.
- `500` — 500 Internal Server Error - An unexpected error occurred on the server. The request may or may not have been processed.

---

[API](https://skmtc.net/prewave/apis/public-prewave-api.md) · [All operations](https://skmtc.net/prewave/apis/public-prewave-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/prewave/public-prewave-api/revisions/466169815b78/schema)
