API Reference

/

POST /v1/splats/{id}/share-link

POST /api/v1/splats/{splatId}/share-link

Get the share link token for an unlisted Scene owned by the supplied external user. Integrations that enforce share links only let other people open an unlisted Scene through this token; a direct ID alone is not enough.

POST

https://moshpit.studio/api/v1/splats/{splatId}/share-link

Auth

All three headers are required:

–

Plain

Authorization: Bearer msk_YOUR_SECRET_KEY
X-Moshpit-Public-Key: mpk_YOUR_PUBLIC_KEY
X-Moshpit-External-User-Id: YOUR_HOST_USER_ID

The Scene must belong to the integration tied to the keys, and its externalUserId must match the header value. Otherwise the response is 404.

Behavior

  • Unlisted Scene: returns the live token. If the Scene has no token yet, a new token is issued. It has no time-based expiry and stays valid while the Scene remains unlisted. Calling again returns the same token.
  • Public Scene: returns shareToken: null. Anyone can open a public Scene by ID, so no token is needed.
  • Private Scene: returns 409 SCENE_NOT_SHAREABLE. Private Scenes open only for their owner.
  • Visibility changes: when the Scene stops being unlisted, its token stops working permanently. Making it unlisted again issues a new token on the next call.

Pass the token to POST /api/editor/embed-sessions as shareToken when minting a viewer session for someone who opened your share URL. Keep the token out of logs and analytics, and serve share URLs with Referrer-Policy: no-referrer.

Example request

SH

Bash

curl -X POST "https://moshpit.studio/api/v1/splats/65f1a2b3c4d5e6f7a8b9c0d1/share-link" \
  -H "Authorization: Bearer msk_YOUR_SECRET_KEY" \
  -H "X-Moshpit-Public-Key: mpk_YOUR_PUBLIC_KEY" \
  -H "X-Moshpit-External-User-Id: host_user_123"

Success response — 200 OK

{}

JSON

{
  "status": "success",
  "splatId": "65f1a2b3c4d5e6f7a8b9c0d1",
  "visibility": "unlisted",
  "shareToken": "Qm9iIGlzIGEgc2hhcmUgdG9rZW4gZXhhbXBsZSAxMjM",
  "expiresAt": null
}
FieldTypeDescription
visibility
"public" | "unlisted"

The Scene visibility the token applies to.

shareToken
string | null

A 43-character URL-safe token for unlisted Scenes; `null` for public Scenes.

expiresAt
null

Always `null`. Share tokens have no time-based expiry; leaving unlisted ends the token permanently.

Error responses

StatusCause
401Missing or invalid Bearer / public-key combination
404Scene not found, archived, or not owned by the supplied external user
409SCENE_NOT_SHAREABLE: the Scene is private
409The Scene changed visibility while the token was being issued; retry
{}

JSON

{
  "status": "error",
  "code": "SCENE_NOT_SHAREABLE",
  "message": "Private scenes cannot be shared",
  "visibility": "private"
}

What's next