{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/soundza-com/json-schema/soundza-com-generation-schema.json",
  "title": "Generation",
  "x-generated": "2026-11-25",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/soundza-com-openapi.json#/components/schemas/Generation",
  "type": "object",
  "properties": {
    "id": {
      "type": "string"
    },
    "status": {
      "type": "string",
      "enum": [
        "queued",
        "running",
        "succeeded",
        "failed"
      ],
      "description": "queued and running: still working (a call that didn't wait, or waited past its limit); poll poll_url until succeeded or failed."
    },
    "prompt": {
      "type": "string"
    },
    "duration_seconds": {
      "type": "number"
    },
    "takes_requested": {
      "type": "integer",
      "minimum": -9007199254740991,
      "maximum": 9007199254740991
    },
    "seed": {
      "anyOf": [
        {
          "type": "integer",
          "minimum": -9007199254740991,
          "maximum": 9007199254740991
        },
        {
          "type": "null"
        }
      ]
    },
    "model": {
      "type": "string",
      "description": "The model that made the takes: \"stable-audio-3-medium\"."
    },
    "ai_content": {
      "type": "string",
      "const": "ai",
      "description": "Every take is AI-generated."
    },
    "takes": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/Take"
      },
      "description": "Best first. Empty until the job has succeeded."
    },
    "error": {
      "anyOf": [
        {
          "type": "object",
          "properties": {
            "code": {
              "type": "string",
              "const": "generation_failed"
            },
            "message": {
              "type": "string"
            }
          },
          "required": [
            "code",
            "message"
          ],
          "additionalProperties": false
        },
        {
          "type": "null"
        }
      ],
      "description": "Set when the job failed. Failed jobs don't count toward the limits, except these, which come from what was asked: a generation whose takes all came out silent or clipped, and a variation with no clean takes. A sound file that can't be varied doesn't count."
    },
    "created_at": {
      "type": "string"
    },
    "finished_at": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "expires_at": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "description": "When the take 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 the job is queued or running: seconds to wait before polling again.",
      "type": "integer",
      "minimum": -9007199254740991,
      "maximum": 9007199254740991
    },
    "kind": {
      "type": "string",
      "const": "variation",
      "description": "Set on variation jobs (POST /variations) only. Absent on a generation."
    },
    "spread": {
      "anyOf": [
        {
          "type": "integer",
          "minimum": -9007199254740991,
          "maximum": 9007199254740991
        },
        {
          "type": "null"
        }
      ],
      "description": "Variation jobs only: the 1–10 spread the takes were made at (a preset word resolved)."
    },
    "source": {
      "type": "object",
      "properties": {
        "sound_id": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "take_id": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "required": [
        "sound_id",
        "take_id"
      ],
      "additionalProperties": false,
      "description": "Variation jobs only: what was varied, a catalog sound or a take from a generation. One is set."
    }
  },
  "required": [
    "id",
    "status",
    "prompt",
    "duration_seconds",
    "takes_requested",
    "seed",
    "model",
    "ai_content",
    "takes",
    "error",
    "created_at",
    "finished_at",
    "expires_at",
    "poll_url"
  ],
  "additionalProperties": false,
  "$defs": {
    "Take": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string"
        },
        "rank": {
          "type": "integer",
          "minimum": -9007199254740991,
          "maximum": 9007199254740991,
          "description": "1 is the best take."
        },
        "url": {
          "type": "string",
          "description": "The WAV, at soundza.com/g/<id>. Needs no key; redirects to the file. Works for 120 days, then answers 410."
        },
        "preview_url": {
          "type": "string",
          "description": "An MP3 preview of the same take: the url with ?format=mp3."
        },
        "file_name": {
          "type": "string",
          "description": "A file name for the WAV from the prompt and rank, e.g. \"magic-sparkle-chime-1.wav\"."
        },
        "format": {
          "type": "string",
          "const": "wav"
        },
        "duration_seconds": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "required": [
        "id",
        "rank",
        "url",
        "preview_url",
        "file_name",
        "format",
        "duration_seconds"
      ],
      "additionalProperties": false
    }
  }
}