Developing with Lytics / Lytics API Documentation

Lytics API

The Lytics API is a restful JSON API that includes:

  • Data Collection API's for collection, and upload of custom data.

  • Personalization API for real-time user profile usage in personalization.

  • Segmentation API for lists of users, and creating/managing the segmentation rules.

  • Catalog API for schema information.

  • Content API for content recommendation, and content-classification to drive personalization.

  • Management API for general account management.

Authentication

Our API supports two methods for authorization:

  1. query string URL parameter, using access_token

  2. http Authorization HEADER

Regardless of method above you will need to generate an API token as outlined here in order to access any of the public API endpoints. Please note API tokens have roles associated with them that can limit which APIs they have permission to access. Please ensure that you generate an API token with proper access roles.

# example showing passing auth token in header
curl -XPOST "https://api.lytics.io/api/segment" \
    -H "Authorization: {API Token}" \
    -H 'Content-type: application/json' \
    -d '{"notreal" : []}'

# example as query string parameter
curl -XPOST "https://api.lytics.io/api/segment?access_token={API Token}" \
    -H 'Content-type: application/json' \
    -d '{"notreal" : []}'

IP Whitelisting

For 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.

Provide 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.

What is CIDR? CIDR is a flexible allocation of IP addresses. Use an IP address tool, to convert your IP addresses into a CIDR format, either v4 or v6.

Documentation Examples

We use jq json command line prettifier in our examples throughout this doc.

Media Types

Our API is a JSON REST API. We have data-upload API's which support csv uploads as well.

Requests with a message-body use plain JSON to set or update resource states.

Error States

The common HTTP Response Status Codes are used.

Query Parameters

A variety of places our API accepts query parameters that allow a list of values. The documentation will often say it allows []string or []int (meaning an array of strings, or integers). When this occurs, we allow a variety of formats to pass these.

  • ids=1234 convert this to []string{"123"}

  • ids=[123,456] convert this to []string{"123","456"}

  • ids=123,456 convert this to []string{"123","456"}

  • ids=123&ids=456 convert this to []string{"123","456"}

  • ids[]=123&ids[]=456 convert this to []string{"123","456"} Note that we alias ids[] = ids