# Get Demand Data

## Get Demand Data

> Returns the demand data that has been uploaded to the model. Supports filtering by date range.\
> \
> By setting the \`Accept\` header, you can specify the format of the response. The default is JSON.\
> Supported formats: \`application/json\`, \`text/csv\`, \`application/x-ndjson\`.

```json
{"openapi":"3.1.0","info":{"title":"PredictHQ Forecasts API (Public Preview)","version":"1.0.0"},"tags":[{"name":"Demand Data"}],"servers":[{"url":"https://api.predicthq.com"}],"security":[{"BearerAuth":[]}],"components":{"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"$API_KEY","description":"Enter your PredictHQ API key. The Bearer prefix is added automatically.\n\nWhen calling the API directly, send: `Authorization: Bearer <YOUR_API_KEY>` as documented at [https://docs.predicthq.com/api/overview/authenticating](https://docs.predicthq.com/api/overview/authenticating)\n"}},"parameters":{"LimitParam":{"name":"limit","in":"query","description":"The maximum number of results to return per page. Defaults to `10`.","required":false,"schema":{"type":"integer","default":10}},"OffsetParam":{"name":"offset","in":"query","description":"The number of results to skip before returning. Used for pagination. Defaults to `0`.","required":false,"schema":{"type":"integer","default":0}}},"schemas":{"SearchDemandResponse":{"type":"object","properties":{"errors":{"description":"List of error messages, if any.","type":"array","items":{"type":"string"},"default":[],"title":"Errors"},"warnings":{"description":"List of warning messages, if any.","type":"array","items":{"type":"string"},"default":[],"title":"Warnings"},"count":{"description":"Total number of results matching the query.","type":"integer","title":"Count"},"next":{"description":"URL for the next page of results. Null if no more results.","anyOf":[{"type":"string"},{"type":"null"}],"title":"Next"},"previous":{"description":"URL for the previous page of results. Null if on the first page.","anyOf":[{"type":"string"},{"type":"null"}],"title":"Previous"},"results":{"description":"Array of demand data results for the current page.","type":"array","items":{"$ref":"#/components/schemas/PublicDemand"},"title":"Results"}},"required":["count"],"title":"SearchDemandResponse"},"PublicDemand":{"type":"object","properties":{"date":{"description":"The date of the demand data point.","type":"string","format":"date","title":"Date"},"demand":{"description":"The demand value for the date.","type":"number","minimum":0,"title":"Demand"}},"required":["date","demand"],"title":"PublicDemand"},"HTTPValidationError":{"type":"object","properties":{"error":{"description":"Error summary message","type":"string","title":"Error"},"details":{"description":"List of validation error details","type":"array","items":{"$ref":"#/components/schemas/ValidationErrorDetail"},"title":"Details"}},"required":["error","details"],"title":"HTTPValidationError"},"ValidationErrorDetail":{"type":"object","properties":{"field":{"description":"The field that failed validation","type":"string","title":"Field"},"msg":{"description":"The validation error message","type":"string","title":"Message"},"type":{"description":"The type of validation error","type":"string","title":"Error Type"}},"required":["field","msg","type"],"title":"ValidationErrorDetail"},"QueryValidationError":{"type":"object","properties":{"error":{"description":"List of query parameter validation errors","type":"array","items":{"$ref":"#/components/schemas/ValidationErrorDetail"},"title":"Error"}},"required":["error"],"title":"QueryValidationError"},"ErrorResponse":{"type":"object","properties":{"error":{"description":"Error message","type":"string","title":"Error"}},"required":["error"],"title":"ErrorResponse"}}},"paths":{"/v1/forecasts/models/{model_id}/demand":{"get":{"operationId":"list_demand_data","summary":"Get Demand Data","description":"Returns the demand data that has been uploaded to the model. Supports filtering by date range.\n\nBy setting the `Accept` header, you can specify the format of the response. The default is JSON.\nSupported formats: `application/json`, `text/csv`, `application/x-ndjson`.","parameters":[{"name":"model_id","in":"path","description":"The unique identifier of the forecast model.","required":true,"schema":{"type":"string","title":"Model Id"}},{"name":"date.gt","in":"query","description":"Filters demand after the specified date (exclusive).\n\n\nExpected format: `YYYY-MM-DD`","required":false,"schema":{"type":"string","format":"date"}},{"name":"date.gte","in":"query","description":"Filters demand on or after the specified date.\n\n\nExpected format: `YYYY-MM-DD`.\n\n\nExample: `2025-01-01`","required":false,"schema":{"type":"string","format":"date"}},{"name":"date.lt","in":"query","description":"Filters demand before the specified date (exclusive).\n\n\nExpected format: `YYYY-MM-DD`.","required":false,"schema":{"type":"string","format":"date"}},{"name":"date.lte","in":"query","description":"Filters demand on or before the specified date.\n\n\nExpected format: `YYYY-MM-DD`.\n\n\nExample: `2025-01-07`","required":false,"schema":{"type":"string","format":"date"}},{"$ref":"#/components/parameters/LimitParam"},{"$ref":"#/components/parameters/OffsetParam"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SearchDemandResponse"}},"application/x-ndjson":{"schema":{"type":"string"}},"text/csv":{"schema":{"type":"string"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"oneOf":[{"$ref":"#/components/schemas/HTTPValidationError"},{"$ref":"#/components/schemas/QueryValidationError"}]}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"402":{"description":"Payment Required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"tags":["Demand Data"]}}}}
```

## OpenAPI Spec

The OpenAPI spec for Forecasts API can be [found here](https://api.predicthq.com/docs/?urls.primaryName=Forecasts+API).

## Guides

* [Getting Started with Forecasts API](https://docs.predicthq.com/getting-started/guides/forecasts-api-guides/getting-started)
* [Understanding Forecast Accuracy Metrics](https://docs.predicthq.com/getting-started/guides/forecasts-api-guides/understanding-forecast-accuracy-metrics)
* [Troubleshooting Guide for Forecasts API](https://docs.predicthq.com/getting-started/guides/forecasts-api-guides/troubleshooting)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.predicthq.com/api/forecasts/demand-data/get-demand-data.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
