ingestMoments
# ingestMoments
POST
/ingest
const url = 'http://localhost:8080/api/v1/ingest';const options = { method: 'POST', headers: { cookie: 'hs_session=<hs_session>', 'Idempotency-Key': 'example', 'Content-Type': 'application/json' }, body: '{"account":{"id":"per_01j9x3k8m2q4r5s6t7v8w9y0z1"},"taskId":"per_01j9x3k8m2q4r5s6t7v8w9y0z1","items":[{"platformItemId":"example","kind":"story","text":"example","lang":"example","url":"https://example.com","publishedAt":"2026-04-15T12:00:00Z","expiresAt":"2026-04-15T12:00:00Z","media":[{"mediaId":"per_01j9x3k8m2q4r5s6t7v8w9y0z1","url":"https://example.com","mime":"example","width":1,"height":1,"durationMs":1,"posterMediaId":"per_01j9x3k8m2q4r5s6t7v8w9y0z1","posterUrl":"https://example.com","alt":"example"}]}]}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url http://localhost:8080/api/v1/ingest \ --header 'Content-Type: application/json' \ --header 'Idempotency-Key: example' \ --cookie hs_session=<hs_session> \ --data '{ "account": { "id": "per_01j9x3k8m2q4r5s6t7v8w9y0z1" }, "taskId": "per_01j9x3k8m2q4r5s6t7v8w9y0z1", "items": [ { "platformItemId": "example", "kind": "story", "text": "example", "lang": "example", "url": "https://example.com", "publishedAt": "2026-04-15T12:00:00Z", "expiresAt": "2026-04-15T12:00:00Z", "media": [ { "mediaId": "per_01j9x3k8m2q4r5s6t7v8w9y0z1", "url": "https://example.com", "mime": "example", "width": 1, "height": 1, "durationMs": 1, "posterMediaId": "per_01j9x3k8m2q4r5s6t7v8w9y0z1", "posterUrl": "https://example.com", "alt": "example" } ] } ] }'Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Header Parameters
Section titled “Header Parameters”Idempotency-Key
required
string
Request Bodyrequired
Section titled “Request Bodyrequired”Media typeapplication/json
object
account
required
taskId
string
items
required
Array<object>
object
platformItemId
required
string
kind
required
string
text
Plain text. HTML is stripped.
string
lang
string
url
required
string format: uri
publishedAt
required
string format: date-time
expiresAt
string format: date-time
media
Array<object>
One of:
Give either mediaId (uploaded first) or url (platform CDN host on the allow-list).
object
mediaId
required
string
url
string format: uri
mime
string
width
integer
height
integer
durationMs
integer
posterMediaId
string
posterUrl
string format: uri
alt
string
Give either mediaId (uploaded first) or url (platform CDN host on the allow-list).
object
mediaId
string
url
required
string format: uri
mime
string
width
integer
height
integer
durationMs
integer
posterMediaId
string
posterUrl
string format: uri
alt
string
Responses
Section titled “Responses”Per-item results. Valid items are stored even if some are rejected.
Media typeapplication/json
object
batchId
required
string
accepted
required
integer
duplicates
required
integer
rejected
required
Array<object>
object
index
required
integer
code
required
string
momentIds
required
Array<string>
Examples
Exampleseed
Derived from fixtures/seed.json.
{ "accepted": 2, "batchId": "bat_01j9a1b2c3d4e5f6g7h8j9k02g", "duplicates": 1, "momentIds": [ "mom_01j9adj9t141gzfk8s7x1yyg4j", "mom_01j991j97j1nk24fm0mgptj50b" ], "rejected": [ { "code": "media_host_not_allowed", "index": 2 } ]}Invalid request.
Media typeapplication/problem+json
object
type
required
string format: uri
title
required
string
status
required
integer
code
required
string
i18nKey
string
detail
string
fields
Array<object>
object
path
required
string
code
required
string
i18nKey
string
Example generated
{ "type": "https://example.com", "title": "example", "status": 1, "code": "example", "i18nKey": "example", "detail": "example", "fields": [ { "path": "example", "code": "example", "i18nKey": "example" } ]}Not found.
Media typeapplication/problem+json
object
type
required
string format: uri
title
required
string
status
required
integer
code
required
string
i18nKey
string
detail
string
fields
Array<object>
object
path
required
string
code
required
string
i18nKey
string
Example generated
{ "type": "https://example.com", "title": "example", "status": 1, "code": "example", "i18nKey": "example", "detail": "example", "fields": [ { "path": "example", "code": "example", "i18nKey": "example" } ]}Conflicts with current state.
Media typeapplication/problem+json
object
type
required
string format: uri
title
required
string
status
required
integer
code
required
string
i18nKey
string
detail
string
fields
Array<object>
object
path
required
string
code
required
string
i18nKey
string
Example generated
{ "type": "https://example.com", "title": "example", "status": 1, "code": "example", "i18nKey": "example", "detail": "example", "fields": [ { "path": "example", "code": "example", "i18nKey": "example" } ]}