Lytics
Lytics is a customer data platform (CDP) that provides two concurrent REST APIs for managing unified user profiles, behavioral audiences, content affinity scoring, campaign flows, and real-time personalization. The v2 API (886 paths / 1,331 operations) covers accounts, authorizations, connections, schema and identity configuration, data models, streams, jobs and ML models; the v1 API still owns data collection, personalization, entity lookup and content classification. Lytics ingests data from 100+ sources, builds predictive audiences, and activates them across advertising networks, email providers, data warehouses and on-site personalization. Lytics joined Contentstack in January 2025.
Lytics publishes 34 APIs on the APIs.io network, including Account API, Account Settings API, Auth API, and 31 more. Tagged areas include Customer Data Platform, CDP, Personalization, Segmentation, and User Profiles.
The Lytics catalog on APIs.io includes 1 event-driven AsyncAPI specification, 1 JSON-LD context, and 1 Spectral governance ruleset.
Lytics’ developer surface includes authentication, documentation, engineering blog, pricing, changelog, support, CLI, and 49 more developer resources.
2 APIs
Individual APIs this provider publishes, each with its own machine-readable definition.
Account related resources of the *Lytics API*. The Account resource describes an account. An account can be a *Master* account, which means that it is a billing account. Master ...
Account Settings describe features/settings for a Lytics account.
API for creation or storage of auth tokens. Most of these tokens are created from the Integrations/Imports setup for Lytics integrations. Additionally, api tokens can be created...
Create and manage credentials and access to external systems.
Catalog exposes info about the schema of the data in Lytics. * **Entities** are Object Types, the primary one being a *User* although most accounts also have *Content* and *Camp...
Create and manage connections to external data sources.
Content APIs for Lytics Content Affinity Engine, allow for adding content into lytics, getting lists of content, and understanding the content and content-topics. **Content Clas...
Create and manage data models and their record stores.
APIs for collecting or uploading data. There are two main APIs, one for uploading Large files (bulk, millions of records) and another for sending real-time, or slightly batched ...
API for creating and managing Experiences as well as all related and/or dependent models such as but not limited to Groups, Templates, Candidates, etc.
Create and manage flows that orchestrate multi-step audience journeys.
Create and manage data import and export jobs.
The Metric API provides access to a variety of metrics that are recorded in the Lytics platform. With this API, you can access segment-size metrics, events received per-hour, as...
Query time series metrics for segments, streams, experiences, and other Lytics resources.
The ML Models API from Lytics — 3 operation(s) for ml models.
Entity API, ie Personalization or Profile API. Retrieve attributes and segments an entity (most likely a user) is a member of. The *Entity* is a *User* most likely, but since Ly...
Get and delete user profiles.
Provider is a 3rd party Lytics Integrates with (Mailchimp, Optimizely, Mixpanel, Facebook etc)
Schema management api to add/edit queries and user-fields. Lytics Query Language ============================= The Lytics Query Language is used to define the transformation of ...
Create and manage reports.
Manage how data sources populate profile fields.
Segments are named, logical expressions of users. These segments may logically be built using other segments as well. The segment api provides a list of segments built by both t...
Segment Collections are grouped/named lists of segments. Segments that participate in a collection such as **Goals** are related. The Lytics App ui has one predefined collection...
SegmentML provides a framework for building custom machine learning models directly in Lytics. Lytics SegmentML models are self-training, continuously-updating and real-time. Se...
Create and manage audience segments.
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 ...
Get metrics and events for data streams in your Lytics account.
**BETA API** Subscriptions are queries into real-time events in Lytics, most commonly listening to a list of users entering/leaving segments ie _triggers_. **Common Use Cases** ...
Manage Lytics system users and their access to data and resources.
Get internal Lytics system events. These events are generally related to internal changes to state of an account. Common changes are CRUD Operations (Create, Update, Delete) of ...
Create, manage, and test templates.
Info about Administrative Lytics account users * Lytics users are unique across accounts * They get *invited* to have access to your account
Work is an *integration* unit, typically for imports and exports. Most run continually, while some run to completion. You generally would only use it through the Webadmin Integr...
Workflow is a specification for a work unit
Open, tool-agnostic API collections (OpenAPI-derived and Bruno).
Published pricing tiers and plan structures.
Documented rate limits and quota policies.
Cost, billing, and metering signals for API financial operations.
AsyncAPI definitions for this provider's event-driven and streaming APIs.
JSON-LD contexts and semantic vocabularies used across these APIs.
Spectral governance rulesets for linting and validating these APIs.
Standalone JSON Schema definitions for this provider's data models.
Example request and response payloads for these APIs.
Authentication, domain security, vulnerability disclosure, and trust-center signals.
Recommended x-agentic-access execution contracts for AI agents.
aid: lytics
name: Lytics
description: Lytics is a customer data platform (CDP) that provides two concurrent REST APIs for managing unified user profiles,
behavioral audiences, content affinity scoring, campaign flows, and real-time personalization. The v2 API (886 paths / 1,331
operations) covers accounts, authorizations, connections, schema and identity configuration, data models, streams, jobs
and ML models; the v1 API still owns data collection, personalization, entity lookup and content classification. Lytics
ingests data from 100+ sources, builds predictive audiences, and activates them across advertising networks, email providers,
data warehouses and on-site personalization. Lytics joined Contentstack in January 2025.
type: Index
deliveryModel:
model: saas
open_source: false
commercial: true
callable_host: false
label: Hosted service · you call their endpoint
confidence: medium
source:
- pricing
generated: '2026-08-28'
method: derived
accessModel:
pricing: freemium
onboarding: self-serve
trial: false
try_now: true
public: false
label: Freemium · Self-serve signup
confidence: high
source:
- plans
- authentication
- rate-limits
- security
generated: '2026-09-03'
method: derived
image: https://kinlane-images.s3.amazonaws.com/shared/apis-json/icons/lytics.png
url: https://raw.githubusercontent.com/api-evangelist/lytics/refs/heads/main/apis.yml
created: '2026-06-13'
modified: '2026-08-13'
specificationVersion: '0.23'
tags:
- Customer Data Platform
- CDP
- Personalization
- Segmentation
- User Profiles
- Behavioral Analytics
- Content Affinity
- Real-Time Data
- Marketing Automation
- Audience Activation
apis:
- aid: lytics:lytics-account-api
name: Lytics Account API
description: 'Account related resources of the *Lytics API*.
The Account resource describes an account. An account can be a *Master* account, which
means that it is a billing account. Master accounts have children accounts
which act more as separate projects, for same billing account. Each child
account can be used for Dev, Testing, etc., or for separate siloes of data
for sub-divisions, etc..
The Account resource has the following attributes:
| field | DataType | Description |
|-------------|------------------|---------------|
| id | string | unique id
| created | Date | Created date
| updated | Date | Last Updated Date
| domain | string | customer-assigned unique id (auto assigned to domain name). This must be unique across
lytics accounts
| email | string | primary email contact for account owner
| parent_id | string | parent account if this account is a child-account of master billing account
| name | string | account name'
humanURL: https://docs.lytics.com/reference
baseURL: https://api.lytics.io/v2
tags:
- Account
properties:
- type: OpenAPI
url: openapi/lytics-account-api-openapi.yml
- type: OpenAPI Source
url: https://dash.readme.com/api/v1/api-registry/1y876emrv8pb2i
- type: Documentation
url: https://docs.lytics.com/reference
- type: APIReference
url: https://docs.lytics.com/reference
- type: ToolCrosswalk
url: mcp/lytics-tool-crosswalk.yml
- type: OpenAPI Source
url: https://dash.readme.com/api/v1/api-registry/10ej22ml8a94fx
- aid: lytics:lytics-account-settings-api
name: Lytics Account Settings API
description: Account Settings describe features/settings for a Lytics account.
humanURL: https://docs.lytics.com/reference
baseURL: https://api.lytics.io/v2
tags:
- Account Settings
properties:
- type: OpenAPI
url: openapi/lytics-account-settings-api-openapi.yml
- type: OpenAPI Source
url: https://dash.readme.com/api/v1/api-registry/1y876emrv8pb2i
- type: Documentation
url: https://docs.lytics.com/reference
- type: APIReference
url: https://docs.lytics.com/reference
- type: ToolCrosswalk
url: mcp/lytics-tool-crosswalk.yml
- type: OpenAPI Source
url: https://dash.readme.com/api/v1/api-registry/10ej22ml8a94fx
- aid: lytics:lytics-auth-api
name: Lytics Auth API
description: 'API for creation or storage of auth tokens. Most of these
tokens are created from the Integrations/Imports setup for Lytics integrations.
Additionally, api tokens can be created/managed from this endpoint.
The oauth, config information are write only attributes that
cannot be subsequently read from the api, and is stored encrypted.'
humanURL: https://docs.lytics.com/reference
baseURL: https://api.lytics.io/v2
tags:
- Authentication
tags_raw:
- Auth
properties:
- type: OpenAPI
url: openapi/lytics-auth-api-openapi.yml
- type: OpenAPI Source
url: https://dash.readme.com/api/v1/api-registry/1y876emrv8pb2i
- type: Documentation
url: https://docs.lytics.com/reference
- type: APIReference
url: https://docs.lytics.com/reference
- type: ToolCrosswalk
url: mcp/lytics-tool-crosswalk.yml
- type: OpenAPI Source
url: https://dash.readme.com/api/v1/api-registry/10ej22ml8a94fx
- aid: lytics:lytics-auths-api
name: Lytics Auths API
description: Create and manage credentials and access to external systems.
humanURL: https://docs.lytics.com/reference
baseURL: https://api.lytics.io/v2
tags:
- Auths
properties:
- type: OpenAPI
url: openapi/lytics-auths-api-openapi.yml
- type: OpenAPI Source
url: https://dash.readme.com/api/v1/api-registry/1y876emrv8pb2i
- type: Documentation
url: https://docs.lytics.com/reference
- type: APIReference
url: https://docs.lytics.com/reference
- type: ToolCrosswalk
url: mcp/lytics-tool-crosswalk.yml
- type: OpenAPI Source
url: https://dash.readme.com/api/v1/api-registry/10ej22ml8a94fx
- aid: lytics:lytics-catalog-api
name: Lytics Catalog API
description: "Catalog exposes info about the schema of the data in Lytics.\n\n* **Entities** are Object Types, the primary\
\ one being a *User*\n although most accounts also have *Content* and *Campaign* as well.\n Custom object types\
\ may be created.\n\n* **Streams** Streams are data sources collected from api or *Integrations* (aka *Work*).\n\n* **Schema**\
\ Per entity type is list of field-types.\n Think of it as describing columns on the user table in a database."
humanURL: https://docs.lytics.com/reference
baseURL: https://api.lytics.io/v2
tags:
- Catalog
properties:
- type: OpenAPI
url: openapi/lytics-catalog-api-openapi.yml
- type: OpenAPI Source
url: https://dash.readme.com/api/v1/api-registry/1y876emrv8pb2i
- type: Documentation
url: https://docs.lytics.com/reference
- type: APIReference
url: https://docs.lytics.com/reference
- type: ToolCrosswalk
url: mcp/lytics-tool-crosswalk.yml
- type: OpenAPI Source
url: https://dash.readme.com/api/v1/api-registry/10ej22ml8a94fx
- aid: lytics:lytics-connections-api
name: Lytics Connections API
description: Create and manage connections to external data sources.
humanURL: https://docs.lytics.com/reference
baseURL: https://api.lytics.io/v2
tags:
- Connections
properties:
- type: OpenAPI
url: openapi/lytics-connections-api-openapi.yml
- type: OpenAPI Source
url: https://dash.readme.com/api/v1/api-registry/1y876emrv8pb2i
- type: Documentation
url: https://docs.lytics.com/reference
- type: APIReference
url: https://docs.lytics.com/reference
- type: ToolCrosswalk
url: mcp/lytics-tool-crosswalk.yml
- type: OpenAPI Source
url: https://dash.readme.com/api/v1/api-registry/10ej22ml8a94fx
- aid: lytics:lytics-content-api
name: Lytics Content API
description: "Content APIs for Lytics Content Affinity Engine, allow for\nadding content into lytics, getting lists of content,\
\ and\nunderstanding the content and content-topics.\n\n**Content Classification**\nContent classification refers to the\
\ Lytics automated\nprocess of taking text, URL, image based content\nand classifying it to attach topics to content documents.\n\
\n* *Content* A list of content (URLs, Email Documents, Uploaded Documents, Campaigns) and\n the topics, created dates,\
\ etc for each.\n\n* *ContentTopics* Categories/Topics are applied to each piece of content.\n\n* *User Content Affinity*\
\ Based on user interacting with content, the topics\n (derived from the content they interact with) is enriched into\
\ their\n profile.\n\nFirst, an overview of How this content gets here.\n\n* *Observed URLs* Once the lytics tag is\
\ on a Website, as users\n use the website any new URL they interact with is collected.\n\n* *Crawling* we can proactively\
\ crawl a site.\n\n* *Email Tools* We see URLs inside of email campaigns and proactively classify\n those URLs, as well\
\ as the emails themselves.\n\n* *Uploaded Content* You may upload content to the **Classify**.\n\n**Use Cases**\n\n*1)\
\ User Content Recomendations* Find content for a user\n based on their content-affinity.\n\n*2) Get List of Content*\
\ Rich query api to get content.\n\n**Examples**\n\n```\n\n# ad-hoc segment scan from content table\n# get a list of content\
\ documents that\n# - have aspects=article (aspects = article,product, etc)\n# - has imageurl\ncurl -s -H \"Authorization:\
\ $LIOKEY\" \\\n -XGET \"https://api.lytics.io/api/segment/scan?sortfield=created&limit=10\" -d '\nFILTER AND (\n EXISTS\
\ imageurls\n aspects = \"article\"\n)\nFROM content\n' | jq '.'\n\n# Create a content-segment\n# - uses \"ALIAS\" as\
\ id for create/update, must be unique\ncurl -s -H \"Authorization: $LIOKEY\" -H \"Content-Type: text/plain\" \\\n -XPOST\
\ \"$LIOAPI/api/segment\" -d '\nFILTER AND (\n EXISTS imageurls\n aspects = \"article\"\n)\nFROM content\nWITH name =\
\ \"My Articles\"\nALIAS my_articles\n' | jq '.'\n\n# grab just those content-docs using named segment scan\ncurl -s -H\
\ \"Authorization: $LIOKEY\" \\\n -XGET \"https://api.lytics.io/api/segment/my_articles/scan?sortfield=created&limit=10\"\
\ \\\n | jq '.'\n\n\n# grab recommended articles for single user\n\ncurl -s -H \"Authorization: $LIODATAKEY\" \\\n -XGET\
\ \"https://api.lytics.io/api/content/recommend/:your_account_id/user/user_id/123456\" \\\n | jq '.'\n\n```"
humanURL: https://docs.lytics.com/reference
baseURL: https://api.lytics.io/v2
tags:
- Content
properties:
- type: OpenAPI
url: openapi/lytics-content-api-openapi.yml
- type: OpenAPI Source
url: https://dash.readme.com/api/v1/api-registry/1y876emrv8pb2i
- type: Documentation
url: https://docs.lytics.com/reference
- type: APIReference
url: https://docs.lytics.com/reference
- type: ToolCrosswalk
url: mcp/lytics-tool-crosswalk.yml
- type: OpenAPI Source
url: https://dash.readme.com/api/v1/api-registry/10ej22ml8a94fx
- aid: lytics:lytics-datamodels-api
name: Lytics Data Models API
description: Create and manage data models and their record stores.
humanURL: https://docs.lytics.com/reference
baseURL: https://api.lytics.io/v2
tags:
- Data Models
tags_raw:
- DataModels
properties:
- type: OpenAPI
url: openapi/lytics-datamodels-api-openapi.yml
- type: OpenAPI Source
url: https://dash.readme.com/api/v1/api-registry/1y876emrv8pb2i
- type: Documentation
url: https://docs.lytics.com/reference
- type: APIReference
url: https://docs.lytics.com/reference
- type: ToolCrosswalk
url: mcp/lytics-tool-crosswalk.yml
- type: OpenAPI Source
url: https://dash.readme.com/api/v1/api-registry/10ej22ml8a94fx
- aid: lytics:lytics-dataupload-api
name: Lytics Data Upload API
description: 'APIs for collecting or uploading data. There are two main APIs, one for uploading
Large files (bulk, millions of records) and another for sending real-time, or slightly batched
events (Less than 10MB).
**stream**
A stream name is like a table in database, each stream is a differnt _Type_ of data.
You assign a name to your data uploads to identify each stream/type.
However, it should be consistent across uploads of same type of data.
**Timestamp Fields**
When uploading historical, or event data you may have a time/date at which
an event occured. Normal event uploads get an event timestamp at the server time
but you can over-ride this behavior so the timestamp is defined in the event you upload.
This is a _timestamp_field_ parameter in api''s below. The formatting for this is very, very
lenient with over 50 format''s supported.'
humanURL: https://docs.lytics.com/reference
baseURL: https://api.lytics.io/v2
tags:
- Data Upload
tags_raw:
- DataUpload
properties:
- type: OpenAPI
url: openapi/lytics-dataupload-api-openapi.yml
- type: OpenAPI Source
url: https://dash.readme.com/api/v1/api-registry/1y876emrv8pb2i
- type: Documentation
url: https://docs.lytics.com/reference
- type: APIReference
url: https://docs.lytics.com/reference
- type: ToolCrosswalk
url: mcp/lytics-tool-crosswalk.yml
- type: OpenAPI Source
url: https://dash.readme.com/api/v1/api-registry/10ej22ml8a94fx
- aid: lytics:lytics-experience-api
name: Lytics Experience API
description: API for creating and managing Experiences as well as all related and/or dependent models such as but not limited
to Groups, Templates, Candidates, etc.
humanURL: https://docs.lytics.com/reference
baseURL: https://api.lytics.io/v2
tags:
- Experience
properties:
- type: OpenAPI
url: openapi/lytics-experience-api-openapi.yml
- type: OpenAPI Source
url: https://dash.readme.com/api/v1/api-registry/1y876emrv8pb2i
- type: Documentation
url: https://docs.lytics.com/reference
- type: APIReference
url: https://docs.lytics.com/reference
- type: ToolCrosswalk
url: mcp/lytics-tool-crosswalk.yml
- type: OpenAPI Source
url: https://dash.readme.com/api/v1/api-registry/10ej22ml8a94fx
- aid: lytics:lytics-flows-api
name: Lytics Flows API
description: Create and manage flows that orchestrate multi-step audience journeys.
humanURL: https://docs.lytics.com/reference
baseURL: https://api.lytics.io/v2
tags:
- Flows
properties:
- type: OpenAPI
url: openapi/lytics-flows-api-openapi.yml
- type: OpenAPI Source
url: https://dash.readme.com/api/v1/api-registry/1y876emrv8pb2i
- type: Documentation
url: https://docs.lytics.com/reference
- type: APIReference
url: https://docs.lytics.com/reference
- type: ToolCrosswalk
url: mcp/lytics-tool-crosswalk.yml
- type: OpenAPI Source
url: https://dash.readme.com/api/v1/api-registry/10ej22ml8a94fx
- aid: lytics:lytics-jobs-api
name: Lytics Jobs API
description: Create and manage data import and export jobs.
humanURL: https://docs.lytics.com/reference
baseURL: https://api.lytics.io/v2
tags:
- Job
tags_raw:
- Jobs
properties:
- type: OpenAPI
url: openapi/lytics-jobs-api-openapi.yml
- type: OpenAPI Source
url: https://dash.readme.com/api/v1/api-registry/1y876emrv8pb2i
- type: Documentation
url: https://docs.lytics.com/reference
- type: APIReference
url: https://docs.lytics.com/reference
- type: ToolCrosswalk
url: mcp/lytics-tool-crosswalk.yml
- type: OpenAPI Source
url: https://dash.readme.com/api/v1/api-registry/10ej22ml8a94fx
- aid: lytics:lytics-metric-api
name: Lytics Metric API
description: 'The Metric API provides access to a variety of metrics that are recorded
in the Lytics platform. With this API, you can access segment-size metrics,
events received per-hour, as well as many workflow specific metrics.'
humanURL: https://docs.lytics.com/reference
baseURL: https://api.lytics.io/v2
tags:
- metric
tags_raw:
- Metric
properties:
- type: OpenAPI
url: openapi/lytics-metric-api-openapi.yml
- type: OpenAPI Source
url: https://dash.readme.com/api/v1/api-registry/1y876emrv8pb2i
- type: Documentation
url: https://docs.lytics.com/reference
- type: APIReference
url: https://docs.lytics.com/reference
- type: ToolCrosswalk
url: mcp/lytics-tool-crosswalk.yml
- type: OpenAPI Source
url: https://dash.readme.com/api/v1/api-registry/10ej22ml8a94fx
- aid: lytics:lytics-metrics-api
name: Lytics Metrics API
description: Query time series metrics for segments, streams, experiences, and other Lytics resources.
humanURL: https://docs.lytics.com/reference
baseURL: https://api.lytics.io/v2
tags:
- Metrics
properties:
- type: OpenAPI
url: openapi/lytics-metrics-api-openapi.yml
- type: OpenAPI Source
url: https://dash.readme.com/api/v1/api-registry/1y876emrv8pb2i
- type: Documentation
url: https://docs.lytics.com/reference
- type: APIReference
url: https://docs.lytics.com/reference
- type: ToolCrosswalk
url: mcp/lytics-tool-crosswalk.yml
- type: OpenAPI Source
url: https://dash.readme.com/api/v1/api-registry/10ej22ml8a94fx
- aid: lytics:lytics-ml-models-api
name: Lytics ML Models API
description: The ML Models API from Lytics — 3 operation(s) for ml models.
humanURL: https://docs.lytics.com/reference
baseURL: https://api.lytics.io/v2
tags:
- ML Models
properties:
- type: OpenAPI
url: openapi/lytics-ml-models-api-openapi.yml
- type: OpenAPI Source
url: https://dash.readme.com/api/v1/api-registry/1y876emrv8pb2i
- type: Documentation
url: https://docs.lytics.com/reference
- type: APIReference
url: https://docs.lytics.com/reference
- type: ToolCrosswalk
url: mcp/lytics-tool-crosswalk.yml
- type: OpenAPI Source
url: https://dash.readme.com/api/v1/api-registry/10ej22ml8a94fx
- aid: lytics:lytics-personalization-api
name: Lytics Personalization API
description: "Entity API, ie Personalization or Profile API.\n\nRetrieve attributes and segments an entity (most likely\
\ a user) is a member of.\n\nThe *Entity* is a *User* most likely, but since Lytics is organized as a Graph Database,\n\
other types of entities may be modeled such as Accounts, or Company, Content, or custom.\n\n```\n# read a single user\n\
curl -s -H \"Authorization: $LIOKEY\" \\\n -XGET \"https://api.lytics.io/api/entity/user/user_id/user123\" | jq '.'\n\
\n```"
humanURL: https://docs.lytics.com/reference
baseURL: https://api.lytics.io/v2
tags:
- Personalization
properties:
- type: OpenAPI
url: openapi/lytics-personalization-api-openapi.yml
- type: OpenAPI Source
url: https://dash.readme.com/api/v1/api-registry/1y876emrv8pb2i
- type: Documentation
url: https://docs.lytics.com/reference
- type: APIReference
url: https://docs.lytics.com/reference
- type: ToolCrosswalk
url: mcp/lytics-tool-crosswalk.yml
- type: OpenAPI Source
url: https://dash.readme.com/api/v1/api-registry/10ej22ml8a94fx
- aid: lytics:lytics-profiles-api
name: Lytics Profiles API
description: Get and delete user profiles.
humanURL: https://docs.lytics.com/reference
baseURL: https://api.lytics.io/v2
tags:
- Profiles
properties:
- type: OpenAPI
url: openapi/lytics-profiles-api-openapi.yml
- type: OpenAPI Source
url: https://dash.readme.com/api/v1/api-registry/1y876emrv8pb2i
- type: Documentation
url: https://docs.lytics.com/reference
- type: APIReference
url: https://docs.lytics.com/reference
- type: ToolCrosswalk
url: mcp/lytics-tool-crosswalk.yml
- type: OpenAPI Source
url: https://dash.readme.com/api/v1/api-registry/10ej22ml8a94fx
- aid: lytics:lytics-provider-api
name: Lytics Provider API
description: Provider is a 3rd party Lytics Integrates with (Mailchimp, Optimizely, Mixpanel, Facebook etc)
humanURL: https://docs.lytics.com/reference
baseURL: https://api.lytics.io/v2
tags:
- Provider
properties:
- type: OpenAPI
url: openapi/lytics-provider-api-openapi.yml
- type: OpenAPI Source
url: https://dash.readme.com/api/v1/api-registry/1y876emrv8pb2i
- type: Documentation
url: https://docs.lytics.com/reference
- type: APIReference
url: https://docs.lytics.com/reference
- type: ToolCrosswalk
url: mcp/lytics-tool-crosswalk.yml
- type: OpenAPI Source
url: https://dash.readme.com/api/v1/api-registry/10ej22ml8a94fx
- aid: lytics:lytics-query-api
name: Lytics Query API
description: "Schema management api to add/edit queries and user-fields.\n\nLytics Query Language\n=============================\n\
\nThe Lytics Query Language is used to define the transformation of uploaded\nrecords, and event data into user Profiles.\
\ It transforms row-level event data into Document-oriented User info.\nThis Query langage is similar to the HIVE or\
\ SQL query langauges, however departs from these in\norder to offer more of a *Rich Document* (json user profile) construction.\n\
\n**Query example**\n\n```\n\n# Build a user from web data\nSELECT\n name -- Simple field, by\
\ default = string\n , age KIND INT -- cast field as int\n , last_visit_ts KIND DATE -- cast as date\n\
\n -- Showing the aggregate counter function and aliasing name of output column AS\n , count(_ref) AS ref_ct\n\
\n -- Valuect makes a map[string]int count of occurences of a key\n , valuect(`my field`) AS myfield_mapct\n\n \
\ -- showcase every optional syntax element in column\n -- meregeop oldest we don't want to over-write this value,\
\ keep oldest\n -- KIND INT normally we don't have to cast as most functions have a specific type\n , amt\
\ AS first_order_amount\n IF event == \"cart checkout\"\n SHORTDESC \"Amount of First Order\"\n \
\ LONGDESC \"Amount of First Order\"\n KIND INT\n MERGEOP OLDEST\n\n -- lets keep around the\
\ date at which they signed up (mergeop oldest)\n , now() AS signedup_date IF event\
\ == \"signed up\" KIND DATE MERGEOP\noldest\n\n -- maps: map all fields that start with \"user.\" into a fact\
\ map\n , match(\"user.\") AS user_attributes KIND map[string]string\n\n -- list of strings\n , set(event)\
\ AS all_events\n\n\n -- Identified By Columns allow merging across streams\n , email(EmailAddress) AS email\n \
\ , _uid\n , fbuid\n\nFROM\n default\nINTO\n user\nBY\n _uid OR email OR fbuid\nWHERE\n _bot = \"f\"\
\ OR NOT EXISTS _bot\nALIAS\n web_user;\n\n# validate the query\ncurl -s -XPOST \"https://api.lytics.io/api/query/_validate\"\
\ \\\n -H \"Authorization: $LIOKEY\" \\\n -H \"Content-Type: text/plain\" \\\n --data-binary @/tmp/tmp.lql | jq\
\ '.'\n\n# upload the query\ncurl -s -XPOST \"https://api.lytics.io/api/query\" \\\n -H \"Authorization: $LIOKEY\" \\\
\n -H \"Content-Type: text/plain\" \\\n --data-binary @your_file.lql | jq '.'\n\n# look at schema it output:\ncurl\
\ -s -H \"Authorization: $LIOKEY\" \\\n -XGET \"https://api.lytics.io/api/schema/user\" | jq '.'\n\n```\n\n**Standard\
\ Syntax**\n\n```\n\nSelect = \"SELECT\" COLUMNS FROM INTO BY [WHERE] ALIAS\n\n# required from, the stream to operate\
\ on for this query\nFROM = \"FROM\" Identifier\n\n# Required Identified By field, name of column \"AS\" from Column\n\
BY = \"BY\" Identifier [\"OR\" Identifier]\n\n# Required Alias for giving a query a unqique identifier\nALIAS = \"ALIAS\"\
\ Identifier\n\n# Optional Where Filter, same as SQL where\nWHERE = \"WHERE\" LogicalExpression\n\nCOLUMNS = COLUMN\
\ [, COLUMN]\n\nCOLUMN = Expression [\"AS\" Identifier]\n [\"IF\" LogicalExpression] [\"SHORTDESC\" String]\n\
\ [\"LONGDESC\" String] [\"KIND\" Kind] [\"MERGEOP\" MergeOp]\n\nLogicalExpression = NOT\n | Comparison\n\
\ | EXISTS\n | IN\n | CONTAINS\n | LIKE\n | Function\n | Expression\n\
\ | \"(\" LogicalExpression \")\"\n | LogicalExpression OR LogicalExpression\n | LogicalExpression\
\ AND LogicalExpression\n\nExpression =\n Identifier\n | Function\n | Literal\n\nFunction = Identifier \"(\"\
\ Expression [, Expression] \")\"\n\nNOT = \"NOT\" LogicalExpression\nComparison = Identifier ComparisonOp\
\ Literal\nComparisonOp = \">\" | \">=\" | \"<\" | \"<=\" | \"==\" | \"!=\"\nEXISTS = \"EXISTS\" Identifier\n\
IN = Identifier \"IN\" (Literal, Literal, ...)\nCONTAINS = Identifier \"CONTAINS\" Literal\nLIKE \
\ = Identifier \"LIKE\" String # uses * for wildcards\n\n\nLiteral = String | Int | Float | Bool | Timestamp\n\n\
Identifier = [a-zA-Z][a-zA-Z0-9_]+ | \"`\" + String + \"`\"\n\nKind = \"int\" | \"number\" | \"string\" | \"date\" | \"\
[]string\" |\n \"ts[]string\" | \"map[string]int\" | \"map[string]number\" | \"map[string]string*\n\n# MergeOp's are\
\ very seldom used and have to be used on the right Kind\n# ie string can use Latest, Oldest (but not min, max)\nMergeOp\
\ = \"max\" | \"min\" | \"latest\" | \"oldest\" | \"mapmax\"\n\n\n```\n\n* **SELECT** Select data to be added to user\
\ profiles. Including Maps, Counts, and other complex data types.\n\n* **FROM** The stream to select from\n\n* **INTO**\
\ This is `USER` for all user profiles. (technically you could create other types, such as \"account\")\n\n* **WHERE**\
\ Filters out entire records to not be included/analyzed. Bots, Employees, Test data.\n\n* **BY** What field are we going\
\ to identify this entity by\n\n* **ALIAS** When a selection query has an alias, that is the profile-fragment(table) name\
\ to use\n\nFunctions\n--------------------------------\n\nThere are a variety of functions for transformation and logic\
\ evaluation.\n\n**Aggregate Functions**\n\nThere are a variety of expressions for building document type structures (maps,\
\ lists, sets).\nThese are functional expressions but can only be used in Columns.\n\n- **cap** Limit the items stored\
\ in a field by count or by date. `cap(field, int)` `cap(field, \"number_of_days\")` (e.g. `cap(field, \"30d\")`). Returns\
\ an array containing the values within the capped count or length of time.\n\n- **count** Count of this key. For instance,\
\ count occurences of sessions that have started (ie, visited web site).\n\n- **set** Create a unique list/array of each\
\ value we have seen from this field\n\n- **min,max** Minimum or Maxium value (for numerics)\n\n- **sum** Sum values\
\ (keep track of total video play time, etc)\n\n**Logical Functions**\nLocal Evaluation, return boolean true/false.\n\n\
- **all** checks for existince of n keys `all(key1,key2,key3,...)` returns boolean.\n\n- **any** accepts a list of values\
\ and returns True if any are the contents of a field `any(fieldname, value1,value2,value3) `\n\n- **exists** Check for\
\ field (aka key) existence.\n * `exists(purchase_total)` checks to see if `purchase_total` is defined for the current\
\ message\n * `valuect(yymm()) AS visits_by_yymm IF exists(_sesstart) ` Only fires `valuect(yymm())`\nif\
\ `_sesstart` exists\n- **in** Determines if a field value is in a set of values.\n * `\"t\" AS is_student IF role_type\
\ IN (\"student\",\"other\")`\n * `dailyContact AS dailyContact IF dailyContact IN (\"student\",\"other\"\
)`\n\n- **eq** Equal to `eq(domain,\"google.com\")`\n\n- **ne** Not Equal to `ne(domain,\"google.com\")`\n\n\
- **lt** Less Than `lt(seconds(video_time), 30)`\n\n- **le** Less Than or Equal to `le(seconds(video_time), 30)`\n\
\n- **gt** Greater Than `gt(seconds(video_time), 30)`\n\n- **ge** Greater Than or Equal to `ge(seconds(video_time),\
\ 30)`\n\n- **not** Not `not(exists(domain))`\n\n- **or** Or `or(exists(domain),\
\ contains(domain,\"google.com\")) AS from_google`\n\n**String Functions**\n\n- **join** Join together multiple values,\
\ coerce them into strings. Last argument is which string to use to join (may be empty string).\n * `join(\"apples\"\
,\"oranges\",\",\") => \"apples,oranges\"`\n * `join(\"apples\",\"oranges\",\"\") => \"applesoranges\"`\n\n- **len**\
\ Length (of array, string)\n\n- **oneof** Choose value from the first field that has a non nil value.\n * `oneof(fielda,fieldb,fieldc)`\n\
\n- **replace** - Replace a matching part of a string with an empty string. Converts to string first.\n * `replace(url,\"\
/search/apachesolr_search/\")` - Removes `/search/apachesolr_search/` from URL\n(in this case, leaving the search term\n\
- **split** Breaks a variable into smaller fragments given a specific delimiter\n * `split(cc,\",\")` - Splits the\
\ variable `cc` at each comma it contains\n\n- **strip(field)** Strips leading and trailing whitespace (spaces, tabs,\
\ newline, carriage-return) from string, or arrays of strings.\n\n- **string.lowercase** Convert strings to lower case\n\
\n- **string.uppercase** Convert strings to upper case\n\n- **string.titlecase** Convert strings to title case\n\n- **contains**\
\ Does this value contain this string? Is a sub-string match, not full match (eq)\n * `IF contains(total_price, \"\
$\")` - Check to see if `total_price` has a `$` in it\n * `IF not(contains(subscriber_key,\"-\")) AND not(contains(subscriber_key,\"\
@\"))` check to make sure\n`-` or `@` is not in it.\n- **hasprefix** Does this value start with this string?\n * `hasprefix(event,\
\ \"created\")` - Check to see if `event` starts with \"created\"\n\n- **hassuffix** Does this value start with this\
\ string?\n * `hassuffix(subscriber_key, \"user\")` - Check to see if `subscriber_key` ends with \"user\"\n\n**Hash\
\ & Encoding Functions**\n\n- **hash.sip** `hash.sip(email)` Hash the given value using sip hash to integer output.\n\n\
- **hash.md5** `hash.md5(email)` Hash the given value using md5\n\n- **hash.sha1** `hash.sha1(email)` Hash the given value\
\ using sha1\n\n- **hash.sha256** `hash.sha256(email)` Hash the given value using sha256\n\n- **hash.sha512** `hash.sha512(email)`\
\ Hash the given value using sha512\n\n- **encoding.b64encode(field)** base64 encode.\n\n- **encoding.b64decode(field)**\
\ base64 decode.\n\n**Cast & Convert**\n\n- **toint** Converts strings to integers. Useful for converting a string to\
\ a number before applying a number-based expression.\n * `toint(order_total)` - Converts `order_total` to an int\n\
\ * `set(toint(split(cc,\",\")))` - Takes the field `cc` and splits it at commas, and converts the\nresults to integers.\
\ Then adds them to a set.\n- **tonumber** Convert to Number\n\n- **todate** Converts strings to dates, see full doc\
\ in Date/Time section below.\n\n- **tobool(field)** Cast to Boolean.\n\n**Map & Set/Array Functions**\n\n- **filter**\
\ Filter out Values that match specified list of match filter criteria\n * `filter(split(\"apples,oranges\",\",\"),\"\
ora*\") => [\"apples\"]`\n\n- **len** Length (of array, string)\n\n- **map** Type: Map `map(key1, todate(date_field))`\n\
\ * `map(key1, todate(date_field)) KIND map[string]time ` By default the `map` is generic map,\ncast to map[string]time\
\ with\n- **match** Type: Map (generic map, use KIND to cast) Match a key, and then keep a map of key/values with the\
\ match value removed\n * `, match(\"topic_\") AS global KIND map[string]number`\n\n- **mapkeys** Type:\
\ Map input, []string{} output. Given a map, return a list of string of each of the keys.\n\n- **mapvalues** Type: Map\
\ input, []string{} output. Given a map, return a list of string values of each of the values.\n\n- **mapinvert** Type:\
\ Map input, MapString output. Given a map, return a map[string]string inverting keys/values.\n\n- **array.index** Cherry\
\ pick a single item out of an array:\n * `array.index(split(\"apples,oranges,peaches\",\",\"),1) => [\"oranges\"\
]`\n\n- **array.slice** Slice an array of items selecting some sub-set of them.\n * `array.slice(split(\"apples,oranges,peaches,pineapple\"\
,\",\"),2) => [\"peaches\",\"pineapple\"]`\n * `array.slice(split(\"apples,oranges,peaches,pineapple\",\",\"),1,3)\
\ => [\"oran
# --- truncated at 32 KB (62 KB total) ---
# Full source: https://raw.githubusercontent.com/api-evangelist/lytics/refs/heads/main/apis.yml
Every provider here is available over the APIs.io API and to AI agents over MCP.