Skip to content
Letterhead Letterhead Letterhead Help Center
Admin Tools

Create a data feed

POST
/api/v3/curations/data-feeds
curl --request POST \
--url 'https://api.tryletterhead.com/api/v3/curations/data-feeds?api=true' \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "title": "Vendor product catalog", "description": "Nightly product export from our commerce platform.", "feedUrl": "https://example.com/api/products.json", "archiveIntervalDays": 1, "authType": 0, "fieldMappings": [ { "source": "object.name", "target": "title" }, { "source": "object.description", "target": "excerpt" }, { "source": "object.url", "target": "url" } ] }'

Create a company-level JSON data feed: a JSON endpoint plus a set of field mappings that turn each item it returns into a curation. Letterhead fetches it immediately after creation.

Every entry in fieldMappings needs a source (a dot path into a feed itemโ€™s JSON, e.g. object.id) and a target โ€” either a standard curation field (title, excerpt, content, url, image, imageAlt, imageCaption, author, siteName, publicationDate) or a custom field reference in the form customField:<key> (see List curation custom fields). url, title, and excerpt must all be mapped.

api
required
boolean

Required. Set to true to authenticate with your company API key rather than a signed-in session.

Media type application/json
object
title
required
string
<= 140 characters
description
required
string
<= 280 characters
feedUrl
required
string
archiveIntervalDays
required

How often, in days, to re-fetch the feed (1โ€“31).

integer
tags
Array<string>
channels

Internal numeric channel identifiers to share this feed with.

Array<integer>
fieldMappings
required
Array<object>
>= 1 items
object
source
required
string
target
required
string
authType
required

0 โ€” no authentication. 1 โ€” bearer token, supplied via bearerToken.

integer
bearerToken

Plaintext on the way in, stored encrypted. Required when authType is 1.

string
Example
{
"title": "Vendor product catalog",
"description": "Nightly product export from our commerce platform.",
"feedUrl": "https://example.com/api/products.json",
"archiveIntervalDays": 1,
"authType": 0,
"fieldMappings": [
{
"source": "object.name",
"target": "title"
},
{
"source": "object.description",
"target": "excerpt"
},
{
"source": "object.url",
"target": "url"
}
]
}

Data feed created

Media type application/json
object
items

The shape returned for both RSS feeds (List curation feeds) and JSON data feeds (List data feeds) โ€” type (0 RSS, 1 JSON data feed) tells the two apart. fieldMappings, authType, and hasAuthSecret are only meaningful on a JSON data feed.

object
uniqueId
string
title
string
description
string
feedUrl
string
type

0 RSS feed, 1 JSON data feed.

integer
isValid
boolean
validationCode
integer
nullable
crawl
boolean
archiveIntervalDays
integer
lastValidated
string
lastQueried
string
channelName

The channel this feed was originally created against, or blank for a feed shared to multiple channels with no single owner.

string
channelSlug
string
sharedChannelIds

Internal numeric identifiers of every channel this feed is shared with.

Array<integer>
tags
Array<string>
authType

0 โ€” no authentication. 1 โ€” bearer token.

integer
hasAuthSecret

Whether a credential is stored โ€” the credential itself is never returned.

boolean
fieldMappings
Array<object>
object
source
string
target
string
createdAt
string
updatedAt
string
deletedAt
string
nullable
message
string
total
integer
Example generated
{
"items": {
"uniqueId": "example",
"title": "example",
"description": "example",
"feedUrl": "example",
"type": 1,
"isValid": true,
"validationCode": 1,
"crawl": true,
"archiveIntervalDays": 1,
"lastValidated": "example",
"lastQueried": "example",
"channelName": "example",
"channelSlug": "example",
"sharedChannelIds": [
1
],
"tags": [
"example"
],
"authType": 1,
"hasAuthSecret": true,
"fieldMappings": [
{
"source": "example",
"target": "example"
}
],
"createdAt": "example",
"updatedAt": "example",
"deletedAt": "example"
},
"message": "example",
"total": 1
}

Still can’t find what you need? Contact support.