Model Output API

Configure input parameters and get the output of a model by URL.

If you're a paid subscriber to Summit, the models you build in Summit can be executed from anywhere using a simple web address (URL), and the output can be retrieved in a variety of formats.

To call a model by URL, you need to either use an API key, or make the model public. Let's look at both setup options.

Setup A: Using an API key

Your API key can be found on your organization page. Copy the key and keep it in a safe place; as a developer, this is typically done by storing the key in an environment variable.

In your code, you'll need to pass this key into a token header, like so:

Token YOUR_KEY_HERE

Requests made with this header will authenticate with Summit and allow access to the model through the model output endpoint (see below).

Setup B: Making the model public

If you'd like to call a model by URL without having to use an API key, you can make the model public. This is done by clicking "Publish as template" link in the header when viewing a model in the Summit editor. Once this link is clicked, the model will be marked as public.

If a model is public, you can visit the model output endpoint (see below) without setting a token header.

Calling the output API

You can execute a model by appending the model ID to the simulator/run endpoint. For example, if the model ID is abcdef-123456-fedcba-654321, you would request model output at:

https://app.usesummit.com/api/v1/simulator/run/abcdef-123456-fedcba-654321

By default, this will return a response in JSON format. If you'd like to receive results as CSV file or a XLSX spreadsheet, you can pass in a f= query string argument, like so:

https://app.usesummit.com/api/v1/simulator/run/abcdef-123456-fedcba-654321?f=csv
https://app.usesummit.com/api/v1/simulator/run/abcdef-123456-fedcba-654321?f=xlsx

πŸ“˜

What's my model ID?

The model ID to use in the API request is the model ID visible in the URL when editing the model. So for example, if the web address of the model is https://app.usesummit.com/e/models/abcdef-123456-fedcba-654321, the model ID is abcdef-123456-fedcba-654321.

Arguments by Query String

While it's useful to be able to fetch the output of a model, even better is being able to call a model with different assumptions, or values, inserted into the events of your model.

Unit types allow you to tag input parameters that can be used in the query string of the simulator/run endpoint. For example, if your model contains an event with the expression: =Pool(100k<cash_balance>), you could modify this 100k value to 200k by calling the model output endpoint like so:

https://app.usesummit.com/api/v1/simulator/run/abcdef-123456-fedcba-654321?cash_balance=200k

This will return a JSON response containing the output of the model wherein the the initial value of the Pool event was set to 200,000.

These calls do not modify the expressions in the original model.

The Output

Here's an example response:

