{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/wandura-ai/json-schema/wandura-ai-job-schema.json",
  "title": "Job",
  "x-generated": "2026-11-28",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/wandura-ai-openapi.json#/components/schemas/Job",
  "type": "object",
  "required": [
    "job_id",
    "status",
    "model",
    "style",
    "output",
    "error",
    "created_at",
    "completed_at"
  ],
  "properties": {
    "job_id": {
      "type": "string"
    },
    "status": {
      "$ref": "#/$defs/Status"
    },
    "model": {
      "type": "string"
    },
    "style": {
      "type": "string"
    },
    "output": {
      "type": [
        "array",
        "null"
      ],
      "items": {
        "$ref": "#/$defs/JobFile"
      },
      "description": "succeeded: one file (one output per job); a few models hand out their video twice, without sound first, then with it (JobFile.sound); wandura-background-remove-v1 without background_url adds an MP4 with the transparency stacked (JobFile.alpha_layout). null otherwise."
    },
    "error": {
      "oneOf": [
        {
          "type": "null"
        },
        {
          "$ref": "#/$defs/JobError"
        }
      ],
      "description": "failed / timeout: why. null otherwise (cancelled included)."
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    },
    "completed_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time",
      "description": "When it reached its final status."
    },
    "deadline_at": {
      "type": "string",
      "format": "date-time",
      "description": "Present only when the job has a deadline (timeout_seconds / deadline_at, or your product's default): past it the job ends timeout, not charged."
    },
    "eta": {
      "type": "string",
      "format": "date-time",
      "description": "Video jobs still queued or processing: when the job is expected to end, from the recent run times. Absent once it ended (and on jobs it cannot be estimated for)."
    },
    "notes": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/JobNote"
      },
      "description": "Present only when there is something to tell the end user about their inputs (absent otherwise)."
    },
    "late_output": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/JobFile"
      },
      "description": "D299: a timeout job whose video came after all (work already running at the deadline, ended within 1 h). The status stays timeout and the job stays free; absent otherwise. Also sent once as the job.output_late webhook."
    },
    "late_at": {
      "type": "string",
      "format": "date-time",
      "description": "When late_output came. Absent otherwise."
    },
    "client_reference_id": {
      "type": "string",
      "description": "Your own id for the job, when you sent one. Absent otherwise."
    },
    "result": {
      "type": "object",
      "additionalProperties": true,
      "description": "A succeeded job whose answer is no file (Cinematic Ads refine: its proposals, changes[]; rolling out, wandura-transcribe-v1: {language, translated_to?, cues: [{start, end, text}], words: [{start, end, text}]}; wandura-video-find-v1: {answer, moments: [{start, end, why}], duration}; seconds). Absent otherwise."
    }
  },
  "$defs": {
    "JobError": {
      "type": "object",
      "required": [
        "code",
        "message",
        "retryable"
      ],
      "description": "Rolling out (API www): a job of a raw model or of a Wandura app style that failed on your side (CONTENT_MODERATION_BLOCKED, INPUT_UNUSABLE) is charged only what had already been spent on it, with no margin and never above its price; its message then ends \"Charged only what had already been spent on it, with no margin.\" instead of \"Not charged.\". The code stays. Every other failure is free.",
      "properties": {
        "code": {
          "type": "string",
          "enum": [
            "CONTENT_MODERATION_BLOCKED",
            "INPUT_UNUSABLE",
            "INPUT_NO_SUBJECT",
            "TIMEOUT",
            "GENERATION_FAILED",
            "PRICE_CHANGED",
            "STORY_NO_SCENES"
          ]
        },
        "message": {
          "type": "string"
        },
        "retryable": {
          "type": "boolean"
        },
        "details": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "field",
              "reason"
            ],
            "properties": {
              "field": {
                "type": "string"
              },
              "reason": {
                "type": "string"
              }
            }
          },
          "description": "Rolling out (API www): INPUT_UNUSABLE of a raw model whose input the model's own check refused, when the field is known (for example image_urls[0] and why)."
        }
      }
    },
    "JobFile": {
      "type": "object",
      "required": [
        "url",
        "type"
      ],
      "properties": {
        "url": {
          "type": "string",
          "format": "uri",
          "description": "HTTPS, direct download. Copy it to your storage before expires_at."
        },
        "type": {
          "type": [
            "string",
            "null"
          ],
          "description": "MIME type, e.g. video/mp4."
        },
        "width": {
          "type": [
            "integer",
            "null"
          ]
        },
        "height": {
          "type": [
            "integer",
            "null"
          ]
        },
        "duration": {
          "type": [
            "number",
            "null"
          ],
          "description": "Seconds (video)."
        },
        "fps": {
          "type": [
            "number",
            "null"
          ]
        },
        "size_bytes": {
          "type": [
            "integer",
            "null"
          ]
        },
        "seed": {
          "type": [
            "integer",
            "null"
          ]
        },
        "expires_at": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time"
        },
        "sound": {
          "type": "boolean",
          "description": "Present only on a job that hands out the same video twice: false = no sound track (show it by default), true = with the sound the model made."
        },
        "alpha_layout": {
          "type": "string",
          "enum": [
            "top_bottom",
            "side_by_side"
          ],
          "description": "Present only on an MP4 that carries its transparency in the frame (wandura-background-remove-v1): top_bottom = the picture on top, its alpha (grey) under it; side_by_side = the alpha on the right. The picture is premultiplied: over a background, colour + background x (1 - alpha)."
        }
      }
    },
    "JobNote": {
      "type": "object",
      "required": [
        "code",
        "message"
      ],
      "properties": {
        "code": {
          "type": "string",
          "enum": [
            "photos_reordered",
            "photos_same_gender",
            "music_track",
            "demo"
          ],
          "description": "photos_reordered: the photos came the other way round for their roles and were swapped before the video was made (the result is right). photos_same_gender: both photos show the same gender, so one person plays a role written for the other. music_track (rolling out, wandura-video-edit-v1): a sound step's music {mood, query} used this track of Wandura's music library (its title, id and licence; CC0: free to use, no credit needed). demo (rolling out, a Jobs API video tool sent with demo: true): the job made a demo (its seconds), or one frame of it with demo_frame, and says which and of what; the same job without demo makes the whole video. New codes may be added."
        },
        "message": {
          "type": "string",
          "description": "For people."
        }
      }
    },
    "Status": {
      "type": "string",
      "enum": [
        "queued",
        "processing",
        "succeeded",
        "failed",
        "cancelled",
        "timeout"
      ],
      "description": "queued -> processing -> succeeded | failed | cancelled | timeout. The last four are final and never change."
    }
  }
}