Create item
curl --request POST \
--url https://api.thehaystack.ai/v2/haystack/items/create \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"title": "<string>",
"date": "2023-11-07T05:31:56Z",
"collectionId": 123,
"speakers": [
{
"id": 123
}
],
"subTitle": "<string>",
"description": "<string>",
"shortDescription": "<string>",
"seriesId": 123,
"orderInSeries": 123,
"urlSlug": "<string>",
"topics": [
{
"id": 123
}
],
"autoAcceptScriptures": true,
"autoAcceptMediaChapters": true,
"autoPublish": true,
"wizardStep": "<string>"
}
'import requests
url = "https://api.thehaystack.ai/v2/haystack/items/create"
payload = {
"title": "<string>",
"date": "2023-11-07T05:31:56Z",
"collectionId": 123,
"speakers": [{ "id": 123 }],
"subTitle": "<string>",
"description": "<string>",
"shortDescription": "<string>",
"seriesId": 123,
"orderInSeries": 123,
"urlSlug": "<string>",
"topics": [{ "id": 123 }],
"autoAcceptScriptures": True,
"autoAcceptMediaChapters": True,
"autoPublish": True,
"wizardStep": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
title: '<string>',
date: '2023-11-07T05:31:56Z',
collectionId: 123,
speakers: [{id: 123}],
subTitle: '<string>',
description: '<string>',
shortDescription: '<string>',
seriesId: 123,
orderInSeries: 123,
urlSlug: '<string>',
topics: [{id: 123}],
autoAcceptScriptures: true,
autoAcceptMediaChapters: true,
autoPublish: true,
wizardStep: '<string>'
})
};
fetch('https://api.thehaystack.ai/v2/haystack/items/create', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.thehaystack.ai/v2/haystack/items/create",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'title' => '<string>',
'date' => '2023-11-07T05:31:56Z',
'collectionId' => 123,
'speakers' => [
[
'id' => 123
]
],
'subTitle' => '<string>',
'description' => '<string>',
'shortDescription' => '<string>',
'seriesId' => 123,
'orderInSeries' => 123,
'urlSlug' => '<string>',
'topics' => [
[
'id' => 123
]
],
'autoAcceptScriptures' => true,
'autoAcceptMediaChapters' => true,
'autoPublish' => true,
'wizardStep' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.thehaystack.ai/v2/haystack/items/create"
payload := strings.NewReader("{\n \"title\": \"<string>\",\n \"date\": \"2023-11-07T05:31:56Z\",\n \"collectionId\": 123,\n \"speakers\": [\n {\n \"id\": 123\n }\n ],\n \"subTitle\": \"<string>\",\n \"description\": \"<string>\",\n \"shortDescription\": \"<string>\",\n \"seriesId\": 123,\n \"orderInSeries\": 123,\n \"urlSlug\": \"<string>\",\n \"topics\": [\n {\n \"id\": 123\n }\n ],\n \"autoAcceptScriptures\": true,\n \"autoAcceptMediaChapters\": true,\n \"autoPublish\": true,\n \"wizardStep\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.thehaystack.ai/v2/haystack/items/create")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"title\": \"<string>\",\n \"date\": \"2023-11-07T05:31:56Z\",\n \"collectionId\": 123,\n \"speakers\": [\n {\n \"id\": 123\n }\n ],\n \"subTitle\": \"<string>\",\n \"description\": \"<string>\",\n \"shortDescription\": \"<string>\",\n \"seriesId\": 123,\n \"orderInSeries\": 123,\n \"urlSlug\": \"<string>\",\n \"topics\": [\n {\n \"id\": 123\n }\n ],\n \"autoAcceptScriptures\": true,\n \"autoAcceptMediaChapters\": true,\n \"autoPublish\": true,\n \"wizardStep\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.thehaystack.ai/v2/haystack/items/create")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"title\": \"<string>\",\n \"date\": \"2023-11-07T05:31:56Z\",\n \"collectionId\": 123,\n \"speakers\": [\n {\n \"id\": 123\n }\n ],\n \"subTitle\": \"<string>\",\n \"description\": \"<string>\",\n \"shortDescription\": \"<string>\",\n \"seriesId\": 123,\n \"orderInSeries\": 123,\n \"urlSlug\": \"<string>\",\n \"topics\": [\n {\n \"id\": 123\n }\n ],\n \"autoAcceptScriptures\": true,\n \"autoAcceptMediaChapters\": true,\n \"autoPublish\": true,\n \"wizardStep\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"item": {
"id": 123,
"title": "The Power of Prayer",
"subTitle": "<string>",
"description": "<string>",
"shortDescription": "<string>",
"date": "2025-01-15",
"collectionId": 123,
"seriesId": 123,
"orderInSeries": 123,
"urlSlug": "<string>",
"durationSecs": 123,
"publishedDate": "2023-11-07T05:31:56Z",
"autoPublish": true,
"squareImgUrl": "<string>",
"wideImgUrl": "<string>",
"ultraWideImgUrl": "<string>",
"verticalImgUrl": "<string>",
"entryDate": "2023-11-07T05:31:56Z",
"collection": {
"id": 1,
"name": "Sunday Sermons",
"fullService": false,
"variantTypes": [
{
"id": 123,
"name": "Sermon Video",
"indexable": true,
"displayOrder": 123,
"collectionId": 123
}
]
},
"series": {
"id": 123,
"title": "The Gospel of John",
"subTitle": "<string>",
"collectionId": 123,
"description": "<string>",
"shortDescription": "<string>",
"sortOrder": 123,
"itemSortDirection": "DESC",
"showItemOrderInSeries": true,
"urlSlug": "<string>",
"colorHex": "#FF5733",
"squareImgUrl": "<string>",
"wideImgUrl": "<string>",
"ultraWideImgUrl": "<string>",
"published": true,
"verticalImgUrl": "<string>",
"squareImgMetadata": {},
"wideImgMetadata": {},
"ultraWideImgMetadata": {},
"verticalImgMetadata": {},
"items": "<array>",
"collection": {
"id": 1,
"name": "Sunday Sermons",
"fullService": false,
"variantTypes": [
{
"id": 123,
"name": "Sermon Video",
"indexable": true,
"displayOrder": 123,
"collectionId": 123
}
]
}
},
"speakers": [
{
"id": 123,
"name": "Pastor John Smith",
"bio": "<string>",
"imageUrl": "<string>",
"imageFilename": "<string>",
"itemCount": 123
}
],
"scriptures": [
{
"id": 123,
"itemId": 123,
"book": "<string>",
"bookName": "Matthew",
"chapter": 123,
"verseStart": 123,
"verseEnd": 123,
"keyVerse": true,
"suggested": true,
"accepted": true,
"displayOrder": 123,
"citation": "Matthew 5:1-12",
"hidden": true
}
],
"mediaAssets": [
{
"id": 123,
"itemId": 123,
"item": "<unknown>",
"mimeType": "<string>",
"variantTypeId": 123,
"variantType": {
"id": 123,
"name": "Sermon Video",
"indexable": true,
"displayOrder": 123,
"collectionId": 123
},
"fileSizeBytes": 123,
"durationSecs": 123,
"bitrate": 123,
"videoWidth": 123,
"videoHeight": 123,
"filename": "<string>",
"originalFilename": "<string>",
"externalPlatformId": "<string>",
"muxAssetId": "<string>",
"muxPlaybackId": "<string>",
"url": "<string>",
"downloadUrl": "<string>",
"chapters": [
{
"id": 123,
"itemId": 123,
"mediaAssetId": 123,
"title": "Introduction",
"startMs": 123,
"suggested": true,
"accepted": true,
"hidden": true
}
],
"entryDate": "2023-11-07T05:31:56Z"
}
],
"resources": [
{
"id": 123,
"itemId": 123,
"title": "<string>",
"subTitle": "<string>",
"description": "<string>",
"resourceTypeId": 123,
"displayOrder": 123,
"fileMimeType": "<string>",
"fileSizeBytes": 123,
"externalPlatformId": "<string>",
"thumbnailImgUrl": "<string>",
"url": "<string>",
"resourceType": {
"id": 123,
"name": "<string>"
},
"linkTarget": "<string>"
}
],
"suggestedDescription": "<string>",
"suggestedShortDescription": "<string>",
"errorMessage": "<string>",
"indexedMediaAssetId": 123,
"autoAcceptScriptures": true,
"autoAcceptMediaChapters": true,
"transcriptUrl": "<string>",
"topics": [
{
"id": 123,
"name": "<string>",
"itemCount": 123
}
],
"squareImgMetadata": {},
"wideImgMetadata": {},
"ultraWideImgMetadata": {},
"verticalImgMetadata": {}
}
}Items
Create Item
Create a new content item
POST
/
items
/
create
Create item
curl --request POST \
--url https://api.thehaystack.ai/v2/haystack/items/create \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"title": "<string>",
"date": "2023-11-07T05:31:56Z",
"collectionId": 123,
"speakers": [
{
"id": 123
}
],
"subTitle": "<string>",
"description": "<string>",
"shortDescription": "<string>",
"seriesId": 123,
"orderInSeries": 123,
"urlSlug": "<string>",
"topics": [
{
"id": 123
}
],
"autoAcceptScriptures": true,
"autoAcceptMediaChapters": true,
"autoPublish": true,
"wizardStep": "<string>"
}
'import requests
url = "https://api.thehaystack.ai/v2/haystack/items/create"
payload = {
"title": "<string>",
"date": "2023-11-07T05:31:56Z",
"collectionId": 123,
"speakers": [{ "id": 123 }],
"subTitle": "<string>",
"description": "<string>",
"shortDescription": "<string>",
"seriesId": 123,
"orderInSeries": 123,
"urlSlug": "<string>",
"topics": [{ "id": 123 }],
"autoAcceptScriptures": True,
"autoAcceptMediaChapters": True,
"autoPublish": True,
"wizardStep": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
title: '<string>',
date: '2023-11-07T05:31:56Z',
collectionId: 123,
speakers: [{id: 123}],
subTitle: '<string>',
description: '<string>',
shortDescription: '<string>',
seriesId: 123,
orderInSeries: 123,
urlSlug: '<string>',
topics: [{id: 123}],
autoAcceptScriptures: true,
autoAcceptMediaChapters: true,
autoPublish: true,
wizardStep: '<string>'
})
};
fetch('https://api.thehaystack.ai/v2/haystack/items/create', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.thehaystack.ai/v2/haystack/items/create",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'title' => '<string>',
'date' => '2023-11-07T05:31:56Z',
'collectionId' => 123,
'speakers' => [
[
'id' => 123
]
],
'subTitle' => '<string>',
'description' => '<string>',
'shortDescription' => '<string>',
'seriesId' => 123,
'orderInSeries' => 123,
'urlSlug' => '<string>',
'topics' => [
[
'id' => 123
]
],
'autoAcceptScriptures' => true,
'autoAcceptMediaChapters' => true,
'autoPublish' => true,
'wizardStep' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.thehaystack.ai/v2/haystack/items/create"
payload := strings.NewReader("{\n \"title\": \"<string>\",\n \"date\": \"2023-11-07T05:31:56Z\",\n \"collectionId\": 123,\n \"speakers\": [\n {\n \"id\": 123\n }\n ],\n \"subTitle\": \"<string>\",\n \"description\": \"<string>\",\n \"shortDescription\": \"<string>\",\n \"seriesId\": 123,\n \"orderInSeries\": 123,\n \"urlSlug\": \"<string>\",\n \"topics\": [\n {\n \"id\": 123\n }\n ],\n \"autoAcceptScriptures\": true,\n \"autoAcceptMediaChapters\": true,\n \"autoPublish\": true,\n \"wizardStep\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.thehaystack.ai/v2/haystack/items/create")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"title\": \"<string>\",\n \"date\": \"2023-11-07T05:31:56Z\",\n \"collectionId\": 123,\n \"speakers\": [\n {\n \"id\": 123\n }\n ],\n \"subTitle\": \"<string>\",\n \"description\": \"<string>\",\n \"shortDescription\": \"<string>\",\n \"seriesId\": 123,\n \"orderInSeries\": 123,\n \"urlSlug\": \"<string>\",\n \"topics\": [\n {\n \"id\": 123\n }\n ],\n \"autoAcceptScriptures\": true,\n \"autoAcceptMediaChapters\": true,\n \"autoPublish\": true,\n \"wizardStep\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.thehaystack.ai/v2/haystack/items/create")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"title\": \"<string>\",\n \"date\": \"2023-11-07T05:31:56Z\",\n \"collectionId\": 123,\n \"speakers\": [\n {\n \"id\": 123\n }\n ],\n \"subTitle\": \"<string>\",\n \"description\": \"<string>\",\n \"shortDescription\": \"<string>\",\n \"seriesId\": 123,\n \"orderInSeries\": 123,\n \"urlSlug\": \"<string>\",\n \"topics\": [\n {\n \"id\": 123\n }\n ],\n \"autoAcceptScriptures\": true,\n \"autoAcceptMediaChapters\": true,\n \"autoPublish\": true,\n \"wizardStep\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"item": {
"id": 123,
"title": "The Power of Prayer",
"subTitle": "<string>",
"description": "<string>",
"shortDescription": "<string>",
"date": "2025-01-15",
"collectionId": 123,
"seriesId": 123,
"orderInSeries": 123,
"urlSlug": "<string>",
"durationSecs": 123,
"publishedDate": "2023-11-07T05:31:56Z",
"autoPublish": true,
"squareImgUrl": "<string>",
"wideImgUrl": "<string>",
"ultraWideImgUrl": "<string>",
"verticalImgUrl": "<string>",
"entryDate": "2023-11-07T05:31:56Z",
"collection": {
"id": 1,
"name": "Sunday Sermons",
"fullService": false,
"variantTypes": [
{
"id": 123,
"name": "Sermon Video",
"indexable": true,
"displayOrder": 123,
"collectionId": 123
}
]
},
"series": {
"id": 123,
"title": "The Gospel of John",
"subTitle": "<string>",
"collectionId": 123,
"description": "<string>",
"shortDescription": "<string>",
"sortOrder": 123,
"itemSortDirection": "DESC",
"showItemOrderInSeries": true,
"urlSlug": "<string>",
"colorHex": "#FF5733",
"squareImgUrl": "<string>",
"wideImgUrl": "<string>",
"ultraWideImgUrl": "<string>",
"published": true,
"verticalImgUrl": "<string>",
"squareImgMetadata": {},
"wideImgMetadata": {},
"ultraWideImgMetadata": {},
"verticalImgMetadata": {},
"items": "<array>",
"collection": {
"id": 1,
"name": "Sunday Sermons",
"fullService": false,
"variantTypes": [
{
"id": 123,
"name": "Sermon Video",
"indexable": true,
"displayOrder": 123,
"collectionId": 123
}
]
}
},
"speakers": [
{
"id": 123,
"name": "Pastor John Smith",
"bio": "<string>",
"imageUrl": "<string>",
"imageFilename": "<string>",
"itemCount": 123
}
],
"scriptures": [
{
"id": 123,
"itemId": 123,
"book": "<string>",
"bookName": "Matthew",
"chapter": 123,
"verseStart": 123,
"verseEnd": 123,
"keyVerse": true,
"suggested": true,
"accepted": true,
"displayOrder": 123,
"citation": "Matthew 5:1-12",
"hidden": true
}
],
"mediaAssets": [
{
"id": 123,
"itemId": 123,
"item": "<unknown>",
"mimeType": "<string>",
"variantTypeId": 123,
"variantType": {
"id": 123,
"name": "Sermon Video",
"indexable": true,
"displayOrder": 123,
"collectionId": 123
},
"fileSizeBytes": 123,
"durationSecs": 123,
"bitrate": 123,
"videoWidth": 123,
"videoHeight": 123,
"filename": "<string>",
"originalFilename": "<string>",
"externalPlatformId": "<string>",
"muxAssetId": "<string>",
"muxPlaybackId": "<string>",
"url": "<string>",
"downloadUrl": "<string>",
"chapters": [
{
"id": 123,
"itemId": 123,
"mediaAssetId": 123,
"title": "Introduction",
"startMs": 123,
"suggested": true,
"accepted": true,
"hidden": true
}
],
"entryDate": "2023-11-07T05:31:56Z"
}
],
"resources": [
{
"id": 123,
"itemId": 123,
"title": "<string>",
"subTitle": "<string>",
"description": "<string>",
"resourceTypeId": 123,
"displayOrder": 123,
"fileMimeType": "<string>",
"fileSizeBytes": 123,
"externalPlatformId": "<string>",
"thumbnailImgUrl": "<string>",
"url": "<string>",
"resourceType": {
"id": 123,
"name": "<string>"
},
"linkTarget": "<string>"
}
],
"suggestedDescription": "<string>",
"suggestedShortDescription": "<string>",
"errorMessage": "<string>",
"indexedMediaAssetId": 123,
"autoAcceptScriptures": true,
"autoAcceptMediaChapters": true,
"transcriptUrl": "<string>",
"topics": [
{
"id": 123,
"name": "<string>",
"itemCount": 123
}
],
"squareImgMetadata": {},
"wideImgMetadata": {},
"ultraWideImgMetadata": {},
"verticalImgMetadata": {}
}
}Authorizations
Enter your API token from the Haystack dashboard
Body
application/json
At least one speaker is required
Minimum array length:
1Show child attributes
Show child attributes
Auto-generated from title if omitted
Show child attributes
Show child attributes
Used during guided item creation
Response
200 - application/json
Item created
Show child attributes
Show child attributes
⌘I

