Pack Sharing
Three layers control who can reach a pack and how:
- Share settings — the access level and per‑pack capability toggles (can visitors download, save, add to library, see splits/stems/versions).
- Access grants — explicit per‑recipient invitations (listener / collaborator / admin) addressed by user id or email.
- Tracking links — Dub‑backed
go.swayzio.comshort links that carry click/visitor analytics.
All endpoints are under /api/swayzio/v1, require a Clerk actor
who owns the pack, and run native→proxy. Responses strip ownerId and provider
internals via clientPack* DTOs — see Data Contracts. The public
viewer side of these links lives on Public Share Links.
Share settings
| Method | Path | Purpose | Auth | Request | Response |
|---|---|---|---|---|---|
GET | /v1/packs/:packId/share-settings | Read current settings | Clerk actor | — | clientPackShareSettingsSchema |
PUT / PATCH | /v1/packs/:packId/share-settings | Update settings | + packs.share | updatePackShareSettingsRequestSchema | clientPackShareSettingsSchema |
updatePackShareSettingsRequestSchema (all fields optional):
accessLevel—private|public_view|public_collaboratedisableDownloads,disableAddToLibrary,disableSocials,disableSavinghideSplits,hideStems,hideVersionsaccessCode—4..128chars, ornullto clear
The stored DTO exposes hasAccessCode (a boolean) rather than the code itself.
Access grants
| Method | Path | Purpose | Auth | Request | Response |
|---|---|---|---|---|---|
GET | /v1/packs/:packId/access-grants | List grants | Clerk actor | — | { records: PackAccessGrant[] } |
POST | /v1/packs/:packId/access-grants | Invite a recipient | + collaborators.invite | createPackAccessGrantRequestSchema | { grant, emailDelivery } 201 |
PATCH | /v1/packs/:packId/access-grants/:grantId | Change access / invite status | Clerk actor | updatePackAccessGrantRequestSchema | PackAccessGrant |
DELETE | /v1/packs/:packId/access-grants/:grantId | Revoke a grant | Clerk actor | — | 204 |
POST | /v1/packs/:packId/access-grants/:grantId/resend | Re‑send the invite email | Clerk actor | — | { grant, emailDelivery } |
createPackAccessGrantRequestSchema requires one of targetUserId or
email, plus accessType ∈ listener | collaborator | admin. revoked is
not a valid input — use DELETE (or PATCH with inviteStatus: "revoked").
Invite email is a stub in native mode. The native (Vercel) route does not
send invite email: POST …/access-grants and …/resend return
emailDelivery: { "status": "skipped", "reason": "email_not_configured" }. The
Fastify Core API (proxy) is the surface that actually delivers via Resend. Treat
a skipped status as “the grant was created/updated, but no email went out from
this runtime.”
Tracking links
| Method | Path | Purpose | Auth | Request | Response |
|---|---|---|---|---|---|
GET | /v1/packs/:packId/tracking-links | List tracking links | Clerk actor | — | { records: PackTrackingLink[] } |
POST | /v1/packs/:packId/tracking-links | Create a tracking link | + packs.share | createPackTrackingLinkRequestSchema | PackTrackingLink 201 |
PATCH | /v1/packs/:packId/tracking-links/:linkId | Rename / set access code / disable | Clerk actor | updatePackTrackingLinkRequestSchema | PackTrackingLink |
DELETE | /v1/packs/:packId/tracking-links/:linkId | Disable (soft‑delete) the link | Clerk actor | — | 204 |
Tracking links are the Dub‑synced go.swayzio.com short links. The response
shareUrl is the copy‑ready URL — the stored external short URL when synced,
otherwise built from the public app URL as /pack-links/:slug; relativePath
gives the host‑less path for callers composing their own origin.
clientPackTrackingLinkSchema strips ownerId and the trackingProvider /
trackingSyncStatus internals.
PUT /v1/packs/:packId/share-settings
Flips the pack public and disables downloads in one call. Gated by packs.share.
curl -s -X PUT https://app.swayzio.com/api/swayzio/v1/packs/:packId/share-settings \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{ "accessLevel": "public_view", "disableDownloads": true }'POST /v1/packs/:packId/access-grants
Invites a collaborator by email. Gated by collaborators.invite.
curl -s -X POST https://app.swayzio.com/api/swayzio/v1/packs/:packId/access-grants \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{ "email": "writer@example.com", "accessType": "collaborator" }'Returns { grant, emailDelivery } (201). See the stub note above for
emailDelivery behavior in native mode.
POST /v1/packs/:packId/tracking-links
Creates a Dub‑backed short link. name defaults to "Share link"; slug is an
optional custom slug (≤96); accessCode (4..128) gates the link; isDefault
marks the pack’s primary link. Gated by packs.share.
curl -s -X POST https://app.swayzio.com/api/swayzio/v1/packs/:packId/tracking-links \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{ "name": "IG bio", "isDefault": false }'The returned shareUrl is ready to paste; click and visitor metrics flow into
Analytics and the pack analytics rollup.