---
title: "Content"
description: "<p>Content APIs for Lytics Content Affinity Engine, allow for</p><p>adding content into lytics, getting lists of content, and</p><p>understanding the content and content-topics.</p><p>**Content Classification**</p><p>Content classification refers to the Lytics automated</p><p>process of taking text, URL, image based content</p><p>and classifying it to attach topics to content documents.</p><p>* *Content* A list of content (URLs, Email Documents, Uploaded Documents, Campaigns) and</p><p>  the topics, created dates, etc for each.</p><p>* *ContentTopics*  Categories/Topics are applied to each piece of content.</p><p>* *User Content Affinity* Based on user interacting with content, the topics</p><p>   (derived from the content they interact with) is enriched into their</p><p>   profile.</p><p>First, an overview of How this content gets here.</p><p>* *Observed URLs* Once the lytics tag is on a Website, as users</p><p>  use the website any new URL they interact with is collected.</p><p>* *Crawling* we can proactively crawl a site.</p><p>* *Email Tools* We see URLs inside of email campaigns and proactively classify</p><p>  those URLs, as well as the emails themselves.</p><p>* *Uploaded Content* You may upload content to the **Classify**.</p><p>**Use Cases**</p><p>*1)  User Content Recomendations*  Find content for a user</p><p>  based on their content-affinity.</p><p>*2)  Get List of Content* Rich query api to get content.</p><p>**Examples**</p><p>``<span data-type=\"inlineCode\" class=\"code\"></p><p># ad-hoc segment scan from content table</p><p># get a list of content documents that</p><p>#  - have aspects=article   (aspects = article,product, etc)</p><p>#  - has imageurl</p><p>curl -s -H \"Authorization: $LIOKEY\" \\</p><p> -XGET \"https://api.lytics.io/api/segment/scan?sortfield=created&amp;limit=10\" -d '</p><p>FILTER AND (</p><p> EXISTS imageurls</p><p> aspects = \"article\"</p><p>)</p><p>FROM content</p><p>' | jq '.'</p><p># Create a content-segment</p><p># - uses \"ALIAS\" as id for create/update, must be unique</p><p>curl -s -H \"Authorization: $LIOKEY\" -H \"Content-Type: text/plain\" \\</p><p>  -XPOST \"$LIOAPI/api/segment\" -d '</p><p>FILTER AND (</p><p> EXISTS imageurls</p><p> aspects = \"article\"</p><p>)</p><p>FROM content</p><p>WITH name = \"My Articles\"</p><p>ALIAS my_articles</p><p>' | jq '.'</p><p># grab just those content-docs using named segment scan</p><p>curl -s -H \"Authorization: $LIOKEY\" \\</p><p> -XGET \"https://api.lytics.io/api/segment/my_articles/scan?sortfield=created&amp;limit=10\" \\</p><p>  | jq '.'</p><p># grab recommended articles for single user</p><p>curl -s -H \"Authorization: $LIODATAKEY\" \\</p><p> -XGET \"https://api.lytics.io/api/content/recommend/:your_account_id/user/user_id/123456\" \\</p><p>  | jq '.'</p><p></span>``</p>"
url: "https://www.contentstack.com/docs/developers/apis/lytics-api/v1/content"
product: "Contentstack"
doc_type: "guide"
audience:
  - developers
  - admins
version: "current"
last_updated: "2026-11-05"
---

# Content

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 Classification\*\*

Content classification refers to the Lytics automated

process of taking text, URL, image based content

and classifying it to attach topics to content documents.

\* \*Content\* A list of content (URLs, Email Documents, Uploaded Documents, Campaigns) and

the topics, created dates, etc for each.

\* \*ContentTopics\* Categories/Topics are applied to each piece of content.

\* \*User Content Affinity\* Based on user interacting with content, the topics

(derived from the content they interact with) is enriched into their

profile.

First, an overview of How this content gets here.

\* \*Observed URLs\* Once the lytics tag is on a Website, as users

use the website any new URL they interact with is collected.

\* \*Crawling\* we can proactively crawl a site.

\* \*Email Tools\* We see URLs inside of email campaigns and proactively classify

those URLs, as well as the emails themselves.

\* \*Uploaded Content\* You may upload content to the \*\*Classify\*\*.

\*\*Use Cases\*\*

\*1) User Content Recomendations\* Find content for a user

based on their content-affinity.

\*2) Get List of Content\* Rich query api to get content.

\*\*Examples\*\*

