Skip to main content
POST
/
data-stream
Create a data-stream.
curl --request POST \
  --url https://api-dev.narrative.io/data-stream \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "name": "Greg Test Datastream",
  "slug": "greg-test-1",
  "content": {
    "description": "Greg created this datastream to test changes for attributes and is not going to upload any data for it.",
    "icon": null,
    "sections": []
  },
  "tags": [
    "Testing",
    "greg",
    "data",
    "datastream",
    "test"
  ],
  "category": "Test",
  "offers": [
    {
      "id": "0488d937-b716-4df2-841c-8a63026c268d",
      "channel": "data_streams_market",
      "licensing": {
        "period": "P30D",
        "license": {
          "name": "Narrative Marketplace Data Purchase Agreement"
        }
      },
      "pricing": {
        "type": "per_record",
        "micro_cents_usd": 500000
      },
      "shops": null
    },
    {
      "id": "2ff93ef0-eb92-44ae-965e-dafbb6725fb9",
      "channel": "data_shop",
      "licensing": {
        "period": "P30D",
        "license": {
          "name": "https://app.narrative.io/legal/data-purchase-agreement"
        }
      },
      "pricing": {
        "type": "per_record",
        "micro_cents_usd": 100000
      },
      "shops": [
        "fanaticsdatashop.com"
      ]
    }
  ],
  "data_rules": {
    "column_sets": [
      {
        "dataset_id": 91,
        "fields": [
          {
            "field": "id",
            "filter": null,
            "exported": true
          },
          {
            "field": "audience",
            "filter": null,
            "exported": true
          }
        ]
      }
    ],
    "attributes": null,
    "deduplication": null,
    "frequency_filter": null
  },
  "auth_rules": null
}
'
{
  "id": "f94e8803-fc03-4c3e-a3fc-c3ffe3993788",
  "company_id": 100,
  "name": "best data stream name",
  "slug": "this-is-a-slug",
  "content": {
    "description": "Fabulous Data Stream even better than anything out there!",
    "icon": "https://some.icon.png",
    "sections": [
      {
        "title": "some title",
        "description": "some description",
        "image": "some-image"
      },
      {
        "whatever": "whatever json structure FE would like to have here.",
        "free_form": "json here"
      }
    ]
  },
  "tags": [
    "tag1",
    "tag2"
  ],
  "category": "categoryA",
  "offers": [
    {
      "id": "16310512-a8fb-4ce8-aec3-573693067df9",
      "channel": "data_streams_market",
      "licensing": {
        "period": "P90D",
        "license": {
          "name": "narrative opendata license"
        }
      },
      "pricing": {
        "type": "per_record",
        "micro_cents_usd": 70000
      },
      "shops": null
    },
    {
      "id": "d7542ec5-558f-4e98-9ff6-e049b24798fa",
      "channel": "data_shop",
      "licensing": {
        "period": "P90D",
        "license": {
          "name": "narrative opendata license"
        }
      },
      "pricing": {
        "type": "per_record",
        "micro_cents_usd": 50000
      },
      "shops": null
    },
    {
      "id": "5d52d8d8-b683-4ef4-9220-31347dc2237f",
      "channel": "data_shop",
      "licensing": {
        "period": "P90D",
        "license": {
          "name": "narrative opendata license"
        }
      },
      "pricing": {
        "type": "max_price_per_record",
        "micro_cents_usd": 30000
      },
      "shops": [
        "only.on.tld.com"
      ]
    }
  ],
  "data_rules": {
    "column_sets": [
      {
        "dataset_id": 99999,
        "fields": [
          {
            "field": "col1",
            "filter": null,
            "exported": true
          },
          {
            "field": "col2",
            "filter": "include_all_values_including_nulls_filter",
            "exported": true
          },
          {
            "field": "col3",
            "filter": "include_only_if_not_null_filter",
            "exported": true
          },
          {
            "field": "col4",
            "filter": {
              "type": "include",
              "list": [
                "this",
                "that",
                "that too",
                "some more"
              ]
            },
            "exported": true
          },
          {
            "field": "col5",
            "filter": {
              "type": "exclude",
              "list": [
                "this",
                "that",
                "that too",
                "some more"
              ]
            },
            "exported": true
          },
          {
            "field": "col6",
            "filter": {
              "min": {
                "type": "inclusive",
                "value": "-100"
              },
              "max": {
                "type": "inclusive",
                "value": "100"
              }
            },
            "exported": true
          },
          {
            "field": "col6",
            "filter": {
              "min": null,
              "max": {
                "type": "exclusive",
                "value": "timestamp01"
              }
            },
            "exported": false
          },
          {
            "field": "col7",
            "filter": {
              "type": "include",
              "list": [
                "true"
              ]
            },
            "exported": true
          },
          {
            "field": "col8",
            "filter": {
              "recency": "P30D",
              "from": null,
              "to": {
                "type": "exclusive",
                "value": "timestamp01"
              }
            },
            "exported": true
          }
        ]
      }
    ],
    "attributes": [
      {
        "attribute_id": 123,
        "fields": [
          {
            "field": "col1",
            "filter": null,
            "exported": true
          },
          {
            "field": "col2",
            "filter": "include_all_values_including_nulls_filter",
            "exported": true
          },
          {
            "field": "col3",
            "filter": "include_only_if_not_null_filter",
            "exported": true
          },
          {
            "field": "col4",
            "filter": {
              "type": "include",
              "list": [
                "this",
                "that",
                "that too",
                "some more"
              ]
            },
            "exported": true
          },
          {
            "field": "col5",
            "filter": {
              "type": "exclude",
              "list": [
                "this",
                "that",
                "that too",
                "some more"
              ]
            },
            "exported": true
          },
          {
            "field": "col6",
            "filter": {
              "min": {
                "type": "inclusive",
                "value": "-100"
              },
              "max": {
                "type": "inclusive",
                "value": "100"
              }
            },
            "exported": true
          },
          {
            "field": "col6",
            "filter": {
              "min": null,
              "max": {
                "type": "exclusive",
                "value": "timestamp01"
              }
            },
            "exported": false
          },
          {
            "field": "col7",
            "filter": {
              "type": "include",
              "list": [
                "true"
              ]
            },
            "exported": true
          },
          {
            "field": "col8",
            "filter": {
              "recency": "P30D",
              "from": null,
              "to": {
                "type": "exclusive",
                "value": "timestamp01"
              }
            },
            "exported": true
          },
          {
            "field": "col9",
            "filter": {
              "expressions": [
                "col9 > -90",
                "col9 < 90"
              ]
            },
            "exported": true
          }
        ],
        "optional": true
      },
      {
        "attribute_id": 321,
        "fields": [
          {
            "field": "col9",
            "filter": {
              "expressions": [
                "col9 > -90",
                "col9 < 90"
              ]
            },
            "exported": false
          }
        ],
        "optional": false
      }
    ],
    "deduplication": {
      "period": "P60D",
      "column_references": null,
      "attribute_references": [
        {
          "attribute_id": 123,
          "column_names": [
            "col9",
            "col9.foo.bar"
          ]
        }
      ]
    },
    "frequency_filter": {
      "column_references": null,
      "attribute_references": [
        {
          "attribute_id": 123,
          "column_names": [
            "col9.foo.bar"
          ]
        }
      ],
      "min_inclusive": 2,
      "max_inclusive": 5
    }
  },
  "auth_rules": {
    "company_constraint": {
      "type": "inclusion",
      "company_ids": [
        160,
        1701
      ]
    }
  },
  "created_by": 5000,
  "created_at": "2021-06-29T10:58:36.726Z",
  "updated_at": "2021-06-29T10:58:36.726Z",
  "datasets": null
}

