{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/dataville-com/json-schema/dataville-com-data-success-response-schema.json",
  "title": "DataSuccessResponse",
  "x-generated": "2026-11-05",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/dataville-com-openapi.yml#/components/schemas/DataSuccessResponse",
  "type": "object",
  "properties": {
    "status": {
      "type": "string",
      "enum": [
        "success"
      ]
    },
    "account_state": {
      "type": "string",
      "enum": [
        "authenticated",
        "anonymous"
      ]
    },
    "data": {
      "$ref": "#/$defs/DataSourceResult"
    },
    "usage": {
      "$ref": "#/$defs/Usage"
    }
  },
  "$defs": {
    "DataSourceResult": {
      "type": "object",
      "description": "The common shape every data source returns.",
      "properties": {
        "id": {
          "type": "string",
          "description": "Source-specific identifier."
        },
        "title": {
          "type": "string"
        },
        "body": {
          "type": "string",
          "description": "Human- and LLM-readable text: newline-delimited `Key: value` lines.\nStructured values live in `metadata`.\n"
        },
        "source": {
          "type": "string"
        },
        "language": {
          "type": "string"
        },
        "last_updated": {
          "type": "string",
          "format": "date-time"
        },
        "entities": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "metadata": {
          "type": "object",
          "additionalProperties": true,
          "description": "Structured, source-specific fields."
        },
        "stale": {
          "$ref": "#/$defs/StaleNotice"
        },
        "onboarding": {
          "type": "object",
          "description": "Present only on a new anonymous session's first response.",
          "properties": {
            "message": {
              "type": "string"
            }
          }
        }
      }
    },
    "StaleNotice": {
      "type": "object",
      "description": "Present when the upstream source was unavailable and the result came from\nDataville's stored copy instead. The answer is real but may be out of date.\n",
      "properties": {
        "message": {
          "type": "string"
        },
        "cached_at": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time"
        }
      }
    },
    "Usage": {
      "type": "object",
      "properties": {
        "requests_remaining": {
          "type": "integer"
        },
        "request_limit": {
          "type": "integer"
        },
        "credits_total": {
          "type": "number",
          "format": "float",
          "description": "Monthly credit grant in USD. Metered callers only."
        },
        "credits_remaining": {
          "type": "number",
          "format": "float"
        },
        "credits_used": {
          "type": "number",
          "format": "float"
        },
        "request_cost": {
          "type": "number",
          "format": "float",
          "description": "Credit charged for this request, in USD."
        }
      }
    }
  }
}