\`\`

\# ad-hoc segment scan from content table

\# get a list of content documents that

\# - have aspects=article (aspects = article,product, etc)

\# - has imageurl

curl -s -H "Authorization: $LIOKEY" \\

\-XGET "https://api.lytics.io/api/segment/scan?sortfield=created&limit=10" -d '

FILTER AND (

EXISTS imageurls

aspects = "article"

)

FROM content

' | jq '.'

\# Create a content-segment

\# - uses "ALIAS" as id for create/update, must be unique

curl -s -H "Authorization: $LIOKEY" -H "Content-Type: text/plain" \\

\-XPOST "$LIOAPI/api/segment" -d '

FILTER AND (

EXISTS imageurls

aspects = "article"

)

FROM content

WITH name = "My Articles"

ALIAS my\_articles

' | jq '.'

\# grab just those content-docs using named segment scan

curl -s -H "Authorization: $LIOKEY" \\

\-XGET "https://api.lytics.io/api/segment/my\_articles/scan?sortfield=created&limit=10" \\

| jq '.'

\# grab recommended articles for single user

curl -s -H "Authorization: $LIODATAKEY" \\

\-XGET "https://api.lytics.io/api/content/recommend/:your\_account\_id/user/user\_id/123456" \\

| jq '.'

\`\`

## ContentTopics

### ContentTopics

**GET** `/api/content/topic`

Get a list of topics in the content graph.

\`\`

curl -s -H "Authorization: $LIOKEY" \\

\-XGET "https://api.lytics.io/api/content/topic?limit=10" | jq '.'

\`\`

#### Query Parameters

- **account_id** (optional)
  Your Lytics account ID.
- **limit** (optional)
  limit on number of topics to return, default = 500

#### Headers

- **Authorization** (optional)

#### Sample Response

```json
{
  "status": 200,
  "message": "success",
  "data": [
    {
      "label": "Data-First Marketing",
      "doc_count": 275,
      "total": 380636,
      "missing": 216048,
      "present": 143710,
      "avg": 0.5983867964798089,
      "tags": [
        "custom"
      ]
    },
    {
      "label": "User Data Unification",
      "doc_count": 273,
      "total": 380636,
      "missing": 216048,
      "present": 154068,
      "avg": 0.6036863622558337,
      "tags": [
        "custom"
      ]
    },
    {
      "label": "Customer Data Platform",
      "doc_count": 313,
      "total": 380260,
      "missing": 216043,
      "present": 159628,
      "avg": 0.9704200631406573,
      "tags": [
        "custom"
      ]
    }
  ]
}
```

## ContentTopicSummary

### ContentTopicSummary

**GET** `/api/content/topic/{topic}`

#### URL Parameters

- **topic** (required)
  id or slug of topic

#### Query Parameters

- **account_id** (optional)
  Your Lytics account ID.

#### Headers

- **Authorization** (optional)

#### Sample Response

```json
{
  "status": 200,
  "message": "success",
  "data": {
    "topics": {
      "total": 3232717,
      "missing": 2985477,
      "present": 239239,
      "bucket_none": 8001,
      "bucket_low": 26279,
      "bucket_mid": 11742,
      "bucket_high": 201218,
      "avg": 0.90787879293533
    },
    "docs": {
      "total": 373,
      "urls": [
        {
          "url": "www.our-site.com/product/new-product-xyz",
          "title": "Blue Running Shoes that make you faster",
          "topics": [
            "our-site (company)",
            "running",
            "shoes"
          ],
          "id": "3395466611293777389"
        }
      ]
    }
  }
}
```

## ContentTopicRollupSummary

### ContentTopicRollupSummary

**GET** `/api/content/rollup/{label}`

#### URL Parameters

- **label** (required)
  label of topic-rollup

#### Query Parameters

- **account_id** (optional)
  Your Lytics account ID.

#### Headers

- **Authorization** (optional)

#### Sample Response

```json
{
  "data": {
    "docs": {
      "total": 2,
      "urls": [
        {
          "author": "Cookie Monster",
          "created": "2016-01-14T08:39:01.354824186-07:00",
          "description": "you should definitely make these cookies",
          "fetched": "2016-07-19T13:39:20.158747984-04:00",
          "id": "4525087172572165639",
          "meta": [
            "og:locale/en_US"
          ],
          "primary_image": "http://cookdiary.net/wp-content/uploads/images/Oatmeal-Chocolate-Chip-Cookies_1441.jpg",
          "stream": "default",
          "title": "how to make some cookies",
          "topic_relevances": {
            "Recipe": 0.64,
            "baking": 0.75
          },
          "topic_rollups": {
            "Things": 0.75
          },
          "topics": [
            "baking",
            "Recipe"
          ],
          "updated": "2016-07-19T13:34:18-04:00",
          "url": "www.recipes.com/chocolate-chip-cookies"
        },
        {
          "author": "The Swedish Chef",
          "created": "2016-07-19T13:39:20.158747984-04:00",
          "description": "a delicious cake",
          "id": "-2119104978705508335",
          "primary_image": "http://www.vanillacake.com/cake.jpg",
          "stream": "default",
          "title": "Basic Vanilla Cake Recipe",
          "topic_relevances": {
            "Recipe": 0.64,
            "baking": 0.85
          },
          "topic_rollups": {
            "Desserts": 0.85
          },
          "topics": [
            "Recipe",
            "baking"
          ],
          "updated": "2016-07-19T13:29:18-04:00",
          "url": "www.recipes.com/cake"
        }
      ]
    },
    "rollups": null
  },
  "message": "success",
  "status": 200
}
```

## ContentTopicRollupList

### ContentTopicRollupList

**GET** `/api/content/topicrollup`

Get list of topic-rollups.

\`\`

curl "$LIOAPI/api/content/topicrollup" -s -H "Authorization: $LIOKEY" | jq '.'

\`\`

#### Headers

- **Authorization** (optional)

#### Sample Response

```json
{
  "data": [
    {
      "id": "6a7f76ff97ad0e3e96c162f74aee8f8f",
      "account_id": "4f7b525bdba058fc096757a6",
      "label": "Baking rollup",
      "created": "2014-08-04T21:18:20.124Z",
      "updated": "2014-08-04T21:18:20.124Z",
      "topics": [
        {
          "label": "Recipe",
          "value": 0.66
        },
        {
          "label": "baking",
          "value": 0.55
        }
      ]
    }
  ]
}
```

## Content Topic Blacklist Fetch

### Content Topic Blacklist Fetch

**GET** `/api/content/topicblocklist`

Fetch the blacklisted topics

#### Headers

- **Authorization** (optional)

#### Sample Response

```json
{
  "status": 200,
  "message": "success",
  "data": [
    {
      "label": "Data-First Marketing",
      "doc_count": 275,
      "total": 380636,
      "missing": 216048,
      "present": 143710,
      "avg": 0.5983867964798089,
      "tags": [
        "blacklisted"
      ]
    },
    {
      "label": "User Data Unification",
      "doc_count": 273,
      "total": 380636,
      "missing": 216048,
      "present": 154068,
      "avg": 0.6036863622558337,
      "tags": [
        "blacklisted"
      ]
    }
  ]
}
```

## Content Topic Blacklist Create

### Content Topic Blacklist Create

**POST** `/api/content/topicblocklist`

Blacklist or un-blacklist topics to an account's topic-blacklist

\`\`

\# to blacklist certain topics

curl -s -XPOST "https://api.lytics.io/api/content/topicblocklist" \\

\-H "Content-type: application/json" \\

\-H "Authorization: $LIOKEY" \\

\-d'

{

"method": "add",

"ids": \["Data-First Marketing", "User Data Unification"\]

}

' | jq '.'

\# to unblacklist certain topics

curl -s -XPOST "https://api.lytics.io/api/content/topicblocklist" \\

\-H "Content-type: application/json" \\

\-H "Authorization: $LIOKEY" \\

\-d'

{

"method": "delete",

"ids": \["Data-First Marketing", "User Data Unification"\]

}

' | jq '.'

\`\`

#### Headers

- **Authorization** (optional)

#### Sample Response

```json
{
  "status": 200,
  "message": "success",
  "data": [
    {
      "label": "Data-First Marketing",
      "doc_count": 275,
      "total": 380636,
      "missing": 216048,
      "present": 143710,
      "avg": 0.5983867964798089,
      "tags": [
        "blacklisted"
      ]
    },
    {
      "label": "User Data Unification",
      "doc_count": 273,
      "total": 380636,
      "missing": 216048,
      "present": 154068,
      "avg": 0.6036863622558337,
      "tags": [
        "blacklisted"
      ]
    }
  ]
}
```

## Content Topic Blacklist Update

### Content Topic Blacklist Update

**PUT** `/api/content/topicblocklist`

Replace topics in an account's topic-blacklist

\`\`

curl -s -XPOST "https://api.lytics.io/api/content/topicblocklist" \\

\-H "Content-type: application/json" \\

\-H "Authorization: $LIOKEY" \\

\-d'

{

"ids": \["Data-First Marketing", "User Data Unification"\]

}

' | jq '.'

\`\`

#### Headers

- **Authorization** (optional)

#### Sample Response

```json
{
  "status": 200,
  "message": "success",
  "data": [
    {
      "label": "Data-First Marketing",
      "doc_count": 275,
      "total": 380636,
      "missing": 216048,
      "present": 143710,
      "avg": 0.5983867964798089,
      "tags": [
        "blacklisted"
      ]
    },
    {
      "label": "User Data Unification",
      "doc_count": 273,
      "total": 380636,
      "missing": 216048,
      "present": 154068,
      "avg": 0.6036863622558337,
      "tags": [
        "blacklisted"
      ]
    }
  ]
}
```

## ContentTopicRollup Fetch

### ContentTopicRollup Fetch

**GET** `/api/content/topicrollup/{id}`

Fetch a topic-rollup by \*\*id\*\*

#### URL Parameters

- **id** (required)
  id of topic-rollup

#### Query Parameters

- **account_id** (optional)
  Your Lytics account ID.

#### Headers

- **Authorization** (optional)

#### Sample Response

```json
{
  "data": {
    "id": "6a7f76ff97ad0e3e96c162f74aee8f8f",
    "account_id": "4f7b525bdba058fc096757a6",
    "label": "Baking rollup",
    "created": "2014-08-04T21:18:20.124Z",
    "updated": "2014-08-04T21:18:20.124Z",
    "topics": [
      {
        "label": "Recipe",
        "value": 0.66
      },
      {
        "label": "baking",
        "value": 0.55
      }
    ]
  }
}
```

## ContentTopicRollup Create

### ContentTopicRollup Create

**POST** `/api/content/topicrollup/{id}`

Create a topic-rollup.

\`\`

curl -s -XPOST "https://api.lytics.io/api/content/topicrollup" \\

\-H "Content-type: application/json" \\

\-H "Authorization: $LIOKEY" \\

\-d'

{

"label": "Baking rollup",

"acctid": "123456",

"topics": \[

{"label": "Recipe"},

{"label": "baking"}

\]

}

' | jq '.'

\`\`

#### URL Parameters

- **id** (required)
  id of topic-rollup

#### Query Parameters

- **account_id** (optional)
  Your Lytics account ID.

#### Headers

- **Authorization** (optional)

#### Sample Response

```json
{
  "data": {
    "id": "6a7f76ff97ad0e3e96c162f74aee8f8f",
    "account_id": "4f7b525bdba058fc096757a6",
    "label": "Baking rollup",
    "created": "2014-08-04T21:18:20.124Z",
    "updated": "2014-08-04T21:18:20.124Z",
    "topics": [
      {
        "label": "Recipe",
        "value": 0.66
      },
      {
        "label": "baking",
        "value": 0.55
      }
    ]
  }
}
```

## ContentTopicRollup Delete

### ContentTopicRollup Delete

**DELETE** `/api/content/topicrollup/{id}`

Delete a topic-rollup

#### URL Parameters

- **id** (required)
  id of topic-rollup

#### Query Parameters

- **account_id** (optional)
  Your Lytics account ID.

#### Headers

- **Authorization** (optional)

#### Sample Response

```json
No Content
```

## ContentDocument

### ContentDocument

**GET** `/api/content/doc`

#### Query Parameters

- **account_id** (optional)
  Your Lytics account ID.
- **urls** (optional)
  url to look up
- **ids** (optional)
  hashed url or campaign id to look up

#### Headers

- **Authorization** (optional)

#### Sample Response

```json
{
  "status": 200,
  "message": "success",
  "data": {
    "total": 1,
    "urls": [
      {
        "url": "www.our-site.com/product/new-product-xyz",
        "title": "Blue Running Shoes that make you faster",
        "topics": [
          "our-site (company)",
          "running",
          "shoes"
        ],
        "id": "3395466611293777389"
      }
    ]
  }
}
```

## Content Classify

### Content Classify

**GET** `/api/content/doc/classify`

Classify a document without adding the document to the content table corpus. Used for debugging.

#### Query Parameters

- **account_id** (optional)
  Your Lytics account ID.
- **url** (optional)
  url to classify
- **text** (optional)
  text to classify

#### Headers

- **Authorization** (optional)

#### Sample Response

```json
{
  "data": {
    "id": "https://www.getlytics.com/blog/post/improving_google_analytics?utm_source=linkedin",
    "url": {
      "Params": {},
      "Utm": {
        "utm_campaign": null,
        "utm_content": null,
        "utm_medium": null,
        "utm_source": "linkedin",
        "utm_term": null
      },
      "UserInfo": null
    },
    "url_redirected_from": "",
    "description": "Stop Pretending Your Insights Are Actionable: Part 1, Google Analytics",
    "long_description": "Most analytics tools are used purely for insight discovery rather than empowering action. We explore how the Lytics analytics integrations focus on action and filling the some massive gaps traditional analytics tools miss.",
    "type": "web",
    "stream": "",
    "httpstatus": 0,
    "humanLanguage": "en",
    "tags": [
      {
        "type": "meta",
        "id": "og:title",
        "value": "stop pretending your insights are actionable: part 1, google analytics",
        "source": "meta",
        "vocab": "lytics",
        "relevance": 1
      },
      {
        "type": "concept",
        "id": "Google_Analytics",
        "tax": [
          "http://dbpedia.org/ontology/Company",
          "http://dbpedia.org/ontology/Website",
          "http://dbpedia.org/ontology/Work",
          "http://www.w3.org/2002/07/owl#Thing"
        ],
        "value": "Google Analytics",
        "source": "diffbot",
        "vocab": "dbpedia",
        "relevance": 0.95
      }
    ],
    "flags": null,
    "images": [
      {
        "url": "https://www.getlytics.com/img/blog/defaults/developers.gif"
      }
    ],
    "primary_image": "https://www.getlytics.com/img/blog/defaults/developers.gif",
    "videos": null,
    "primary_video": "",
    "published": "2015-10-23T00:00:00Z",
    "author": "Mark Hayden",
    "numpages": 0,
    "sitename": "Lytics",
    "productDescription": "",
    "brand": "",
    "price": "",
    "saveAmount": "",
    "productId": "",
    "created": "2016-06-24T21:20:43.421892991Z",
    "fetched": "2016-06-24T21:20:45.751844316Z",
    "updated": "2016-06-24T21:20:52.367247963Z",
    "enriched": {
      "diffbot": "2016-06-24T21:20:52.367248438Z",
      "google": "1970-01-01T00:00:00Z",
      "meta": "2016-06-24T21:20:45.751852586Z",
      "textrazor": "1970-01-01T00:00:00Z"
    },
    "version": 4
  },
  "message": "success",
  "status": 200
}
```

## Content Classify

### Content Classify

**POST** `/api/content/doc/classify`

Classify a document and add the document to the content table corpus.

#### Query Parameters

- **account_id** (optional)
  Your Lytics account ID.
- **url** (optional)
  url to classify
- **text** (optional)
  text to classify

#### Headers

- **Authorization** (optional)

#### Sample Response

```json
{
  "data": {
    "id": "https://www.getlytics.com/blog/post/improving_google_analytics?utm_source=linkedin",
    "url": {
      "Params": {},
      "Utm": {
        "utm_campaign": null,
        "utm_content": null,
        "utm_medium": null,
        "utm_source": "linkedin",
        "utm_term": null
      },
      "UserInfo": null
    },
    "url_redirected_from": "",
    "description": "Stop Pretending Your Insights Are Actionable: Part 1, Google Analytics",
    "long_description": "Most analytics tools are used purely for insight discovery rather than empowering action. We explore how the Lytics analytics integrations focus on action and filling the some massive gaps traditional analytics tools miss.",
    "type": "web",
    "stream": "",
    "httpstatus": 0,
    "humanLanguage": "en",
    "tags": [
      {
        "type": "meta",
        "id": "og:title",
        "value": "stop pretending your insights are actionable: part 1, google analytics",
        "source": "meta",
        "vocab": "lytics",
        "relevance": 1
      },
      {
        "type": "concept",
        "id": "Google_Analytics",
        "tax": [
          "http://dbpedia.org/ontology/Company",
          "http://dbpedia.org/ontology/Website",
          "http://dbpedia.org/ontology/Work",
          "http://www.w3.org/2002/07/owl#Thing"
        ],
        "value": "Google Analytics",
        "source": "diffbot",
        "vocab": "dbpedia",
        "relevance": 0.95
      }
    ],
    "flags": null,
    "images": [
      {
        "url": "https://www.getlytics.com/img/blog/defaults/developers.gif"
      }
    ],
    "primary_image": "https://www.getlytics.com/img/blog/defaults/developers.gif",
    "videos": null,
    "primary_video": "",
    "published": "2015-10-23T00:00:00Z",
    "author": "Mark Hayden",
    "numpages": 0,
    "sitename": "Lytics",
    "productDescription": "",
    "brand": "",
    "price": "",
    "saveAmount": "",
    "productId": "",
    "created": "2016-06-24T21:20:43.421892991Z",
    "fetched": "2016-06-24T21:20:45.751844316Z",
    "updated": "2016-06-24T21:20:52.367247963Z",
    "enriched": {
      "diffbot": "2016-06-24T21:20:52.367248438Z",
      "google": "1970-01-01T00:00:00Z",
      "meta": "2016-06-24T21:20:45.751852586Z",
      "textrazor": "1970-01-01T00:00:00Z"
    },
    "version": 4
  },
  "message": "success",
  "status": 200
}
```

## Content Recommendation

### Content Recommendation

**GET** `/api/content/recommend/user/{fieldname}/{fieldval}`

#### URL Parameters

- **fieldname** (required)
  field to use to identify a user
- **fieldval** (required)
  unique identity

#### Query Parameters

- **account_id** (optional)
  Your Lytics account ID.
- **contentsegment** (required)
  id, or slug of a content-collection to filter content
- **limit** (optional)
  limit on number of documents to suggest/return
- **shuffle** (optional)
  whether or not to shuffle the recommendation order
- **visited** (optional)
  whether to show recommendations for content the user has already viewed
- **topics** (optional)
  if supplied, only allow recommendations on content with the specified topics
- **rank** (optional)
  Ranking method for order of recommendations. Must be one of "popular", "recent", or "affinity"
- **wait** (optional)
  Whether or not to wait for more complex user identities to resolve
- **email** (optional)
  if the fieldname and fieldval are omitted, an email can be provided. This can be helpful for templating use-cases
- **url** (optional)
  if url is provided, the recommendations will be based on the content topics associated with the provided URL

#### Headers

- **Authorization** (optional)

#### Sample Response

```json
{
  "data": [
    {
      "url": "www.getlytics.com/blog/post/intent_through_content",
      "title": "Understanding User Intent Through Content",
      "description": "Customer Intent comes from understanding the connection between engagement and its contexts. Content modeling and affinity graphs makes interpretation of intent a lot easier. Learn how marketers can benefit from this.",
      "topics": [
        "customer data platform",
        "data science",
        "content marketing",
        "personalization"
      ],
      "topic_relevances": {
        "content marketing": 1,
        "customer data platform": 1,
        "data science": 1,
        "personalization": 1
      },
      "primary_image": "https://www.getlytics.com/img/blog/posts/intent_through_content/intent_through_content-bg.gif",
      "author": "",
      "created": "2016-06-08T16:11:45.599594093Z",
      "id": "-3435113786560588929",
      "sitename": "Lytics",
      "stream": "default",
      "path": [
        "blog",
        "blog/post",
        "blog/post/intent_through_content"
      ],
      "aspects": [
        "article"
      ],
      "language": "unknown",
      "updated": "2016-06-09T12:49:36.870359765Z",
      "fetched": "2016-06-09T12:49:35.812654441Z",
      "meta": [
        "og:locale/en_us",
        "og:site_name/lytics",
        "og:title/understanding user intent through content",
        "og:type/article",
        "og:url/https://www.getlytics.com/blog/post/intent_through_content"
      ],
      "confidence": 0.5916079783099615,
      "visited": true
    }
  ],
  "message": "success",
  "status": 200
}
```

## Content Segment Recommendation

### Content Segment Recommendation

**GET** `/api/content/recommend/segment/{segId}`

#### URL Parameters

- **segId** (required)
  id, or slug of the user segment to recommend content

#### Query Parameters

- **account_id** (optional)
  Your Lytics account ID.
- **contentsegment** (optional)
  id, or slug of a content-collection segment to filter content
- **limit** (optional)
  limit on number of documents to suggest/return
- **shuffle** (optional)
  whether or not to shuffle the recommendation order
- **rank** (optional)
  Ranking method for order of recommendations. Must be one of "popular", "recent", or "affinity"

#### Headers

- **Authorization** (optional)

#### Sample Response

```json
{
  "data": [
    {
      "url": "www.getlytics.com/blog/post/intent_through_content",
      "title": "Understanding User Intent Through Content",
      "description": "Customer Intent comes from understanding the connection between engagement and its contexts. Content modeling and affinity graphs makes interpretation of intent a lot easier. Learn how marketers can benefit from this.",
      "topics": [
        "customer data platform",
        "data science",
        "content marketing",
        "personalization"
      ],
      "topic_relevances": {
        "content marketing": 1,
        "customer data platform": 1,
        "data science": 1,
        "personalization": 1
      },
      "primary_image": "https://www.getlytics.com/img/blog/posts/intent_through_content/intent_through_content-bg.gif",
      "author": "",
      "created": "2016-06-08T16:11:45.599594093Z",
      "id": "-3435113786560588929",
      "sitename": "Lytics",
      "stream": "default",
      "path": [
        "blog",
        "blog/post",
        "blog/post/intent_through_content"
      ],
      "aspects": [
        "article"
      ],
      "language": "unknown",
      "updated": "2016-06-09T12:49:36.870359765Z",
      "fetched": "2016-06-09T12:49:35.812654441Z",
      "meta": [
        "og:locale/en_us",
        "og:site_name/lytics",
        "og:title/understanding user intent through content",
        "og:type/article",
        "og:url/https://www.getlytics.com/blog/post/intent_through_content"
      ],
      "confidence": 0.5916079783099615,
      "visited": true
    }
  ],
  "message": "success",
  "status": 200
}
```

## Public Content Recommendation

### Public Content Recommendation

**GET** `/api/content/recommend/{account}/user/{fieldname}/{fieldval}`

#### URL Parameters

- **account** (required)
  the account ID
- **fieldname** (required)
  field to use to identify a user
- **fieldval** (required)
  unique identity

#### Query Parameters

- **account_id** (optional)
  Your Lytics account ID.
- **contentsegment** (required)
  id, or slug of a content-collection to filter content
- **limit** (optional)
  limit on number of documents to suggest/return
- **shuffle** (optional)
  whether or not to shuffle the recommendation order
- **visited** (optional)
  whether to show recommendations for content the user has already viewed
- **topics** (optional)
  if supplied, only allow recommendations on content with the specified topics
- **rank** (optional)
  Ranking method for order of recommendations. Must be one of "popular", "recent", or "affinity"
- **wait** (optional)
  Whether or not to wait for more complex user identities to resolve
- **email** (optional)
  if the fieldname and fieldval are omitted, an email can be provided. This can be helpful for templating use-cases
- **url** (optional)
  if url is provided, the recommendations will be based on the content topics associated with the provided URL

#### Headers

- **Authorization** (optional)

#### Sample Response

```json
{
  "data": [
    {
      "url": "www.getlytics.com/blog/post/intent_through_content",
      "title": "Understanding User Intent Through Content",
      "description": "Customer Intent comes from understanding the connection between engagement and its contexts. Content modeling and affinity graphs makes interpretation of intent a lot easier. Learn how marketers can benefit from this.",
      "topics": [
        "customer data platform",
        "data science",
        "content marketing",
        "personalization"
      ],
      "topic_relevances": {
        "content marketing": 1,
        "customer data platform": 1,
        "data science": 1,
        "personalization": 1
      },
      "primary_image": "https://www.getlytics.com/img/blog/posts/intent_through_content/intent_through_content-bg.gif",
      "author": "",
      "created": "2016-06-08T16:11:45.599594093Z",
      "id": "-3435113786560588929",
      "sitename": "Lytics",
      "stream": "default",
      "path": [
        "blog",
        "blog/post",
        "blog/post/intent_through_content"
      ],
      "aspects": [
        "article"
      ],
      "language": "unknown",
      "updated": "2016-06-09T12:49:36.870359765Z",
      "fetched": "2016-06-09T12:49:35.812654441Z",
      "meta": [
        "og:locale/en_us",
        "og:site_name/lytics",
        "og:title/understanding user intent through content",
        "og:type/article",
        "og:url/https://www.getlytics.com/blog/post/intent_through_content"
      ],
      "confidence": 0.5916079783099615,
      "visited": true
    }
  ],
  "message": "success",
  "status": 200
}
```

## Content Taxonomy

### Content Taxonomy

**GET** `/api/content/taxonomy`

#### Query Parameters

- **account_id** (optional)
  Your Lytics account ID.
- **limit** (optional)
  number of topics to include in the topic graph, capped at 500 topics
- **budget** (optional)
  the depth at which any Monte Carlo simulation can traverse through the graph
- **iter** (optional)
  how many Monte Carlo simulations to run for each topic
- **raw** (optional)
  whether to generate the topic relationships from its Bayesian network
- **rawThreshold** (optional)
  when extracting relationships directly from the Bayesian network, the threshold at which to determine ties
- **cliques** (optional)
  whether to return a single graph or an array of disjoint subgraphs
- **cliqueThreshold** (optional)
  when returning cliques, the threshold at which to determine if two cliques should be connected

#### Headers

- **Authorization** (optional)

#### Sample Response

```json
{
  "data": {
    "n": 438,
    "nodes": [
      {
        "name": "marketing technology",
        "doc_count": 2
      },
      {
        "name": "AdWords",
        "doc_count": 1
      },
      {
        "name": "ad retargeting",
        "doc_count": 4
      },
      {
        "name": "analytics",
        "doc_count": 2
      },
      {
        "name": "customer service",
        "doc_count": 1
      },
      {
        "name": "data visualization",
        "doc_count": 2
      },
      {
        "name": "data-first marketing",
        "doc_count": 157
      },
      {
        "name": "personalization",
        "doc_count": 15
      }
    ],
    "links": [
      {
        "source": 66,
        "target": 54,
        "value": 0.375
      },
      {
        "source": 66,
        "target": 75,
        "value": 0.25
      },
      {
        "source": 66,
        "target": 37,
        "value": 0.25
      }
    ]
  },
  "message": "success",
  "status": 200
}
```

## Content Corpus

### Content Corpus

**POST** `/api/content/corpus`

Add a document to the content table corpus. Either a URL or text must be provided.

This allows entry of documents/content that get added to content

table, content-graph and available for usage in recommendation, as

well as content-explorer.

\* \*\*id\*\* if you upload the document more than once, ensure it has common id so only one document is created

\* \*\*Custom Attributes\*\* Any attributes you upload that are not reserved, will be added to content document.

\`\`sh

\# Upsert a document into content table and classify it

curl -s -XPOST "https://api.lytics.io/api/content/corpus" \\

\-H "Authorization: $LIOKEY" \\

\-H "Content-Type: application/json" \\

\-d '{

"id":"doc\_id\_123",

"text":"big-long-body-of text for classification",

"custom\_attribute\_name":"custom attribute"

}' | jq '.'

\# upsert a url into db

\# url is used as document id

curl -s -XPOST "https://api.lytics.io/api/content/corpus" \\

\-H "Authorization: $LIOKEY" \\

\-H "Content-Type: application/json" \\

\-d '{

"url":"http://www.validdomain/validurl.html",

"custom\_attribute\_name":"custom attribute"

}' | jq '.'

\`\`

#### Query Parameters

- **account_id** (optional)
  Your Lytics account ID.
- **url** (optional)
  the URL for identifying and retrieving content
- **text** (optional)
  the body of the content to be added
- **topics** (optional)
  custom topics to append to the document, in addition to topics that will be added with enrichment

#### Headers

- **Authorization** (optional)

#### Sample Response

```json
{
  "status": 200,
  "message": "success",
  "data": {
    "body": [
      "here is some body text"
    ],
    "source": [
      "upload"
    ],
    "updated": [
      "2016-09-13 21:59:38.551972802 -0400 EDT"
    ],
    "url": [
      "http://www.google.com/"
    ],
    "version": [
      "4"
    ]
  }
}
```

## Content Plot

### Content Plot

**GET** `/api/content/filter/topic`

#### Query Parameters

- **account_id** (optional)
  Your Lytics account ID.
- **segment_id** (optional)
- **fields** (optional)
- **filters** (optional)
- **limit** (optional)
  limit to the number of results supplied if a filter is supplied

#### Headers

- **Authorization** (optional)

#### Sample Response

```json
{
  "status": 200,
  "message": "success",
  "data": {
    "segment_id": "34a492e518b117228954e0bd8a7cfda7",
    "collections": [
      {
        "field": "int_score_momentum",
        "name": "do_more",
        "points": [
          {
            "topic": "guerrilla marketing",
            "value": 41.411764705882,
            "avg_affinity": 0.58597826180251,
            "doc_ct": 27
          }
        ]
      }
    ]
  }
}
```

## Topic Add

### Topic Add

**POST** `/api/content/doc/{docField}/{docId}/topic/{topicLabel}`

Add a topic to a Document.

#### URL Parameters

- **docField** (required)
  name of field to look up content by
- **docId** (required)
  value of field to look up content by
- **topicLabel** (required)
  name of topic to add

#### Query Parameters

- **account_id** (optional)
  Your Lytics account ID.
- **relevance** (optional)
  the relevance threshold to set for the new topic

#### Headers

- **Authorization** (optional)

#### Sample Response

```json
{
  "status": 200,
  "message": "success",
  "data": {
    "author": "Cookie Monster",
    "created": "2016-01-14T08:39:01.354824186-07:00",
    "description": "you should definitely make these cookies",
    "fetched": "2016-07-19T13:39:20.158747984-04:00",
    "id": "4525087172572165639",
    "meta": [
      "og:locale/en_US"
    ],
    "primary_image": "http://cookdiary.net/wp-content/uploads/images/Oatmeal-Chocolate-Chip-Cookies_1441.jpg",
    "stream": "default",
    "title": "how to make some cookies",
    "topic_relevances": {
      "Recipe": 0.64,
      "baking": 0.75
    },
    "topic_rollups": {
      "Things": 0.75
    },
    "topics": [
      "baking",
      "Recipe"
    ],
    "updated": "2016-07-19T13:34:18-04:00",
    "url": "www.recipes.com/chocolate-chip-cookies"
  }
}
```

## Topic Remove

### Topic Remove

**DELETE** `/api/content/doc/{docField}/{docId}/topic/{topicLabel}`

#### URL Parameters

- **docField** (required)
  name of field to look up content by
- **docId** (required)
  value of field to look up content by
- **topicLabel** (required)
  name of topic to add

#### Query Parameters

- **account_id** (optional)
  Your Lytics account ID.
- **relevance** (optional)
  the relevance threshold to set for the new topic

#### Headers

- **Authorization** (optional)

#### Sample Response

```json
No Content
```

## Content Crawl

### Content Crawl

**POST** `/api/content/crawl`

Create a new crawl for an account

#### Query Parameters

- **account_id** (optional)
  Your Lytics account ID.
- **domain** (optional)
  the domain to use for the seed of the crawl
- **domains** (optional)
  the domains to use for the seed of the crawl

#### Headers

- **Authorization** (optional)

#### Sample Response

```json
null
```

## Content Metrics

### Content Metrics

**GET** `/api/content/metrics`

Fetch the Account content Metrics.

#### Headers

- **Authorization** (optional)

#### Sample Response

```json
{
  "data": {
    "total": 215590,
    "nokeys": 0,
    "nocontent": 144430,
    "noclassifiedcontent": 53537,
    "noaffinities": 0,
    "errors": 0,
    "success": 17623
  },
  "message": "success",
  "status": 200
}
```

## Content Topic Clusters

### Content Topic Clusters

**GET** `/api/content/topic/cluster`

Get a collection of the most central topics in account's topic graph, with each topic's corresponding cluster. This endpoint is meant

to be used as a means to experiment with the limit, direction, penalty, and threshold parameters to create a set of clusters

that encompass meaningful topics and the coverage of topics that these clusters SUMMIZE in terms of relative centrality. Once values

for those parameters yield a set of optimal clusters, they should be sent to the topic clusters POST endpoint to create topic rollups.

#### Query Parameters

- **account_id** (optional)
  Your Lytics account ID.
- **limit** (optional)
  number of label rollups to produce
- **direction** (optional)
  direction to follow topic dependencies, either "in" or "out"
- **penalty** (optional)
  penalty to apply as traversal depth increases, where a lower value introduces a higher penalty
- **threshold** (optional)
  threshold at which neighbor topics are determined, where a lower value introduces a more lenient rule

#### Headers

- **Authorization** (optional)

#### Sample Response

```json
{
  "data": {
    "clusters": [
      [
        "Baking",
        "Cakes",
        "Cupakes",
        "Cookies"
      ],
      [
        "Grilling",
        "Beef",
        "Chicken",
        "Steak"
      ]
    ],
    "coverage": 0.2062
  },
  "message": "success",
  "status": 200
}
```

## Create Content Topic Clusters

### Create Content Topic Clusters

**POST** `/api/content/topic/cluster`

Create a collection of the most central topics in an account's topic grah, with each topic's corresponding cluster.

#### Query Parameters

- **account_id** (optional)
  Your Lytics account ID.
- **limit** (optional)
  number of label rollups to produce
- **direction** (optional)
  direction to follow topic dependencies, either "in" or "out"
- **penalty** (optional)
  penalty to apply as traversal depth increases, where a lower value introduces a higher penalty
- **threshold** (optional)
  threshold at which neighbor topics are determined, where a lower value introduces a more lenient rule

#### Headers

- **Authorization** (optional)

#### Sample Response

```json
{
  "data": {
    "clusters": [
      [
        "Baking",
        "Cakes",
        "Cupakes",
        "Cookies"
      ],
      [
        "Grilling",
        "Beef",
        "Chicken",
        "Steak"
      ]
    ],
    "coverage": 0.2062
  },
  "message": "success",
  "status": 200
}
```

## Content Topic Cluster

### Content Topic Cluster

**GET** `/api/content/topic/cluster/{topicId}`

Get topics that are related to an input topic.

This can be useful for creating topic rollups,

and provide initial suggestions as to which topics

might best comprise a rollup.

The options for direction, penalty and threshold

are currently adjustable. As we determine which

values produce the most useful clusters, we can set

better defaults for them.

#### URL Parameters

- **topicId** (required)
  public topic label in the taxonomy

#### Query Parameters

- **account_id** (optional)
  Your Lytics account ID.
- **direction** (optional)
  direction to follow topic dependencies, either "in" or "out"
- **penalty** (optional)
  penalty to apply as traversal depth increases, where a lower value introduces a higher penalty
- **threshold** (optional)
  threshold at which neighbor topics are determined, where a lower value introduces a more lenient rule

#### Headers

- **Authorization** (optional)

#### Sample Response

```json
{
  "data": {
    "clusters": [
      [
        "Baking",
        "Cakes",
        "Cupakes",
        "Cookies"
      ],
      [
        "Grilling",
        "Beef",
        "Chicken",
        "Steak"
      ]
    ],
    "coverage": 0.2062
  },
  "message": "success",
  "status": 200
}
```