Libraries
A library is an owner‑scoped, named bucket of tracks — your personal collections, separate from packs. Libraries can be shared with collaborators (viewer / editor / admin) through accepted shares.
Every endpoint is under /api/swayzio/v1, requires a
Clerk actor, and runs native→proxy. Responses strip
ownerId via the clientLibrary* DTOs — see Data Contracts.
Endpoints
Libraries
| Method | Path | Purpose | Auth | Request | Response |
|---|---|---|---|---|---|
GET | /v1/libraries | List libraries you own | Clerk actor | — | { records: LibraryListRecord[] } |
POST | /v1/libraries | Create a library | Clerk actor | createLibraryRequestSchema | Library 201 |
GET | /v1/libraries/shared-with-me | Libraries shared with you | Clerk actor | — | { records: Library[] } |
GET | /v1/libraries/:libraryId | Library detail (+ counts) | Clerk actor | — | LibraryListRecord |
PATCH | /v1/libraries/:libraryId | Rename (≥1 field) | Clerk actor | updateLibraryRequestSchema | Library |
DELETE | /v1/libraries/:libraryId | Delete | Clerk actor | — | 204 |
GET | /v1/libraries/:libraryId/presentation | Presentation payload | Clerk actor | — | LibraryListRecord |
createLibraryRequestSchema is { name } (1..120, trimmed). A duplicate name
returns 409 library_name_conflict (same on PATCH).
Tracks
| Method | Path | Purpose | Auth | Request | Response |
|---|---|---|---|---|---|
POST | /v1/libraries/:libraryId/tracks | Add a track | Clerk actor | addLibraryTrackRequestSchema | library track record |
DELETE | /v1/libraries/:libraryId/tracks/:trackId | Remove a track | Clerk actor | — | 204 |
addLibraryTrackRequestSchema is { trackId }. A missing library yields
404 library_not_found; a missing track yields 404 track_not_found.
Shares
| Method | Path | Purpose | Auth | Request | Response |
|---|---|---|---|---|---|
GET | /v1/libraries/:libraryId/shares | List shares | Clerk actor | — | { records: LibraryShare[] } |
POST | /v1/libraries/:libraryId/shares | Invite a collaborator | + collaborators.invite | createLibraryShareRequestSchema | LibraryShare 201 |
PATCH | /v1/libraries/:libraryId/shares/:shareId | Change access / accept | Clerk actor | updateLibraryShareRequestSchema | LibraryShare |
DELETE | /v1/libraries/:libraryId/shares/:shareId | Revoke a share | Clerk actor | — | 204 |
createLibraryShareRequestSchema requires one of targetUserId or email,
plus accessType ∈ viewer | editor | admin (revoked is not a valid
input). DELETE revokes by setting both accessType and inviteStatus to
revoked.
POST /v1/libraries
curl -s -X POST https://app.swayzio.com/api/swayzio/v1/libraries \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{ "name": "Reference Tracks" }'Returns the created Library (201). A name clash returns
409 library_name_conflict.
POST /v1/libraries/:libraryId/tracks
curl -s -X POST https://app.swayzio.com/api/swayzio/v1/libraries/:libraryId/tracks \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{ "trackId": "trk_123" }'POST /v1/libraries/:libraryId/shares
Invites a collaborator to the library. Gated by collaborators.invite.
curl -s -X POST https://app.swayzio.com/api/swayzio/v1/libraries/:libraryId/shares \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{ "email": "collab@example.com", "accessType": "editor" }'A shared library is reachable by the recipient only through an accepted
share, graded server‑side. Listing your own libraries
(GET /v1/libraries) never returns libraries shared with you — use
GET /v1/libraries/shared-with-me for those. See Authentication
for the owner‑scoping and grant model.