Skip to main content
POST
/
data-shops
/
subscriptions
/
{subscription_id}
/
cancel
Cancel a subscription
curl --request POST \
  --url https://api-dev.narrative.io/data-shops/subscriptions/{subscription_id}/cancel \
  --header 'Authorization: Bearer <token>'
{
  "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "budget": {
    "amount": {
      "currency": "USD",
      "value": 123
    },
    "period": {
      "type": "calendar_daily"
    }
  },
  "company_id": 123,
  "created_at": "<string>",
  "name": "<string>",
  "status": "active",
  "updated_at": "<string>",
  "cancelled_at": "<string>",
  "description": "<string>",
  "details": {
    "type": "data_stream",
    "data_rules": {
      "column_sets": [
        {
          "dataset_id": 123,
          "fields": [
            {
              "field": "/id/value",
              "exported": true,
              "filter": "include_all_values_including_nulls_filter"
            }
          ]
        }
      ],
      "attributes": [
        {
          "attribute_id": 123,
          "fields": [
            {
              "field": "/id/value",
              "exported": true,
              "filter": "include_all_values_including_nulls_filter"
            }
          ],
          "optional": true
        }
      ],
      "deduplication": {
        "period": "<string>",
        "column_references": [
          {
            "dataset_id": 123,
            "column_names": [
              "/id/value"
            ]
          }
        ],
        "attribute_references": [
          {
            "attribute_id": 123,
            "column_names": [
              "/id/value"
            ]
          }
        ]
      },
      "frequency_filter": {
        "column_references": [
          {
            "dataset_id": 123,
            "column_names": [
              "/id/value"
            ]
          }
        ],
        "attribute_references": [
          {
            "attribute_id": 123,
            "column_names": [
              "/id/value"
            ]
          }
        ],
        "min_inclusive": 123,
        "max_inclusive": 123
      },
      "dataset_filter": {
        "dataset_id": 123,
        "attribute": {
          "attribute_id": 123,
          "field": "/id/value"
        },
        "inclusion": "include"
      }
    },
    "data_shop_id": "<string>",
    "data_stream_company_id": 123,
    "data_stream_content": {
      "description": "<string>",
      "icon": "<string>",
      "sections": [
        {}
      ]
    },
    "data_stream_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
    "data_stream_name": "<string>",
    "data_stream_slug": "<string>",
    "offer": {
      "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
      "channel": "data_streams_market",
      "licensing": {
        "period": "<string>",
        "license": {
          "name": "<string>"
        }
      },
      "pricing": {
        "type": "per_record",
        "micro_cents_usd": 123
      },
      "shops": [
        "<string>"
      ]
    }
  },
  "output": {
    "dataset_id": 123
  },
  "cadence": "once"
}

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

id
string<UUID>
required

Unique identifier for the subscription.

budget
object
required

The maximum amount that can be spent as part of a subscription in a given time period. Once the budget has been exhausted in a given time period no more data is transacted until the start of the next one.

E.g. with a budget of $100 USD and a period of calendar_monthly you're guaranteed that you will not be charged more than $100 for your subscription in a given month.

company_id
integer
required

Unique identifier for the company to which the subscription belongs.

created_at
string
required

ISO-8601 timestamp indicating when the subscription rule was created.

name
string
required

A human-friendly name for the subscription.

status
enum<string>
required

The current state of the subscription.

  • active: the subscription is active, data is being purchased regularly.
  • cancelled: the subscription has been cancelled, but not deleted.
  • pending: the subscription has been created but is not yet active, not data is being purchased as part of the subscription.
  • kickoff: the subscription is kicking off (immediate run) prior to activation.
  • completed: the subscription as run once as requested and is completed.
Available options:
active,
cancelled,
pending,
archived,
kickoff,
completed
updated_at
string
required

ISO-8601 timestamp indicating when the subscription rule was created.

cancelled_at
string

ISO-8601 timestamp indicating when the subscription was cancelled.

description
string

A human-friendly description of the subscription.

details
object
output
object
cadence
enum<string>

The cadence at which the subscription will be executed.

  • once: the subscription will run only once.
  • hourly: the subscription run every hour.
  • daily: the subscription run once per day.
  • weekly: the subscription run once per week.
  • monthly: the subscription run once per month.
Available options:
once,
hourly,
daily,
weekly,
monthly