Named groups for organising assets.
GET /api/v1/collections/
List collections.
Response
Response 200 (application/json)
{
"collections": [
{
"id": "string",
"name": "string",
"assetIds": [
"string"
],
"createdAt": "string",
"updatedAt": "string",
"description": "string",
"tags": [
"string"
],
"custom": {},
"deleteLock": {
"locked": true,
"lockedAt": "string",
"reason": "string",
"lockedBy": "string"
}
}
]
}
POST /api/v1/collections/
Create a collection.
Request
Request body (application/json)
{
"name": "string",
"description": "string",
"tags": [
"string"
],
"custom": {}
}
Response
Response 201 (application/json)
{
"id": "string",
"name": "string",
"assetIds": [
"string"
],
"createdAt": "string",
"updatedAt": "string",
"description": "string",
"tags": [
"string"
],
"custom": {},
"deleteLock": {
"locked": true,
"lockedAt": "string",
"reason": "string",
"lockedBy": "string"
}
}
GET /api/v1/collections/{id}
Get a collection.
Parameters
| Name | In | Type | Required |
|---|
id | path | string | required |
Response
Response 200 (application/json)
{
"id": "string",
"name": "string",
"assetIds": [
"string"
],
"createdAt": "string",
"updatedAt": "string",
"assets": [
{}
],
"description": "string",
"tags": [
"string"
],
"custom": {},
"deleteLock": {
"locked": true,
"lockedAt": "string",
"reason": "string",
"lockedBy": "string"
}
}
PATCH /api/v1/collections/{id}
Parameters
| Name | In | Type | Required |
|---|
id | path | string | required |
Request
Request body (application/json)
{
"name": "string",
"description": "string",
"tags": [
"string"
],
"custom": {}
}
Response
Response 200 (application/json)
{
"id": "string",
"name": "string",
"assetIds": [
"string"
],
"createdAt": "string",
"updatedAt": "string",
"description": "string",
"tags": [
"string"
],
"custom": {},
"deleteLock": {
"locked": true,
"lockedAt": "string",
"reason": "string",
"lockedBy": "string"
}
}
DELETE /api/v1/collections/{id}
Delete a collection. Empty ones delete outright; a non-empty one is refused with 409 until you confirm its member count.
Delete a collection. Member assets are never touched: membership lives inside the collection document, so deleting it unlinks the members and nothing more.
Deleting an EMPTY collection needs no extra parameter and answers 204. An unknown or foreign collection id is also a silent 204 (existence is never leaked), so 404 is not emitted on this route.
Deleting a NON-EMPTY collection is refused by default with 409 delete_blocked, reason: "member_of_collection", carrying memberCount — the number of member assets the collection currently holds. The confirm-then-delete flow is:
DELETE /api/v1/collections/{id} → 409 with reason: "member_of_collection" and e.g. memberCount: 7.- Show the caller what they are about to unlink, then re-issue
DELETE /api/v1/collections/{id}?confirmMemberCount=7 → 204.
The confirmation must match the CURRENT member count. If someone added or removed members in between, the retry is refused with the same 409 member_of_collection carrying the new authoritative memberCount — never a silent delete. Re-confirm with that value and retry. ?force=true is the blind alternative: it skips the count check entirely.
A 409 with reason: "delete_protected" is a DIFFERENT and unrelated condition: the collection carries an explicit delete lock. It is a hard block — neither ?confirmMemberCount= nor ?force=true bypasses it, it carries NO memberCount, and both blockedBy arrays are empty. The only way forward is to clear the lock with DELETE /api/v1/collections/{id}/lock (then delete as normal). Branch on reason, not on the status code or message.
Parameters
| Name | In | Type | Required | Description |
|---|
force | query | boolean | optional | Blind override of the soft member_of_collection block: delete a non-empty collection without asserting its member count. Prefer confirmMemberCount — force deletes whatever is there, including members added since you last read the collection. Never bypasses a delete_protected lock. |
confirmMemberCount | query | integer | optional | Assert how many member assets the collection currently holds, to delete a non-empty collection safely. Use the memberCount from the 409 member_of_collection response (or the length of assetIds from GET /api/v1/collections/{id}). Matches the current count -> the delete proceeds (204). Does not match -> 409 member_of_collection with the real memberCount; never a silent delete. Omit it to keep the safe default (non-empty collections are refused). |
id | path | string | required | |
Response
Deleted. Also returned for an unknown or foreign collection id (delete is idempotent and never leaks existence).
Response 204 (application/json)
"null"
Response 400
Malformed query parameter — e.g. a confirmMemberCount that is not a non-negative integer.
Response 404
Not emitted on this route; an unknown or foreign collection id answers 204.
Response 409
Delete refused. Branch on reason: member_of_collection means the collection still holds memberCount member assets — retry with ?confirmMemberCount=<memberCount>. delete_protected means an explicit delete lock is set — clear it with DELETE /api/v1/collections/{id}/lock; no confirmation or ?force=true can bypass it.
Field noteserror — Always delete_blocked. The single error code for every refused delete.message — Human-readable explanation. Do not branch on it — branch on reason.reason — Machine-readable cause, and the only field a client should branch on. delete_protected — an explicit delete lock is set on the collection; a HARD block that neither ?force=true nor ?confirmMemberCount= can bypass, and is lifted only by DELETE /api/v1/collections/{id}/lock. member_of_collection — the collection still holds member assets; a SOFT block, resolved by re-issuing the delete with ?confirmMemberCount=<memberCount> (or ?force=true). referenced_by_job is part of the shared envelope and is not emitted on this route.blockedBy — The references that blocked the delete. Both arrays are empty on delete_protected.memberCount — Present ONLY on member_of_collection: the number of member assets the collection currently holds. Echo this value back as ?confirmMemberCount=<memberCount> to delete the collection in one follow-up call. Absent on delete_protected.
reason: member_of_collection — retry with ?confirmMemberCount=7
{
"error": "delete_blocked",
"message": "collection 01J8ZK9F4Q is in use (7 member asset(s))",
"reason": "member_of_collection",
"blockedBy": {
"jobIds": [],
"collectionIds": [
"01J8ZK9F4Q"
]
},
"memberCount": 7
}
reason: member_of_collection — stale confirmation, re-confirm with 8
{
"error": "delete_blocked",
"message": "collection 01J8ZK9F4Q has 8 member asset(s), not the confirmed 7",
"reason": "member_of_collection",
"blockedBy": {
"jobIds": [],
"collectionIds": [
"01J8ZK9F4Q"
]
},
"memberCount": 8
}
reason: delete_protected — clear the lock first (no memberCount)
{
"error": "delete_blocked",
"message": "collection 01J8ZK9F4Q is protected from deletion by an explicit lock",
"reason": "delete_protected",
"blockedBy": {
"jobIds": [],
"collectionIds": []
}
}
PUT /api/v1/collections/{id}/assets/{assetId}
Add an asset to a collection.
Parameters
| Name | In | Type | Required |
|---|
id | path | string | required |
assetId | path | string | required |
Response
Response 200 (application/json)
{
"id": "string",
"name": "string",
"assetIds": [
"string"
],
"createdAt": "string",
"updatedAt": "string",
"description": "string",
"tags": [
"string"
],
"custom": {},
"deleteLock": {
"locked": true,
"lockedAt": "string",
"reason": "string",
"lockedBy": "string"
}
}
DELETE /api/v1/collections/{id}/assets/{assetId}
Remove an asset from a collection.
Parameters
| Name | In | Type | Required |
|---|
id | path | string | required |
assetId | path | string | required |
Response
Response 200 (application/json)
{
"id": "string",
"name": "string",
"assetIds": [
"string"
],
"createdAt": "string",
"updatedAt": "string",
"description": "string",
"tags": [
"string"
],
"custom": {},
"deleteLock": {
"locked": true,
"lockedAt": "string",
"reason": "string",
"lockedBy": "string"
}
}
PUT /api/v1/collections/{id}/lock
Parameters
| Name | In | Type | Required |
|---|
id | path | string | required |
Request
Request body (application/json)
{
"reason": "string",
"lockedBy": "string"
}
Response
Response 200 (application/json)
{
"id": "string",
"name": "string",
"assetIds": [
"string"
],
"createdAt": "string",
"updatedAt": "string",
"description": "string",
"tags": [
"string"
],
"custom": {},
"deleteLock": {
"locked": true,
"lockedAt": "string",
"reason": "string",
"lockedBy": "string"
}
}
DELETE /api/v1/collections/{id}/lock
Parameters
| Name | In | Type | Required |
|---|
id | path | string | required |
Response
Response 200 (application/json)
{
"id": "string",
"name": "string",
"assetIds": [
"string"
],
"createdAt": "string",
"updatedAt": "string",
"description": "string",
"tags": [
"string"
],
"custom": {},
"deleteLock": {
"locked": true,
"lockedAt": "string",
"reason": "string",
"lockedBy": "string"
}
}