Swayzio Core API v1 — base path /api/swayzio/v1

Packs

A pack is an owner‑scoped collection of tracks — the unit you curate, present, and share. This page covers core CRUD plus the track membership, presentation, analytics, and media‑asset surfaces. Sharing (settings, access grants, tracking links) lives on Pack Sharing; the public viewer surfaces are on Public Share Links.

Every endpoint is under /api/swayzio/v1 and requires a Clerk actor. Responses strip ownerId (and storage URIs) via the clientPack* DTO variants — see Data Contracts. Runtime is native→proxy (see Conventions).

Endpoints

Collections & saved/shared

MethodPathPurposeAuthRequestResponse
GET/v1/packsList packs you ownClerk actor{ records: PackListRecord[] }
POST/v1/packsCreate a pack+ packs.createcreatePackRequestSchemaPack 201
GET/v1/packs/shared-with-mePacks shared with you (via accepted grant)Clerk actor{ records: PackAccessGrant[] }
GET/v1/packs/savedPacks you’ve savedClerk actor{ records: SavedPack[] }

A single pack

MethodPathPurposeAuthRequestResponse
GET/v1/packs/:packIdPack detailClerk actorPack
PATCH/v1/packs/:packIdUpdate (≥1 field)Clerk actorupdatePackRequestSchemaPack
DELETE/v1/packs/:packIdDeleteClerk actor204

Tracks within a pack

MethodPathPurposeAuthRequestResponse
GET/v1/packs/:packId/tracksList pack tracksClerk actor{ records: PackTrack[] }
POST/v1/packs/:packId/tracksAdd a trackClerk actoraddPackTrackRequestSchemaPackTrack
DELETE/v1/packs/:packId/tracks/:trackIdRemove a trackClerk actor204
PUT/v1/packs/:packId/tracks/orderReorder tracksClerk actorreorderPackTracksRequestSchema{ records: PackTrack[] }
GET/v1/packs/:packId/tracks/:trackId/playback-urlSigned streaming URLClerk actorplayback DTO
GET/v1/packs/:packId/tracks/:trackId/download-urlSigned download URLClerk actordownload DTO
POST/v1/packs/:packId/tracks/:trackId/libraryCopy track into one of your librariesClerk actoraddPackTrackToLibraryRequestSchemalibrary record

Presentation, analytics, media & engagement

MethodPathPurposeAuthRequestResponse
GET/v1/packs/:packId/presentationOwner‑side presentation payloadClerk actorclientPackPresentationResponseSchema
GET/v1/packs/:packId/analyticsEngagement rollupsClerk actorpackAnalyticsResponseSchema
GET/v1/packs/:packId/media-assetsSigned pack media assetsClerk actormedia‑assets DTO
POST/v1/packs/:packId/banner/uploadsCover‑image upload intent (alias: …/cover/uploads)Clerk actorpackBannerUploadRequestSchemaupload intent 201
PUT/v1/packs/:packId/saveSave a packClerk actorSavedPack
DELETE/v1/packs/:packId/saveUnsave a packClerk actor204
POST/v1/packs/:packId/share-eventsRecord a client‑side shareClerk actorrecordPackShareRequestSchema{ ok: true }

The cover segment is the current product term for the pack image; banner is kept as a backwards‑compatible alias (the underlying storage kind is still banner_image). Both …/banner/uploads and …/cover/uploads accept the same packBannerUploadRequestSchema payload.

POST /v1/packs

Creates an owner‑scoped pack. The name is trimmed and 1..160 chars; description is optional (≤2000, defaults to ""); type is standard or collaborative (default standard); imageAssetId is an optional reference to an already‑uploaded asset. Gated by the packs.create entitlement.

curl -s -X POST https://app.swayzio.com/api/swayzio/v1/packs \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{ "name": "Summer Demos", "description": "WIP cuts", "type": "standard" }'

Returns the created Pack (201) with ownerId stripped.

POST /v1/packs/:packId/tracks

Adds a track you own to the pack. position is optional (≥0); omit it to append.

curl -s -X POST https://app.swayzio.com/api/swayzio/v1/packs/:packId/tracks \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{ "trackId": "trk_123", "position": 0 }'

Returns the created PackTrack. A missing pack yields 404 pack_not_found; a missing track yields 404 track_not_found.

PUT /v1/packs/:packId/tracks/order

Reorders the whole pack in one call. trackIds must be the exact set already in the pack, in the new order — a mismatch returns 409 track_set_mismatch.

curl -s -X PUT https://app.swayzio.com/api/swayzio/v1/packs/:packId/tracks/order \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{ "trackIds": ["trk_3", "trk_1", "trk_2"] }'

Returns the reordered { records: PackTrack[] }.

Analytics shape

GET /v1/packs/:packId/analytics returns packAnalyticsResponseSchema:

  • totalsviews, plays, downloads, externalClicks, saves, shares, trackingLinkOpens, uniqueVisitors.
  • eventsByType[{ type, count }] keyed by event type.
  • tracks — per‑track { trackId, title, artist, plays, downloads, shares }.
  • updatedAt.

uniqueVisitors is driven by the sessionId the public share client sends, and owner self‑previews are never counted — see Public Share Links and Analytics.