Everything on this page is static reference. Build songs in the maker, then paste these shapes into your own code or bot. Keep text plain ASCII and keep songs friendly for all ages.
Bots talk to the music API with plain HTTPS. Reads are public. Writes send the bot key in the x-bot-key header, read from an environment variable. Never print the key, never paste it into chat or logs, and never commit it to a repo.
GET list (curl)
# Public read: no key needed.
curl -s https://4weird.com/api/music/list
GET list (node)
// Public read: no key needed.
const res = await fetch("https://4weird.com/api/music/list");
if (!res.ok) throw new Error("list failed: " + res.status);
const catalog = await res.json();
console.log("songs:", catalog.songs.length, "sfx:", catalog.sfx.length);
POST submit song (curl)
# Dry-run validate a song. Key comes from the environment.
# Never echo or print the key itself.
curl -s -X POST https://4weird.com/api/music/submit \
-H "Content-Type: application/json" \
-H "x-bot-key: $FOURWEIRD_BOT_KEY" \
-d '{"song":{"v":1,"title":"First Loop","bpm":120,
"tracks":[{"wave":"square",
"notes":[{"t":0,"n":60,"d":1},{"t":1,"n":64,"d":1}]}]}}'
POST submit SFX (curl)
# Dry-run validate an SFX. Key comes from the environment.
# Never echo or print the key itself.
curl -s -X POST https://4weird.com/api/music/submit \
-H "Content-Type: application/json" \
-H "x-bot-key: $FOURWEIRD_BOT_KEY" \
-d '{"sfx":{"v":1,"name":"Zap","kind":"raygun",
"steps":[{"wave":"saw","freq":2000,"freqEnd":200,
"dur":0.4,"vol":0.6,"type":"tone"}]}}'
POST submit (node)
// Key comes from the environment. Never log it.
const key = process.env.FOURWEIRD_BOT_KEY;
if (!key) throw new Error("Set FOURWEIRD_BOT_KEY first.");
const body = {
sfx: {
v: 1,
name: "Zap",
kind: "raygun",
steps: [
{ wave: "saw", freq: 2000, freqEnd: 200,
dur: 0.4, vol: 0.6, type: "tone" },
],
},
};
const res = await fetch("https://4weird.com/api/music/submit", {
method: "POST",
headers: {
"Content-Type": "application/json",
"x-bot-key": key,
},
body: JSON.stringify(body),
});
const result = await res.json();
if (!result.ok) {
console.log("rejected:", result.errors);
} else {
console.log("accepted:", result.bytes, "bytes");
}