{"openapi": "3.1.0", "info": {"title": "Loopsmith API", "version": "1.1.0", "description": "Make beats with the Loopsmith browser beat maker from code or an AI agent. You send a small JSON spec; you get back a link that opens the finished, editable beat in the app, a readable summary of every part, a project file and a MIDI file. The music is written by the same code the app runs; the audio itself is synthesised in the listener's browser, so there is no audio file to download from this API."}, "servers": [{"url": "https://beats.thetempleofdoom.com"}], "paths": {"/api/v1/health": {"get": {"operationId": "health", "summary": "Liveness and build", "responses": {"200": {"description": "{\"ok\":true,\"version\":\"<git short hash>\"}"}}}}, "/api/v1/beats/{id}/export": {"get": {"operationId": "exportBeat", "summary": "Export links for a beat and whether MIDI needs the export pass", "parameters": [{"name": "id", "in": "path", "required": true, "schema": {"type": "string", "pattern": "^[a-z0-9]{10}$"}}], "security": [{}, {"apiKey": []}], "responses": {"200": {"description": "Links"}, "404": {"description": "Error", "content": {"application/json": {"schema": {"type": "object", "properties": {"error": {"type": "object", "properties": {"code": {"type": "string", "description": "Short machine code, e.g. bad_request, not_found, rate_limited, pass_required."}, "message": {"type": "string", "description": "A plain sentence saying what to fix."}}}}}}}}}}}, "/api/v1/billing": {"get": {"operationId": "billing", "summary": "Accounts, free trial, payment methods and the export pass price (Temple v2 shape)", "responses": {"200": {"description": "Billing facts"}}}}, "/api/v1/catalog": {"get": {"operationId": "catalog", "summary": "Styles, kits, sounds and scales you can use in a spec", "responses": {"200": {"description": "Catalog"}}}}, "/api/v1/beats": {"post": {"operationId": "makeBeat", "summary": "Make a beat", "security": [{}, {"apiKey": []}], "requestBody": {"required": true, "content": {"application/json": {"schema": {"$ref": "#/components/schemas/BeatSpec"}, "examples": {"e0": {"summary": "A ready-made lo-fi sketch in D", "value": {"start": "sketch", "style": "lofi", "key": "D"}}, "e1": {"summary": "A full dubstep track", "value": {"start": "track", "style": "dubstep", "name": "Night Bus"}}, "e2": {"summary": "Your own kick and bassline, finished as techno", "value": {"style": "techno", "bpm": 132, "drums": {"kick": "x...x...x...x..."}, "bass": [{"pitch": "A1", "step": 0, "len": 2}, {"pitch": "A1", "step": 3}, {"pitch": "C2", "step": 6, "len": 2}], "full_track": true}}}}}}, "responses": {"201": {"description": "The beat", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Beat"}}}}, "400": {"description": "Error", "content": {"application/json": {"schema": {"type": "object", "properties": {"error": {"type": "object", "properties": {"code": {"type": "string", "description": "Short machine code, e.g. bad_request, not_found, rate_limited, pass_required."}, "message": {"type": "string", "description": "A plain sentence saying what to fix."}}}}}}}}, "429": {"description": "Error", "content": {"application/json": {"schema": {"type": "object", "properties": {"error": {"type": "object", "properties": {"code": {"type": "string", "description": "Short machine code, e.g. bad_request, not_found, rate_limited, pass_required."}, "message": {"type": "string", "description": "A plain sentence saying what to fix."}}}}}}}}}}}, "/api/v1/beats/{id}": {"get": {"operationId": "getBeat", "summary": "Read a beat: summary and every pattern as text", "parameters": [{"name": "id", "in": "path", "required": true, "schema": {"type": "string", "pattern": "^[a-z0-9]{10}$"}}], "responses": {"200": {"description": "The beat", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Beat"}}}}, "404": {"description": "Error", "content": {"application/json": {"schema": {"type": "object", "properties": {"error": {"type": "object", "properties": {"code": {"type": "string", "description": "Short machine code, e.g. bad_request, not_found, rate_limited, pass_required."}, "message": {"type": "string", "description": "A plain sentence saying what to fix."}}}}}}}}}}}, "/api/v1/beats/{id}/remix": {"post": {"operationId": "remixBeat", "summary": "Make a new beat from an old one with some spec fields changed (null removes a field)", "parameters": [{"name": "id", "in": "path", "required": true, "schema": {"type": "string", "pattern": "^[a-z0-9]{10}$"}}], "security": [{}, {"apiKey": []}], "requestBody": {"required": true, "content": {"application/json": {"schema": {"$ref": "#/components/schemas/BeatSpec"}}}}, "responses": {"201": {"description": "The beat", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Beat"}}}}, "400": {"description": "Error", "content": {"application/json": {"schema": {"type": "object", "properties": {"error": {"type": "object", "properties": {"code": {"type": "string", "description": "Short machine code, e.g. bad_request, not_found, rate_limited, pass_required."}, "message": {"type": "string", "description": "A plain sentence saying what to fix."}}}}}}}}, "404": {"description": "Error", "content": {"application/json": {"schema": {"type": "object", "properties": {"error": {"type": "object", "properties": {"code": {"type": "string", "description": "Short machine code, e.g. bad_request, not_found, rate_limited, pass_required."}, "message": {"type": "string", "description": "A plain sentence saying what to fix."}}}}}}}}}}}, "/api/v1/beats/{id}/midi": {"get": {"operationId": "beatMidi", "summary": "Standard MIDI file (drums on channel 10). Needs an export-pass account key when export_needs_pass is true.", "parameters": [{"name": "id", "in": "path", "required": true, "schema": {"type": "string", "pattern": "^[a-z0-9]{10}$"}}], "security": [{}, {"apiKey": []}], "responses": {"200": {"description": "MIDI file", "content": {"audio/midi": {}}}, "402": {"description": "Error", "content": {"application/json": {"schema": {"type": "object", "properties": {"error": {"type": "object", "properties": {"code": {"type": "string", "description": "Short machine code, e.g. bad_request, not_found, rate_limited, pass_required."}, "message": {"type": "string", "description": "A plain sentence saying what to fix."}}}}}}}}, "404": {"description": "Error", "content": {"application/json": {"schema": {"type": "object", "properties": {"error": {"type": "object", "properties": {"code": {"type": "string", "description": "Short machine code, e.g. bad_request, not_found, rate_limited, pass_required."}, "message": {"type": "string", "description": "A plain sentence saying what to fix."}}}}}}}}}}}, "/api/v1/beats/{id}/project": {"get": {"operationId": "beatProject", "summary": "Loopsmith project file (import it in the app: Projects, Import .json)", "parameters": [{"name": "id", "in": "path", "required": true, "schema": {"type": "string", "pattern": "^[a-z0-9]{10}$"}}], "responses": {"200": {"description": "Project JSON"}, "404": {"description": "Error", "content": {"application/json": {"schema": {"type": "object", "properties": {"error": {"type": "object", "properties": {"code": {"type": "string", "description": "Short machine code, e.g. bad_request, not_found, rate_limited, pass_required."}, "message": {"type": "string", "description": "A plain sentence saying what to fix."}}}}}}}}}}}, "/b/{id}": {"get": {"operationId": "openBeat", "summary": "Open the beat in the Loopsmith app (redirect)", "parameters": [{"name": "id", "in": "path", "required": true, "schema": {"type": "string", "pattern": "^[a-z0-9]{10}$"}}], "responses": {"302": {"description": "Redirect to the app"}, "404": {"description": "Error", "content": {"application/json": {"schema": {"type": "object", "properties": {"error": {"type": "object", "properties": {"code": {"type": "string", "description": "Short machine code, e.g. bad_request, not_found, rate_limited, pass_required."}, "message": {"type": "string", "description": "A plain sentence saying what to fix."}}}}}}}}}}}, "/api/v1/me": {"get": {"operationId": "me", "summary": "The account behind the API key", "security": [{"apiKey": []}], "responses": {"200": {"description": "Account"}, "401": {"description": "Error", "content": {"application/json": {"schema": {"type": "object", "properties": {"error": {"type": "object", "properties": {"code": {"type": "string", "description": "Short machine code, e.g. bad_request, not_found, rate_limited, pass_required."}, "message": {"type": "string", "description": "A plain sentence saying what to fix."}}}}}}}}}}}, "/api/v1/songs": {"get": {"operationId": "songs", "summary": "Songs saved to the profile", "security": [{"apiKey": []}], "responses": {"200": {"description": "Songs"}, "401": {"description": "Error", "content": {"application/json": {"schema": {"type": "object", "properties": {"error": {"type": "object", "properties": {"code": {"type": "string", "description": "Short machine code, e.g. bad_request, not_found, rate_limited, pass_required."}, "message": {"type": "string", "description": "A plain sentence saying what to fix."}}}}}}}}}}}, "/api/v1/songs/{slot}": {"get": {"operationId": "readSong", "summary": "Read a saved song as a summary and text patterns", "parameters": [{"name": "slot", "in": "path", "required": true, "schema": {"type": "integer", "minimum": 1, "maximum": 2}}], "security": [{"apiKey": []}], "responses": {"200": {"description": "Song"}, "401": {"description": "Error", "content": {"application/json": {"schema": {"type": "object", "properties": {"error": {"type": "object", "properties": {"code": {"type": "string", "description": "Short machine code, e.g. bad_request, not_found, rate_limited, pass_required."}, "message": {"type": "string", "description": "A plain sentence saying what to fix."}}}}}}}}, "404": {"description": "Error", "content": {"application/json": {"schema": {"type": "object", "properties": {"error": {"type": "object", "properties": {"code": {"type": "string", "description": "Short machine code, e.g. bad_request, not_found, rate_limited, pass_required."}, "message": {"type": "string", "description": "A plain sentence saying what to fix."}}}}}}}}}}, "put": {"operationId": "saveSong", "summary": "Save a beat into a profile slot", "parameters": [{"name": "slot", "in": "path", "required": true, "schema": {"type": "integer", "minimum": 1, "maximum": 2}}], "security": [{"apiKey": []}], "requestBody": {"required": true, "content": {"application/json": {"schema": {"type": "object", "properties": {"beat_id": {"type": "string"}, "name": {"type": "string"}, "overwrite": {"type": "boolean", "description": "Needed to replace a song already in the slot."}}}}}}, "responses": {"200": {"description": "Saved"}, "401": {"description": "Error", "content": {"application/json": {"schema": {"type": "object", "properties": {"error": {"type": "object", "properties": {"code": {"type": "string", "description": "Short machine code, e.g. bad_request, not_found, rate_limited, pass_required."}, "message": {"type": "string", "description": "A plain sentence saying what to fix."}}}}}}}}, "409": {"description": "Error", "content": {"application/json": {"schema": {"type": "object", "properties": {"error": {"type": "object", "properties": {"code": {"type": "string", "description": "Short machine code, e.g. bad_request, not_found, rate_limited, pass_required."}, "message": {"type": "string", "description": "A plain sentence saying what to fix."}}}}}}}}}}}}, "components": {"securitySchemes": {"apiKey": {"type": "apiKey", "in": "header", "name": "X-API-Key", "description": "API key from the account page (ls_...). Also accepted as \"Authorization: Bearer ls_...\"."}}, "schemas": {"BeatSpec": {"type": "object", "additionalProperties": false, "properties": {"start": {"type": "string", "enum": ["sketch", "track", "blank"], "description": "sketch = a ready-made 16-bar idea; track = a ready-made full dance track (72 bars: intro, build, drop, break, build, drop, outro); blank = start empty, write your own drums/bass/melody/chords and let Loopsmith finish the rest. Default: blank if you send any parts; otherwise sketch for a sketch style and track for a dance-only style."}, "style": {"type": "string", "enum": ["bigroom", "deephouse", "dnb", "dubstep", "futurebass", "hiphop", "house", "lofi", "melodichouse", "pop", "reggaeton", "techhouse", "techno", "trance", "trap", "ukg"], "description": "Genre. For start=sketch: hiphop, trap, house, lofi, dnb, reggaeton, pop. For start=track or blank: house, deephouse, techhouse, techno, trance, bigroom, futurebass, dubstep, dnb, ukg, melodichouse. Defaults: hiphop (sketch), house (track, blank)."}, "name": {"type": "string", "maxLength": 60, "description": "Title shown in the app."}, "bpm": {"type": "integer", "minimum": 60, "maximum": 200, "description": "Tempo. Default: the style's own tempo."}, "key": {"type": "string", "description": "Root note: C, C#, Db, D ... B. Ready-made sketches and tracks are transposed to it."}, "scale": {"type": "string", "enum": ["minor", "major", "dorian", "harmonic", "pentaMinor", "pentaMajor", "blues", "chromatic"], "description": "Scale, only with start=blank."}, "swing": {"type": "number", "minimum": 0, "maximum": 1, "description": "Shuffle amount. 0 = straight."}, "kit": {"type": "string", "enum": ["boom", "room", "dusty", "tape", "grit", "tick", "arena", "volt"], "description": "Drum kit: boom = Boom (808-style); room = Room (acoustic-ish); dusty = Dusty (lo-fi); tape = Tape (warm & saturated); grit = Grit (industrial); tick = Tick (minimal); arena = Arena (big room); volt = Volt (electronic)."}, "sounds": {"type": "object", "additionalProperties": false, "description": "Instrument presets.", "properties": {"bass": {"type": "string", "enum": ["Sub Bass", "Acid Line", "Reese", "808 Glide", "FM Bass", "Wobble", "Offbeat Bass", "Pluck Bass"], "description": "Bass sound."}, "melody": {"type": "string", "enum": ["Bright Saw", "Supersaw", "FM Bell", "Nylon Pluck", "EDM Pluck", "Supersaw Stab", "Hoover", "Vox Chop", "Chip Square", "Glass Bell", "Soft Flute"], "description": "Lead sound that plays the melody."}, "chords": {"type": "string", "enum": ["Warm Pad", "FM E-Piano", "Harp", "Trance Gate", "Supersaw Pad", "Velvet Keys", "Dream Choir", "Tape Organ"], "description": "Keys or pad sound that plays the chords."}}}, "flavour": {"type": "string", "enum": ["punchy", "soft", "dreamy", "dark", "bright", "retro"], "description": "One-tap retune of every instrument."}, "bars": {"type": "integer", "enum": [1, 2], "description": "Pattern length for start=blank: 1 bar (16 steps) or 2 bars (32 steps). Default 2."}, "drums": {"type": "object", "additionalProperties": false, "description": "Your own drum lanes (start=blank). A 16-character lane repeats to fill 2 bars. Example: {\"kick\":\"x...x...x...x...\",\"clap\":\"....x.......x...\"}", "properties": {"kick": {"type": "string", "pattern": "^[xXo\\-. _]{16}([xXo\\-. _]{16})?$", "description": "Kick lane. 16 or 32 characters, one per 16th note: x hit, X accent, o soft, - ghost, . rest."}, "snare": {"type": "string", "pattern": "^[xXo\\-. _]{16}([xXo\\-. _]{16})?$", "description": "Snare lane. 16 or 32 characters, one per 16th note: x hit, X accent, o soft, - ghost, . rest."}, "clap": {"type": "string", "pattern": "^[xXo\\-. _]{16}([xXo\\-. _]{16})?$", "description": "Clap lane. 16 or 32 characters, one per 16th note: x hit, X accent, o soft, - ghost, . rest."}, "chat": {"type": "string", "pattern": "^[xXo\\-. _]{16}([xXo\\-. _]{16})?$", "description": "Closed hat lane. 16 or 32 characters, one per 16th note: x hit, X accent, o soft, - ghost, . rest."}, "ohat": {"type": "string", "pattern": "^[xXo\\-. _]{16}([xXo\\-. _]{16})?$", "description": "Open hat lane. 16 or 32 characters, one per 16th note: x hit, X accent, o soft, - ghost, . rest."}, "tom": {"type": "string", "pattern": "^[xXo\\-. _]{16}([xXo\\-. _]{16})?$", "description": "Tom lane. 16 or 32 characters, one per 16th note: x hit, X accent, o soft, - ghost, . rest."}, "rim": {"type": "string", "pattern": "^[xXo\\-. _]{16}([xXo\\-. _]{16})?$", "description": "Rim lane. 16 or 32 characters, one per 16th note: x hit, X accent, o soft, - ghost, . rest."}, "crash": {"type": "string", "pattern": "^[xXo\\-. _]{16}([xXo\\-. _]{16})?$", "description": "Crash lane. 16 or 32 characters, one per 16th note: x hit, X accent, o soft, - ghost, . rest."}}}, "bass": {"type": "array", "maxItems": 128, "items": {"type": "object", "required": ["pitch", "step"], "additionalProperties": false, "properties": {"pitch": {"description": "Note name such as A1, F#2, Bb3, or a MIDI number. Range C1-C4.", "type": ["string", "integer"]}, "step": {"type": "number", "minimum": 0, "maximum": 31.75, "description": "Start position in 16th notes from the start of the pattern (0 = first beat, 4 = second beat, 16 = bar 2)."}, "len": {"type": "number", "minimum": 0.5, "maximum": 32, "description": "Length in 16th notes. Default 1."}, "vel": {"type": "number", "minimum": 0.05, "maximum": 1, "description": "Loudness 0.05-1. Default 0.8."}}}, "description": "Your own bass notes (start=blank)."}, "melody": {"type": "array", "maxItems": 128, "items": {"type": "object", "required": ["pitch", "step"], "additionalProperties": false, "properties": {"pitch": {"description": "Note name such as A1, F#2, Bb3, or a MIDI number. Range C3-C7.", "type": ["string", "integer"]}, "step": {"type": "number", "minimum": 0, "maximum": 31.75, "description": "Start position in 16th notes from the start of the pattern (0 = first beat, 4 = second beat, 16 = bar 2)."}, "len": {"type": "number", "minimum": 0.5, "maximum": 32, "description": "Length in 16th notes. Default 1."}, "vel": {"type": "number", "minimum": 0.05, "maximum": 1, "description": "Loudness 0.05-1. Default 0.8."}}}, "description": "Your own melody notes (start=blank)."}, "chords": {"type": "array", "maxItems": 128, "items": {"type": "object", "required": ["pitch", "step"], "additionalProperties": false, "properties": {"pitch": {"description": "Note name such as A1, F#2, Bb3, or a MIDI number. Range C2-C6.", "type": ["string", "integer"]}, "step": {"type": "number", "minimum": 0, "maximum": 31.75, "description": "Start position in 16th notes from the start of the pattern (0 = first beat, 4 = second beat, 16 = bar 2)."}, "len": {"type": "number", "minimum": 0.5, "maximum": 32, "description": "Length in 16th notes. Default 1."}, "vel": {"type": "number", "minimum": 0.05, "maximum": 1, "description": "Loudness 0.05-1. Default 0.8."}}}, "description": "Your own chord notes (start=blank); notes sharing a step sound together."}, "finish": {"description": "start=blank only. true (default) = Loopsmith writes every part you did not, fitted to yours, and never changes your notes. false = keep only what you sent. Or a list of parts to write: drums, bass, chords, melody.", "anyOf": [{"type": "boolean"}, {"type": "array", "items": {"type": "string", "enum": ["drums", "bass", "chords", "melody"]}}]}, "amount": {"type": "number", "minimum": 0, "maximum": 1, "description": "How busy the finished parts are, 0 (a little) to 1 (a lot). Default 0.6."}, "full_track": {"type": "boolean", "description": "Expand a sketch or a blank-start loop into a full arranged track with builds and drops (about 3 minutes)."}, "seed": {"type": "integer", "minimum": 0, "maximum": 4294967295, "description": "Same spec and seed give the same beat. Leave out for a new take each time."}}}, "Beat": {"type": "object", "properties": {"id": {"type": "string"}, "name": {"type": "string"}, "url": {"type": "string", "description": "Opens the beat in the app"}, "midi_url": {"type": "string"}, "project_url": {"type": "string"}, "summary": {"type": "object"}, "patterns": {"type": "array", "items": {"type": "object"}}, "spec": {"$ref": "#/components/schemas/BeatSpec"}, "seed": {"type": "integer"}, "expires": {"type": "integer"}}}}}}