Skip to main content
POST
Create a Session Token

Authorizations

Authorization
string
header
required

Developer Key (Melody Key) tied to your organization. Your Organization ID and Developer Key are issued to you by Melody — contact support@getmelody.io to request them. Used to create session tokens via POST /api/sessions/v2, and to link devices via the X-Org-Key header on POST /device/otp/confirm/v2.

Body

application/json
device_keys
string[]

Device Keys the session token may control. Omit to allow every device linked to your organization.

Pattern: ^[a-z]+-[a-z]+-[a-z]+-[a-z]+$

Response

Session token created

Response from POST /api/sessions/v2. Contains a short-lived session token used with the X-Device-Key header.

token
string
required

JWT session token for device control. Use as Authorization: Bearer <token> with the X-Device-Key header.

Example:

"eyJhbGciOiJIUzI1NiIs..."

expires_in
integer
required

Token lifetime in seconds. Configurable per organization (default 900 = 15 minutes).

Example:

900