# Get Correlation Results

## Get Correlation Results

> Retrieve results of the correlation of our event data with your transactional demand data.

```json
{"openapi":"3.1.0","info":{"title":"PredictHQ Beam API","version":"1.0.0"},"tags":[{"name":"Analyses"}],"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":{"OffsetParam":{"name":"offset","in":"query","description":"Offset the results.","required":false,"schema":{"type":"integer","default":0}},"LimitParam":{"name":"limit","in":"query","description":"Limit the number of results.","required":false,"schema":{"type":"integer","default":10}}},"schemas":{"MultiDerivativeResponse":{"description":"Please note we have deprecated some fields in this endpoint. The deprecated fields are not intended \nto be used to get current feature values for use in forecasting or other use-cases. They're a snapshot of \nsome of the data from the time the correlation process was run, so for any other purposes are immediately \nout-of-date. Please fetch the latest data from Features API instead.","type":"object","properties":{"model_version":{"type":"string","title":"Model Version"},"version":{"type":"integer","title":"Version"},"count":{"type":"integer","title":"Count"},"dates":{"type":"array","items":{"$ref":"#/components/schemas/DemandDerivativeResponse"},"title":"Dates"}},"required":["model_version","version","count","dates"],"title":"MultiDerivativeResponse"},"DemandDerivativeResponse":{"type":"object","properties":{"date":{"description":"The date of the Beam decomposition.","type":"string","title":"Date"},"baseline_demand":{"description":"The expected demand for a given date.","type":"number","title":"Baseline Demand"},"remainder":{"description":"The difference between the actual_demand and the baseline_demand for a given date. This value may be positive or\nnegative.","type":"number","title":"Remainder"},"actual_demand":{"description":"The actual demand for a given date.","type":"number","title":"Actual Demand"},"impact_significance":{"description":"Enum specifying how unusual the remainder is for a given date.","type":"string","enum":["NO_IMPACT","WEAK","MEDIUM","SIGNIFICANT"],"title":"Impact Significance"},"impact_significance_score":{"description":"Number specifying how unusual the remainder is for a given date. This value maps to impact_significance.","type":"integer","enum":[0,1,2,3],"title":"Impact Significance Score"},"features":{"description":"A json object containing all non-zero features for a given date.","type":"object","additionalProperties":true,"deprecated":true,"title":"Features"},"phq_impact_sum":{"description":"The sum of all phq_impact features for a given date.","type":"integer","deprecated":true,"title":"Phq Impact Sum"},"phq_spend_sum":{"description":"The sum of all phq_spend features for a given date.","type":"integer","deprecated":true,"title":"Phq Spend Sum"},"phq_attendance_sum":{"description":"The sum of all phq_attendance features for a given date.","type":"integer","deprecated":true,"title":"Phq Attendance Sum"},"phq_rank_count":{"description":"The sum of all phq_rank features for a given date.","type":"integer","deprecated":true,"title":"Phq Rank Count"}},"required":["date","impact_significance"],"title":"DemandDerivativeResponse"},"ValidationError":{"type":"object","properties":{"field":{"type":"array","items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"}},"required":["field","msg","type"],"title":"ValidationError"},"HTTPError":{"type":"object","properties":{"error":{"type":"string","title":"Error"}},"required":["error"],"title":"HTTPError"}}},"paths":{"/v1/beam/analyses/{analysis_id}/correlate":{"get":{"operationId":"correlate_public_analyses__analysis_id__correlate_get","summary":"Get Correlation Results","description":"Retrieve results of the correlation of our event data with your transactional demand data.","parameters":[{"name":"analysis_id","in":"path","description":"An existing Beam Analysis ID.","required":true,"schema":{"type":"string"}},{"name":"date.gt","in":"query","description":"Filters results after the specified date (exclusive).","required":false,"schema":{"type":"string","format":"date"}},{"name":"date.gte","in":"query","description":"Filters results on or after the specified date.","required":false,"schema":{"type":"string","format":"date"}},{"name":"date.lt","in":"query","description":"Filters results before the specified date (exclusive).","required":false,"schema":{"type":"string","format":"date"}},{"name":"date.lte","in":"query","description":"Filters results on or before the specified date.","required":false,"schema":{"type":"string","format":"date"}},{"$ref":"#/components/parameters/OffsetParam"},{"$ref":"#/components/parameters/LimitParam"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MultiDerivativeResponse"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/ValidationError"},{"$ref":"#/components/schemas/HTTPError"}]}}}},"403":{"description":"Bearer token scope insufficient"},"404":{"description":"Analysis or Derivative not found"},"500":{"description":"Internal inconsistency detected. Please refresh the analysis"}},"tags":["Analyses"]}}}}
```

## Examples

{% tabs %}
{% tab title="curl" %}

```bash
curl -X GET "https://api.predicthq.com/v1/beam/analyses/$ANALYSIS_ID/correlate?date.gte=2022-01-01&date.lte=2022-12-31" \
     -H "Accept: application/json" \
     -H "Authorization: Bearer $ACCESS_TOKEN"
```

{% endtab %}

{% tab title="python" %}

```python
import requests

response = requests.get(
    url="https://api.predicthq.com/v1/beam/analyses/$ANALYSIS_ID/correlate",
    headers={
      "Authorization": "Bearer $ACCESS_TOKEN",
      "Accept": "application/json"
    },
    params={
        "date.gte": "2022-01-01",
        "date.lte": "2022-12-31"
    }
)

print(response.json())
```

{% endtab %}
{% endtabs %}

## OpenAPI Spec

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

## Guides

Below are some guides relevant to this API:

* [Beam Guides](https://app.gitbook.com/s/tNhzHETmXsrWeVBndqqJ/getting-started/guides/beam-guides)
