Skip to content

Quickstart ​

Base URL ​

text
https://api.plemuz.com/v1

Every path in this documentation is relative to it. Send and expect application/json. Errors come back as application/problem+json.

1. Read something as a guest ​

Public reads need no token. Search is guest-safe:

bash
curl "https://api.plemuz.com/v1/search?q=afrobeats"
json
{
  "data": {
    "query": "afrobeats",
    "topHit": { "type": "recording", "refId": "0192…", "title": "…" },
    "groups": [{ "type": "recording", "items": [], "hasMore": true }]
  },
  "meta": { "requestId": "0192f6c4-…" }
}

Every success is { data, meta }. Keep meta.requestId: support asks for it, and it's also in every error.

2. Sign in ​

bash
curl -X POST "https://api.plemuz.com/v1/auth/sign-in" \
  -H "Content-Type: application/json" \
  -d '{
    "email": "ada@example.com",
    "password": "correct horse battery staple",
    "device": { "key": "install-7f3a9c21", "platform": "ios", "name": "Ada’s iPhone", "appVersion": "2.0.0" }
  }'
json
{
  "data": {
    "user": { "id": "0192…", "email": "ada@example.com" },
    "tokens": {
      "accessToken": "eyJhbGciOiJFUzI1NiIs…",
      "refreshToken": "0192….s3cr3t",
      "tokenType": "Bearer",
      "expiresIn": 900
    }
  },
  "meta": { "requestId": "…" }
}

device.key is a stable value your app generates once per install. New accounts start with POST /auth/sign-up and confirm the emailed 6-digit code with POST /auth/verify-email, which also returns tokens. Google and Apple sign-in use POST /auth/oidc.

3. Call an authenticated endpoint ​

bash
curl "https://api.plemuz.com/v1/me" \
  -H "Authorization: Bearer $ACCESS_TOKEN"

4. Refresh before the access token expires ​

Access tokens last 15 minutes. Exchange the refresh token for a new pair; refresh tokens rotate, so store the new one each time.

bash
curl -X POST "https://api.plemuz.com/v1/auth/refresh" \
  -H "Content-Type: application/json" \
  -d '{ "refreshToken": "'"$REFRESH_TOKEN"'" }'

A 401 with code: "AUTH_TOKEN_EXPIRED" is retryable: refresh, then repeat the request once. AUTH_REFRESH_INVALID means sign in again.

5. Handle errors by code ​

json
{
  "type": "https://api.plemuz.com/errors/playback-not-entitled",
  "title": "Subscribe to play the full track",
  "status": 403,
  "code": "PLAYBACK_NOT_ENTITLED",
  "instance": "/v1/playback/…",
  "requestId": "…",
  "retryable": false,
  "actions": [
    { "kind": "start_trial", "label": "Start free trial", "deepLink": "https://spread.plemuz.com/subscribe/trial" },
    { "kind": "subscribe", "label": "See Premium plans", "deepLink": "https://spread.plemuz.com/subscribe" }
  ]
}

Show title as is, branch on code, and render actions as buttons. See Errors.

Next ​

Plemuz API v2