Add / Update Kit Product
POST /api/users/{user}/kit
Section titled “POST /api/users/{user}/kit”Adds a product to the user’s kit. If the product is already assigned to the user it will be updated — this endpoint behaves as an upsert.
The {user} path parameter is the internal user id (use Find User by Email to look it up).
Headers
Section titled “Headers”| Header | Required | Value |
|---|---|---|
api-key | yes | Import API key |
Content-Type | yes | application/json |
Request body
Section titled “Request body”{ "product_id": 7, "quantity": 2, "mandatory": true}Fields
Section titled “Fields”| Field | Type | Required | Description |
|---|---|---|---|
product_id | int | yes | Must exist in the products table |
quantity | int | yes | Min: 1 |
mandatory | boolean | no | Defaults to false |
Response
Section titled “Response”HTTP 201 Created
{ "success": true, "entry": { "user_id": 42, "product_id": 7, "quantity": 2, "mandatory": true }}HTTP error codes
Section titled “HTTP error codes”| Status | Description |
|---|---|
401 | Missing api-key header |
403 | Invalid api-key value |
404 | User not found |
422 | Validation error (missing or invalid field) |
Side effects: notification emails
Section titled “Side effects: notification emails”This endpoint can trigger one of two emails (only when the user_product_kit site feature is enabled, and never on staging sites):
- First kit item ever assigned to the user — sends a
PasswordNewUseremail with a login link, immediately. - A new product is added to an existing kit, or the
quantityof an already-assigned product is increased (e.g.1→2) — sends aNewItemAccessemail with a login link. This only fires once the user’s kit is at least a day old (first kit item created before today), and is debounced: if multiple changes happen within a 30-minute window, only one email is queued, delayed by 30 minutes from the triggering change.
Decreasing or keeping the same quantity for an existing item does not trigger an email.