POST

Create or update a user

Create a user ahead of their first session, or update one, matched by your own id.

View as Markdown
POSThttps://api.muzekit.com/v1/users

Body

idstringrequired

Your own id for this user (1 to 255 characters). Stored as external_id.

namestring

Display name.

emailstring

Email. Muzekit never emails end users.

localestring

Editor language, e.g. en, de.

metadataobject

Your own data, up to 4 KB as JSON; more answers 400 invalid_request.

Request

curl https://api.muzekit.com/v1/users \
  -H "Authorization: Bearer $MUZEKIT_SECRET_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "id": "user_42", "name": "Ada", "email": "[email protected]" }'

The user is matched by id in this key's environment. A new id creates the user (and sends the user.created webhook); a known id updates the fields you send and keeps the others. Both answer 201 with the user. You don't need this call before a session: Create a session upserts the user the same way.

Examples

Add a user when they sign up in your app

Call it from your signup handler so the user exists before they first open the editor. You can then upload files into their library or list them in your admin before any session. Keep the returned usr_… id next to your own user.

curl https://api.muzekit.com/v1/users \
  -H "Authorization: Bearer $MUZEKIT_SECRET_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: signup-user_42" \
  -d '{
    "id": "user_42",
    "name": "Ada Lovelace",
    "email": "[email protected]",
    "locale": "en",
    "metadata": { "tier": "pro", "company": "Analytical Engines" }
  }'

metadata is kept as you send it, for your own use. Muzekit doesn't read it, so it doesn't change what the editor allows. Set per-tier limits on the session instead.

Update a user when their profile changes

Send only the fields that changed. Fields you leave out keep their value. metadata is replaced as a whole, so send the full object, not just the changed key.

curl https://api.muzekit.com/v1/users \
  -H "Authorization: Bearer $MUZEKIT_SECRET_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "id": "user_42", "locale": "de", "metadata": { "tier": "team" } }'

The new locale sets the editor's language from the user's next session, unless that session passes its own locale.

Import your existing users

Loop over your users once to add them all, for example before you launch the editor. Calls are rate limited to 600 a minute from one address, so a large import should pace itself.

# users.csv: id,name,email (no header row)
while IFS=, read -r id name email; do
  curl -s https://api.muzekit.com/v1/users \
    -H "Authorization: Bearer $MUZEKIT_SECRET_KEY" \
    -H "Content-Type: application/json" \
    -d "{ \"id\": \"$id\", \"name\": \"$name\", \"email\": \"$email\" }"
  sleep 0.2
done < users.csv

id must be a string, so convert numeric ids. A bad email answers 400 invalid_request with param: "email" for that user only.

Find a user's Muzekit id from your own id

Post just the id to get the user's usr_… id, then read what they made with List templates (?user=usr_…). If the id is new, this creates the user, so use ids from your own user table.

USER=$(curl -s https://api.muzekit.com/v1/users \
  -H "Authorization: Bearer $MUZEKIT_SECRET_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "id": "user_42" }' | jq -r .id)

curl "https://api.muzekit.com/v1/templates?user=$USER" \
  -H "Authorization: Bearer $MUZEKIT_SECRET_KEY"

Each call also moves the user's last_active_at to now. To avoid that, keep the usr_… id from the first response.

Response

JSON
{
  "object": "user",
  "id": "usr_8fK2mQ1xZpR",
  "external_id": "user_42",
  "name": "Ada Lovelace",
  "email": "[email protected]",
  "locale": "en",
  "metadata": { "tier": "pro", "company": "Analytical Engines" },
  "last_active_at": "2026-10-16T21:35:00.000Z",
  "created_at": "2026-10-16T21:35:00.000Z"
}

Errors: 400 invalid_request names the field in param (a missing id, a bad email, metadata over 4 KB). See Errors.