Skip to main content
POST
/
data-shops
/
subscriptions
/
{subscription_id}
/
cost-forecasts
Create a cost forecast for a subscription
curl --request POST \
  --url https://api-dev.narrative.io/data-shops/subscriptions/{subscription_id}/cost-forecasts \
  --header 'Authorization: Bearer <token>'
{
  "id": "9cdd4b69-82cb-4454-aedf-197bc3930b44",
  "company_id": 1,
  "cost": {
    "rows": 26565354859246,
    "size": 1299135691639572,
    "sources": [
      {
        "source": {
          "type": "dataset",
          "dataset_id": 192
        },
        "rows": 26565354859246,
        "size": 1299135691639572
      }
    ]
  },
  "created_at": "2021-11-26T20:20:13.909581Z",
  "details": {
    "type": "marketplace",
    "company_constraint": {
      "type": "exclusion",
      "company_ids": [
        56
      ]
    },
    "data_rules": {
      "attributes": [
        {
          "attribute_id": 2,
          "fields": [
            {
              "field": "event_timestamp",
              "filter": {
                "recency": "P30D"
              },
              "exported": true
            }
          ],
          "optional": false
        },
        {
          "attribute_id": 1,
          "fields": [
            {
              "field": "unique_id.type",
              "filter": {
                "type": "include",
                "list": [
                  "idfa",
                  "adid"
                ]
              },
              "exported": true
            },
            {
              "field": "unique_id.value",
              "filter": "include_only_if_not_null_filter",
              "exported": true
            }
          ],
          "optional": false
        },
        {
          "attribute_id": 11,
          "fields": [
            {
              "field": "ip_address",
              "filter": "include_only_if_not_null_filter",
              "exported": true
            }
          ],
          "optional": false
        }
      ],
      "frequency_filter": {
        "attribute_references": [
          {
            "attribute_id": 1,
            "column_names": [
              "unique_id.type",
              "unique_id.value"
            ]
          }
        ],
        "min_inclusive": 2
      }
    },
    "pricing": {
      "micro_cents_usd": 10000000
    }
  },
  "request_source": {
    "type": "api_user",
    "company_id": 1,
    "user_id": 1
  },
  "subscription_id": null
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Path Parameters

subscription_id
string<uuid>
required

Unique identifier for a subscription.

Response

200 - application/json

OK

company_id
integer
required

Unique identifier for the company to which the cost forecast belongs.

created_at
string
required

ISO-8601 timestamp indicating when the cost forecast was created

details
object
required

The set of constraints to which the cost forecast applies.

id
string<UUID>

Unique identifier for the cost forecast. Empty if no cost forecast was created due to the subscriptions constraints resulting in no matches.

cost
object

An estimate of the "cost" of servicing a set of subscription constraints.

Cost has two components:

  • The number of rows which must be read in order to find data which matches the subscription constraints.
  • An estimate of the "size" of those rows in bytes.

Note: the number of rows reported in the cost is not an estimate of the number of rows which will be purchased as part of a subscription using the given constraints.

subscription_id
string<UUID>

Unique identifier of the subscription for which the cost forecast was created. Empty if the cost forecast is not associated with a subscription.