API reference

Create musical

Generates a narrated story with a sung lullaby in the middle (audio) from a prompt. Costs 2 credits (3 with a cover image), charged on success only.

Request

POST/api/v1/musical

Requires Authorization: Bearer sk_live_.... Returns 202 Accepted with a job_id; poll GET /api/v1/jobs/{job_id} until the job reaches a terminal status.

POST /api/v1/musical
curl -X POST https://www.sleepytale.com/api/v1/musical \
  -H "Authorization: Bearer $SLEEPYTALE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"prompt": "a sleepy little fox curling up under the stars"}'

Headers

ParameterTypeDescription
AuthorizationrequiredstringBearer token with your secret key: Bearer sk_live_...
Idempotency-KeyoptionalstringOptional unique key. Replaying the same key returns the same job instead of creating a new one.

Body

ParameterTypeDescription
promptrequiredstringWhat the musical should be about. Max 2,000 characters.
include_imageoptionalbooleanWhen true, also generate a cover image (+1 credit). When false, audio only: faster and cheaper. Defaults to false.
styleoptionalstringOptional art style for the cover image (only used when include_image is true). Truncated to 60 characters.

Responses

Response by status
{
  "job_id": "1936f2b0a1c-7e1c2a3b-…",
  "status": "queued"
}

An idempotent replay returns the same job and may report its current status (processing / succeeded / failed) instead of queued. See the overview for the full error-code table and rate-limit headers.

Asynchronous by design

A 202 means the job is accepted, not finished. The audio arrives via GET /api/v1/jobs/{job_id} once status is succeeded.