---
title: "Content Corpus"
method: POST
path: "/api/content/corpus"
tags: ["Content"]
---

# Content Corpus

`POST /api/content/corpus`

## Request

- Base URL: `https://api.lytics.io`
- URL: `https://api.lytics.io/api/content/corpus`
- Auth: API key in header `Authorization`

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` string
- `url` string
- `text` string
- `topics` string

## Response `200`

OK

- ContentCorpusModel
  - `status` number
  - `message` string
  - `data` object
    - `body` string[]
    - `source` string[]
    - `updated` string[]
    - `url` string[]
    - `version` string[]

---

[API](https://skmtc.dev/lytics/apis/v1-lytics-api.md) - [All operations](https://skmtc.dev/lytics/apis/v1-lytics-api/llms.txt) - [OpenAPI document](https://skmtc.dev/lytics/apis/v1-lytics-api/revisions/339fd1d88486?raw)
