{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/mindcase-co/json-schema/mindcase-co-job-list-response-schema.json",
  "title": "JobListResponse",
  "x-generated": "2026-11-22",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/mindcase-co-openapi.json#/components/schemas/JobListResponse",
  "properties": {
    "jobs": {
      "items": {
        "$ref": "#/$defs/JobResponse"
      },
      "type": "array",
      "title": "Jobs"
    },
    "next_cursor": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Next Cursor"
    }
  },
  "additionalProperties": true,
  "type": "object",
  "required": [
    "jobs"
  ],
  "$defs": {
    "JobResponse": {
      "properties": {
        "id": {
          "type": "string",
          "title": "Id"
        },
        "agent": {
          "type": "string",
          "title": "Agent"
        },
        "status": {
          "type": "string",
          "enum": [
            "queued",
            "running",
            "completed",
            "failed",
            "cancelled",
            "rejected_balance"
          ],
          "title": "Status"
        },
        "row_count": {
          "type": "integer",
          "title": "Row Count"
        },
        "usd_used": {
          "type": "number",
          "title": "Usd Used"
        },
        "error": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Error",
          "description": "A sentence to show the user. Always a string."
        },
        "notice": {
          "anyOf": [
            {
              "additionalProperties": true,
              "type": "object"
            },
            {
              "type": "null"
            }
          ],
          "title": "Notice"
        },
        "error_code": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Error Code",
          "description": "Stable code. On `failed` and `rejected_balance` jobs."
        },
        "retryable": {
          "anyOf": [
            {
              "type": "boolean"
            },
            {
              "type": "null"
            }
          ],
          "title": "Retryable",
          "description": "Finished jobs only. Whether running the same request again can work. Always false once rows were delivered, since a retry buys them again."
        },
        "retry_after_seconds": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "title": "Retry After Seconds",
          "description": "When `retryable` is true, how long to wait first."
        },
        "charged": {
          "anyOf": [
            {
              "type": "boolean"
            },
            {
              "type": "null"
            }
          ],
          "title": "Charged",
          "description": "Finished jobs only. Whether money left the wallet. `null` while `billing_status` is `settling`."
        },
        "usd_charged": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "title": "Usd Charged",
          "description": "Finished jobs only. What this run actually cost. `null` while `billing_status` is `settling`."
        },
        "billing_status": {
          "anyOf": [
            {
              "type": "string",
              "enum": [
                "settled",
                "settling"
              ]
            },
            {
              "type": "null"
            }
          ],
          "title": "Billing Status",
          "description": "Finished jobs only. `settling` means the charge has not landed yet; fetch the job again shortly."
        },
        "fault": {
          "anyOf": [
            {
              "type": "string",
              "enum": [
                "input",
                "mindcase"
              ]
            },
            {
              "type": "null"
            }
          ],
          "title": "Fault",
          "description": "When something went wrong, whose problem it was: `input` (the request; fix it first) or `mindcase` (ours)."
        },
        "stop_reason": {
          "anyOf": [
            {
              "type": "string",
              "enum": [
                "completed",
                "no_results",
                "row_limit_reached",
                "balance_exhausted",
                "time_limit",
                "collection_failed",
                "budget_guard",
                "interrupted",
                "internal_error",
                "invalid_input",
                "cancelled",
                "insufficient_balance"
              ]
            },
            {
              "type": "null"
            }
          ],
          "title": "Stop Reason",
          "description": "Finished jobs only. Why the run ended. `completed`: Finished. Everything you asked for was delivered. `no_results`: Finished, with no results for this request. `row_limit_reached`: Stopped at the row limit for this run. `balance_exhausted`: Your balance reached $0. Add balance, then run it again for the rest. `time_limit`: Stopped at the time limit. Run it again, with a narrower input if you can. `collection_failed`: We couldn't collect this data right now. Try again later. `budget_guard`: Stopped to protect you from runaway cost. Narrow the search and run it again. `interrupted`: Our system was interrupted during this run. Run it again. `internal_error`: Something failed on our side, not in your request. Try again. `invalid_input`: Some of your input could not be used. Fix it and run it again. `cancelled`: This run was stopped before it finished. `insufficient_balance`: Your balance was too low to start this run. Add balance, then run it again."
        },
        "stop_message": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Stop Message",
          "description": "Finished jobs only. Plain-English version of `stop_reason`. May be reworded."
        }
      },
      "additionalProperties": true,
      "type": "object",
      "required": [
        "id",
        "agent",
        "status",
        "row_count",
        "usd_used"
      ],
      "title": "JobResponse",
      "description": "A job. `error` is always a sentence; the fields beside it are the machine-readable facts about how the run ended.\n\n| `stop_reason` | Meaning | Retry? | Charged for |\n|---|---|---|---|\n| `completed` | Finished. Everything you asked for was delivered. | no | Delivered rows |\n| `no_results` | Finished, with no results for this request. | no | Nothing, except a flat search fee |\n| `row_limit_reached` | Stopped at the row limit for this run. | no | Delivered rows |\n| `balance_exhausted` | Your balance reached $0. Add balance, then run it again for the rest. | no, add balance | Delivered rows |\n| `time_limit` | Stopped at the time limit. Run it again, with a narrower input if you can. | yes if no rows | Delivered rows |\n| `collection_failed` | We couldn't collect this data right now. Try again later. | yes if no rows | Delivered rows |\n| `budget_guard` | Stopped to protect you from runaway cost. Narrow the search and run it again. | no, narrow it | Delivered rows |\n| `interrupted` | Our system was interrupted during this run. Run it again. | yes if no rows | Delivered rows |\n| `internal_error` | Something failed on our side, not in your request. Try again. | yes if no rows | Delivered rows |\n| `invalid_input` | Some of your input could not be used. Fix it and run it again. | no, fix it | Delivered rows |\n| `cancelled` | This run was stopped before it finished. | no | Delivered rows |\n| `insufficient_balance` | Your balance was too low to start this run. Add balance, then run it again. | no, add balance | Nothing |"
    }
  }
}