openapi: 3.2.0 info: title: V1 Lytics Stream API version: 1.0.0 description: "The Lytics API is a _restful_ *JSON* api that includes:\n* *Data Collection* api's for collection, and upload of custom data.\n* *Personalization api* for real-time user profile usage in personalization.\n* *Segmentation api* for lists of users, and creating/managing the segmentation rules.\n* *Catalog api* for schema information.\n* *Content api* for content recommendation, and content-classification to drive personalization.\n* *Management api* for general account management.\n## Authentication\nThe *Lytics API* supports authentication using one of the following:\nLogin to your account [Lytics App](https://activate.getlytics.com) and navigate to *Account* to find your keys.\nAfter you have acquired your token, use it to access the Lytics API.\nOur api supports two methods for authorization:\n* query string url parameter, using **access_token**\n* http **Authorization** HEADER\n\n```\n# example showing passing auth token in header\ncurl -XPOST 'https://api.lytics.io/api/segment' \\\n -H \"Authorization: pretendtoken8762\" \\\n -H 'Content-type: application/json' \\\n -d '{\"notreal\" : []}'\n\n# example as query string parameter\ncurl -XPOST 'https://api.lytics.io/api/segment?access_token=804ef78pretendtoken8762' \\\n -H 'Content-type: application/json' \\\n -d '{\"notreal\" : []}'\n\n```\n\nAdditionally, there are two types of authentication token's:\n\n* *User Auth Token* is normally just for the web admin. But may be used on the api, this is a user-specific token, and attributes actions to this user. This token expires.\n\n* *API User* is a less privileged role and does not expire. But, less history is available on actions.\n\n## IP Whitelisting\n\nFor better security, you can manage access to the Lytics API using the IP address whitelisting api_ip_whitelist setting on your account. This setting will also be applied to manage admin access to your Lytics account.\n\nProvide a CIDR value for the range of IP addresses you trust. Lytics will then ignore any unauthenticated users and/or IP addresses that fall out of the valid range. This means you can grant access to only your trusted users.\n\nWhat is CIDR?\nCIDR is a flexible allocation of IP addresses. Use an [IP address tool] (https://www.ipaddressguide.com/), to convert your IP addresses into a CIDR format, either v4 or v6.\n\n## Documentation Examples\n\nWe use [jq json command line prettifier](https://stedolan.github.io/jq/) in our examples throughout this doc.\n\n## Media Types\n\nOur API is a JSON REST API. We have data-upload api's which support\ncsv uploads as well.\n\nRequests with a message-body use plain JSON to set or update resource states.\n\n## Error States\n\nThe common [HTTP Response Status Codes](https://github.com/for-GET/know-your-http-well/blob/master/status-codes.md) are used.\n\n## Query Parameters\n\nA variety of places our api accepts query parameters that allow a list of values.\nThe documentation will often say it allows `[]string or []int` (meaning an array of strings, or integers).\nWhen this occurs, we allow a variety of formats to pass these.\n\n* `ids=1234` convert this to []string{\"123\"}\n\n* `ids=[123,456]` convert this to []string{\"123\",\"456\"}\n\n* `ids=123,456` convert this to []string{\"123\",\"456\"}\n\n* `ids=123&ids=456` convert this to []string{\"123\",\"456\"}\n\n* `ids[]=123&ids[]=456` convert this to []string{\"123\",\"456\"} Note that we alias ids[] = ids" servers: - url: https://api.lytics.io tags: - name: Stream description: 'API for creating stream models. A stream is the same as a [data stream](https://learn.lytics.com/product-docs/data-management/using-data-streams#what-are-data-streams? ) and is consumed for ingestion into a given entity table. It is described by its slug, which is the value used to identify the stream in collection as well as in the FROM statement on a given query.' paths: /api/stream/{id}: get: responses: '200': description: JSON representation of Streams Resource. headers: {} content: application/json: schema: $ref: '#/components/schemas/StreamModel' examples: response: value: data: - account_id: d8e403de6fbf0090b17b42a2bb37716e aid: 2 channel: email created: '2018-07-31T22:41:21.908Z' hidden: false id: 765ed319ddc918e6bb5f9b1d6359a3c4 method: '' providers: [] slug: hellow tables: [] updated: '2018-07-31T22:41:21.908Z' message: success status: 200 security: - ApiKeyAuth: [] summary: Retrieve a Single Stream operationId: Retrieve a Single Stream description: Get a stream according to its ID. tags: - Stream parameters: - name: account_id in: query description: Your Lytics account ID. required: false schema: type: string - name: id in: path description: ID of the stream in the form of a hash. You can also use the slug. required: true schema: type: string put: responses: '200': description: JSON representation of Streams Resource. headers: {} content: application/json: schema: $ref: '#/components/schemas/StreamModel' examples: response: value: data: - account_id: d8e403de6fbf0090b17b42a2bb37716e aid: 2 channel: email created: '2018-07-31T22:41:21.908Z' hidden: false id: 765ed319ddc918e6bb5f9b1d6359a3c4 method: '' providers: [] slug: hellow tables: [] updated: '2018-07-31T22:41:21.908Z' message: success status: 200 security: - ApiKeyAuth: [] summary: Update a Stream operationId: Update a Stream description: 'Update a stream with a given ID. The parameters listed below provided in the PUT request will overwrite the current parameters in the model. Stream attributes that a user is able to update: * *slug* (string) ... raw value of the stream as it appears in both queries and collection * *channel* (string, optional) ... method by which this stream collects data. Only allowable channel types: web, email, mobile, ad, sms, pos * *label* (string, optional) ... user assignable label, for display in the UI * *description* (string, optional) ... user assignable description * *providers* ([]string, optional) ... names of the providers that send data on this stream' tags: - Stream parameters: - name: account_id in: query description: Your Lytics account ID. required: false schema: type: string - name: id in: path description: ID of the stream in the form of a hash. You can also use the slug. required: true schema: type: string delete: responses: '200': description: OK headers: {} security: - ApiKeyAuth: [] summary: Delete a Stream operationId: Delete a Stream description: Delete a stream with a given ID. tags: - Stream parameters: - name: account_id in: query description: Your Lytics account ID. required: false schema: type: string - name: id in: path description: ID of the stream in the form of a hash. You can also use the slug. required: true schema: type: string /api/stream: get: responses: '200': description: OK headers: {} security: - ApiKeyAuth: [] summary: Retrieve a List of Streams from Account operationId: Retrieve a List of Streams from Account description: Get a list of all the streams for an account tags: - Stream post: responses: '200': description: JSON representation of Streams Resource. headers: {} content: application/json: schema: $ref: '#/components/schemas/StreamModel' examples: response: value: data: - account_id: d8e403de6fbf0090b17b42a2bb37716e aid: 2 channel: email created: '2018-07-31T22:41:21.908Z' hidden: false id: 765ed319ddc918e6bb5f9b1d6359a3c4 method: '' providers: [] slug: hellow tables: [] updated: '2018-07-31T22:41:21.908Z' message: success status: 200 security: - ApiKeyAuth: [] summary: Create a Stream operationId: Create a Stream description: 'JSON Parameters: * *slug* (string) ... raw value of the stream as it appears in both queries and collection * *channel* (string) ... method by which this stream collects data. Only allowable channel types: web, email, mobile, ad, sms, pos * *label* (string, optional) ... user assignable label, for display in the UI * *description* (string, optional) ... user assignable description * *tables* ([]string, optional) ... names of the tables to which this stream writes * *providers* ([]string, optional) ... names of the providers that send data on this stream * *hidden* (bool, optional) ... whether stream is hidden in stream stats? * *method* (string, optional) ... either ''bulk'' or ''streaming''' tags: - Stream components: schemas: StreamModel: type: object properties: data: type: array items: type: object properties: account_id: type: string aid: type: number channel: type: string created: type: string hidden: type: boolean id: type: string method: type: string providers: type: array items: {} slug: type: string tables: type: array items: {} updated: type: string message: type: string status: type: number example: data: - account_id: d8e403de6fbf0090b17b42a2bb37716e aid: 2 channel: email created: '2018-07-31T22:41:21.908Z' hidden: false id: 765ed319ddc918e6bb5f9b1d6359a3c4 method: '' providers: [] slug: hellow tables: [] updated: '2018-07-31T22:41:21.908Z' message: success status: 200 securitySchemes: ApiKeyAuth: in: header name: Authorization type: apiKey x-readme: explorer-enabled: true proxy-enabled: true