{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/soundza-com/json-schema/soundza-com-music-generation-schema.json",
  "title": "MusicGeneration",
  "x-generated": "2026-11-25",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/soundza-com-openapi.json#/components/schemas/MusicGeneration",
  "type": "object",
  "properties": {
    "id": {
      "type": "string"
    },
    "status": {
      "type": "string",
      "enum": [
        "queued",
        "running",
        "succeeded",
        "failed"
      ],
      "description": "queued and running: still working; poll poll_url until succeeded or failed."
    },
    "model": {
      "type": "string",
      "description": "The model: \"stable\" (Stable Audio 3) or \"lyria\" (Lyria)."
    },
    "looping": {
      "type": "boolean"
    },
    "prompt": {
      "type": "string"
    },
    "ai_content": {
      "type": "string",
      "const": "ai",
      "description": "All generated music is AI-generated."
    },
    "license": {
      "type": "string"
    },
    "loop": {
      "description": "Present once a looping job has succeeded.",
      "type": "object",
      "properties": {
        "url": {
          "type": "string",
          "description": "The WAV loop at soundza.com/g/<id>. Needs no key. Works for 120 days, then answers 410."
        },
        "preview_url": {
          "type": "string",
          "description": "An MP3 preview of the loop, for listening only: the url with ?format=mp3. MP3 adds a few milliseconds of silence at each end, so it has a short gap when repeated. Loop the WAV url."
        },
        "file_name": {
          "type": "string"
        },
        "duration_s": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ]
        },
        "bpm": {
          "anyOf": [
            {
              "type": "integer",
              "minimum": -9007199254740991,
              "maximum": 9007199254740991
            },
            {
              "type": "null"
            }
          ],
          "description": "The loop's tempo."
        },
        "bars": {
          "anyOf": [
            {
              "type": "integer",
              "minimum": -9007199254740991,
              "maximum": 9007199254740991
            },
            {
              "type": "null"
            }
          ],
          "description": "How many bars the loop runs."
        },
        "seamless": {
          "type": "boolean",
          "const": true,
          "description": "The WAV (url) runs from its end back into its start with no gap or click. The MP3 preview does not."
        }
      },
      "required": [
        "url",
        "preview_url",
        "file_name",
        "duration_s",
        "bpm",
        "bars",
        "seamless"
      ],
      "additionalProperties": false
    },
    "track": {
      "description": "Present once a non-looping job has succeeded.",
      "type": "object",
      "properties": {
        "url": {
          "type": "string",
          "description": "The WAV track at soundza.com/g/<id>. Works for 120 days, then answers 410."
        },
        "preview_url": {
          "type": "string",
          "description": "An MP3 preview of the track: the url with ?format=mp3."
        },
        "file_name": {
          "type": "string"
        },
        "duration_s": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "required": [
        "url",
        "preview_url",
        "file_name",
        "duration_s"
      ],
      "additionalProperties": false
    },
    "intro_url": {
      "description": "A one-shot intro WAV to play once before the loop, when the model wrote one.",
      "type": "string"
    },
    "error": {
      "anyOf": [
        {
          "type": "object",
          "properties": {
            "code": {
              "type": "string",
              "const": "generation_failed"
            },
            "message": {
              "type": "string"
            }
          },
          "required": [
            "code",
            "message"
          ],
          "additionalProperties": false
        },
        {
          "type": "null"
        }
      ]
    },
    "quota": {
      "description": "This account's weekly use of the model, after this job.",
      "type": "object",
      "properties": {
        "model": {
          "type": "string"
        },
        "used": {
          "type": "integer",
          "minimum": -9007199254740991,
          "maximum": 9007199254740991
        },
        "remaining": {
          "type": "integer",
          "minimum": -9007199254740991,
          "maximum": 9007199254740991
        }
      },
      "required": [
        "model",
        "used",
        "remaining"
      ],
      "additionalProperties": false
    },
    "created_at": {
      "type": "string"
    },
    "finished_at": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "expires_at": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "description": "When the links stop working: 120 days after the job finished. Null until it has succeeded."
    },
    "poll_url": {
      "type": "string",
      "description": "GET this for the job's current state."
    },
    "poll_after_seconds": {
      "description": "While queued or running: seconds to wait before polling again.",
      "type": "integer",
      "minimum": -9007199254740991,
      "maximum": 9007199254740991
    }
  },
  "required": [
    "id",
    "status",
    "model",
    "looping",
    "prompt",
    "ai_content",
    "license",
    "error",
    "created_at",
    "finished_at",
    "expires_at",
    "poll_url"
  ],
  "additionalProperties": false
}