Skip to content
API reference Add assets
API reference Collections

Add assets to a collection

Adds Library assets to an existing collection; ids already in it or not in this workspace are skipped.

POST/api/v1/public/collections/{collection_id}/assets

Scope: write. The key's creator needs permission to manage collections.

Path parameters

collection_idstringpathrequired
The collection's UUID.

Body parameters

asset_idsarraybodyrequired
Asset UUIDs to add, 1 to 200.

Response

collection.idstring
Collection UUID.
collection.namestring
Name.
collection.urlstring
App path of the collection.
addedinteger
Assets added.
skippedinteger
Distinct ids not added: already in the collection, or not in this workspace's Library.
summarystring
A one-line Markdown summary.

Example request

curl -X POST https://api.pipory.com/api/v1/public/collections/5e6f7a8b-9c0d-4e1f-a2b3-c4d5e6f7a8b9/assets \
  -H "Authorization: Bearer pip_your_key" \
  -H "Content-Type: application/json" \
  -d '{"asset_ids": ["8f2c4a1e-6b3d-4c9f-a2e1-7d5b3c1a9e8f", "1a2b3c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d"]}'

Example response

{
  "collection": {
    "id": "5e6f7a8b-9c0d-4e1f-a2b3-c4d5e6f7a8b9",
    "name": "Q4 winners",
    "url": "/collections/5e6f7a8b-9c0d-4e1f-a2b3-c4d5e6f7a8b9"
  },
  "added": 1,
  "skipped": 1,
  "summary": "Added 1 asset to **[Q4 winners](/collections/5e6f7a8b-9c0d-4e1f-a2b3-c4d5e6f7a8b9)**. 1 were already there or not found."
}

Errors

StatusCodeMeaning
401invalid_api_keyMissing, unknown, revoked or expired key
403insufficient_scopeThe key has no write scope, or its creator cannot manage collections
403upgrade_requiredThe workspace is not on a paid plan
404noneNo collection with that id in this workspace
422noneasset_ids empty, over 200, or not UUIDs
429rate_limitedOver the key's rate limit