{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/bigdata/json-schema/bigdata-latest-surprise-response-schema.json",
  "title": "LatestSurpriseResponse",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/bigdata-analyst-estimates-api-openapi.yml#/components/schemas/LatestSurpriseResponse",
  "properties": {
    "results": {
      "items": {
        "$ref": "#/$defs/LatestSurprise"
      },
      "type": "array",
      "title": "Results"
    },
    "errors": {
      "anyOf": [
        {
          "items": {
            "$ref": "#/$defs/ErrorDetail"
          },
          "type": "array"
        },
        {
          "type": "null"
        }
      ],
      "title": "Errors"
    },
    "metadata": {
      "anyOf": [
        {
          "$ref": "#/$defs/Metadata"
        },
        {
          "type": "null"
        }
      ]
    },
    "sources": {
      "items": {
        "$ref": "#/$defs/Source"
      },
      "type": "array",
      "title": "Sources",
      "description": "The content catalog sources the response was built from, one entry per source. Empty when no catalog source contributed."
    },
    "usage": {
      "anyOf": [
        {
          "$ref": "#/$defs/Usage"
        },
        {
          "type": "null"
        }
      ],
      "description": "Tokens the request consumed, per content tier. Present only for API keys billed in tokens."
    }
  },
  "type": "object",
  "required": [
    "results"
  ],
  "$defs": {
    "ErrorDetail": {
      "properties": {
        "message": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Message"
        }
      },
      "type": "object",
      "title": "ErrorDetail"
    },
    "LatestSurprise": {
      "properties": {
        "rp_entity_id": {
          "type": "string",
          "title": "Rp Entity Id",
          "description": "RavenPack internal entity identifier."
        },
        "target_identifier_id": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Target Identifier Id",
          "description": "The target identifier provided in the request, e.g., stock symbol."
        },
        "reporting_date": {
          "anyOf": [
            {
              "type": "string",
              "format": "date-time"
            },
            {
              "type": "null"
            }
          ],
          "title": "Reporting Date",
          "description": "The end date of the fiscal period."
        },
        "eps_actual": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "title": "Eps Actual",
          "description": "The actual EPS of the company."
        },
        "eps_estimated": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "title": "Eps Estimated",
          "description": "The estimated EPS of the company."
        },
        "revenue_actual": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "title": "Revenue Actual",
          "description": "The actual revenue of the company."
        },
        "revenue_estimated": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "title": "Revenue Estimated",
          "description": "The estimated revenue of the company."
        },
        "last_updated": {
          "anyOf": [
            {
              "type": "string",
              "format": "date-time"
            },
            {
              "type": "null"
            }
          ],
          "title": "Last Updated",
          "description": "The last updated date of the data."
        },
        "eps_surprise_pct": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "title": "Eps Surprise Pct",
          "description": "The surprise percentage of the EPS."
        },
        "revenue_surprise_pct": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "title": "Revenue Surprise Pct",
          "description": "The surprise percentage of the revenue."
        }
      },
      "type": "object",
      "required": [
        "rp_entity_id",
        "target_identifier_id"
      ],
      "title": "LatestSurprise"
    },
    "Metadata": {
      "properties": {
        "request_id": {
          "type": "string",
          "title": "Request Id"
        },
        "timestamp": {
          "type": "string",
          "title": "Timestamp"
        }
      },
      "type": "object",
      "required": [
        "request_id"
      ],
      "title": "Metadata"
    },
    "Source": {
      "properties": {
        "id": {
          "type": "string",
          "title": "Id",
          "description": "Content catalog identifier of the source."
        },
        "name": {
          "type": "string",
          "title": "Name",
          "description": "Catalog name of the dataset the data came from."
        }
      },
      "type": "object",
      "required": [
        "id",
        "name"
      ],
      "title": "Source",
      "description": "A content catalog source that contributed data to a structured-data response."
    },
    "Usage": {
      "additionalProperties": {
        "type": "integer"
      },
      "type": "object",
      "title": "Usage",
      "description": "Public structured-data usage for a request, aggregated per content tier.\n\nA flat object keyed per content tier, where each key is derived from the\ncontent tier identifier by dropping the ``content-`` prefix and appending\n``_tokens`` (e.g. ``corporate-fundamentals`` ->\n``corporate_fundamentals_tokens``). It is sparse: only tiers with non-zero\ntokens appear, and an absent key means zero tokens for that tier."
    }
  }
}