Authorizations

Authorization
string
header
required

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

Body

application/json
name
string<trimmed-non-empty>
required

A name.

Minimum string length: 1
slug
string
required

The DataStream's slug. Used for SEO/URLs.

Minimum string length: 1
content
object
tags
string<trimmed-non-empty>[]

A tag. Useful for searching and cataloging

Minimum string length: 1
category
string<trimmed-non-empty>

The DataStream's category. Useful for searches and cataloging.

Minimum string length: 1
offers
object[]
data_rules
object

Data rules capture the rules around how the data is handled within a data stream. The starting point might be an already predefined and active dataset(s) or the global data attributes on the platform.

Data rules might apply further filtering on the data being ingested and exported through the stream.

auth_rules
object

Response

OK

id
string<uuid>
company_id
integer<int64>

The id of an existing company

Example:

345

name
string<trimmed-non-empty>

A name.

Minimum string length: 1
slug
string

The DataStream's slug. Used for SEO/URLs.

Minimum string length: 1
content
object
tags
string<trimmed-non-empty>[]

A tag. Useful for searching and cataloging

Minimum string length: 1
category
string<trimmed-non-empty>

The DataStream's category. Useful for searches and cataloging.

Minimum string length: 1
offers
object[]
data_rules
object

Data rules capture the rules around how the data is handled within a data stream. The starting point might be an already predefined and active dataset(s) or the global data attributes on the platform.

Data rules might apply further filtering on the data being ingested and exported through the stream.

auth_rules
object
created_by
integer<int64>

Unique id from a user who created it.

Example:

20

created_at
string

The instant this data-stream came into existence.

Example:

"2021-06-24T00:54:40.029056Z"

updated_at
string

The instant this data-stream was last updated.

Example:

"2021-06-24T00:54:40.029056Z"