{
    "run_id": "b015508d-e3cd-46cd-9a6f-2a326a38f0b4",
    "runtime_ms": 130.0,
    "cache_hit": false,
    "output": [
        {
            "event": "Signups",
            "date": "2021-12-31T23:59:59",
            "timestamp": 1640995199,
            "value": 100
        },
        {
            "event": "Signups",
            "date": "2022-01-31T23:59:59",
            "timestamp": 1643673599,
            "value": 100
        },
        {
            "event": "Signups",
            "date": "2022-02-28T23:59:59",
            "timestamp": 1646092799,
            "value": 100
        },
        {
            "event": "Signups",
            "date": "2022-03-31T23:59:59",
            "timestamp": 1648771199,
            "value": 100
        },
        {
            "event": "Signups",
            "date": "2022-04-30T23:59:59",
            "timestamp": 1651363199,
            "value": 100
        },
        {
            "event": "Signups",
            "date": "2022-05-31T23:59:59",
            "timestamp": 1654041599,
            "value": 100
        },
        {
            "event": "Signups",
            "date": "2022-06-30T23:59:59",
            "timestamp": 1656633599,
            "value": 100
        },
        {
            "event": "Signups",
            "date": "2022-07-31T23:59:59",
            "timestamp": 1659311999,
            "value": 100
        },
        {
            "event": "Signups",
            "date": "2022-08-31T23:59:59",
            "timestamp": 1661990399,
            "value": 100
        },
        {
            "event": "Signups",
            "date": "2022-09-30T23:59:59",
            "timestamp": 1664582399,
            "value": 100
        },
        {
            "event": "Signups",
            "date": "2022-10-31T23:59:59",
            "timestamp": 1667260799,
            "value": 100
        },
        {
            "event": "Signups",
            "date": "2022-11-30T23:59:59",
            "timestamp": 1669852799,
            "value": 100
        },
        {
            "event": "Signups",
            "date": "2022-12-31T23:59:59",
            "timestamp": 1672531199,
            "value": 100
        },
        {
            "event": "MRR",
            "date": "2021-12-31T23:59:59",
            "timestamp": 1640995199,
            "value": 2680
        },
        {
            "event": "MRR",
            "date": "2022-01-31T23:59:59",
            "timestamp": 1643673599,
            "value": 3832
        },
        {
            "event": "MRR",
            "date": "2022-02-28T23:59:59",
            "timestamp": 1646092799,
            "value": 4904
        },
        {
            "event": "MRR",
            "date": "2022-03-31T23:59:59",
            "timestamp": 1648771199,
            "value": 5901
        },
        {
            "event": "MRR",
            "date": "2022-04-30T23:59:59",
            "timestamp": 1651363199,
            "value": 6828
        },
        {
            "event": "MRR",
            "date": "2022-05-31T23:59:59",
            "timestamp": 1654041599,
            "value": 7690
        },
        {
            "event": "MRR",
            "date": "2022-06-30T23:59:59",
            "timestamp": 1656633599,
            "value": 8492
        },
        {
            "event": "MRR",
            "date": "2022-07-31T23:59:59",
            "timestamp": 1659311999,
            "value": 9237
        },
        {
            "event": "MRR",
            "date": "2022-08-31T23:59:59",
            "timestamp": 1661990399,
            "value": 9931
        },
        {
            "event": "MRR",
            "date": "2022-09-30T23:59:59",
            "timestamp": 1664582399,
            "value": 10575
        },
        {
            "event": "MRR",
            "date": "2022-10-31T23:59:59",
            "timestamp": 1667260799,
            "value": 11175
        },
        {
            "event": "MRR",
            "date": "2022-11-30T23:59:59",
            "timestamp": 1669852799,
            "value": 11733
        },
        {
            "event": "MRR",
            "date": "2022-12-31T23:59:59",
            "timestamp": 1672531199,
            "value": 12252
        },
        {
            "event": "Customers",
            "date": "2021-12-31T23:59:59",
            "timestamp": 1640995199,
            "value": 20
        },
        {
            "event": "Customers",
            "date": "2022-01-31T23:59:59",
            "timestamp": 1643673599,
            "value": 29
        },
        {
            "event": "Customers",
            "date": "2022-02-28T23:59:59",
            "timestamp": 1646092799,
            "value": 37
        },
        {
            "event": "Customers",
            "date": "2022-03-31T23:59:59",
            "timestamp": 1648771199,
            "value": 44
        },
        {
            "event": "Customers",
            "date": "2022-04-30T23:59:59",
            "timestamp": 1651363199,
            "value": 51
        },
        {
            "event": "Customers",
            "date": "2022-05-31T23:59:59",
            "timestamp": 1654041599,
            "value": 57
        },
        {
            "event": "Customers",
            "date": "2022-06-30T23:59:59",
            "timestamp": 1656633599,
            "value": 63
        },
        {
            "event": "Customers",
            "date": "2022-07-31T23:59:59",
            "timestamp": 1659311999,
            "value": 69
        },
        {
            "event": "Customers",
            "date": "2022-08-31T23:59:59",
            "timestamp": 1661990399,
            "value": 74
        },
        {
            "event": "Customers",
            "date": "2022-09-30T23:59:59",
            "timestamp": 1664582399,
            "value": 79
        },
        {
            "event": "Customers",
            "date": "2022-10-31T23:59:59",
            "timestamp": 1667260799,
            "value": 83
        },
        {
            "event": "Customers",
            "date": "2022-11-30T23:59:59",
            "timestamp": 1669852799,
            "value": 88
        },
        {
            "event": "Customers",
            "date": "2022-12-31T23:59:59",
            "timestamp": 1672531199,
            "value": 91
        }
    ]
}

πŸ“˜

Times & Timestamps TZ's

The date and timestamp are based on the UTC time zone.