Lists all the document templates you have in your account.
Pass your API Key as a Bearer Token.
The query parameters for this endpoint control what page of template documents you want to see.
Name | Description | Example Value |
---|---|---|
p | Page | 1 |
This endpoint has no request body paramters.
Command Line (curl)
curl -H "Authorization: Bearer <YOUR_API_KEY>" -H "Accept: application/json" "https://nichesss.com/api/documents/templates"
JavaScript
fetch('https://nichesss.com/api/documents/templates', {
method: 'GET',
headers: {
'Content-type': 'application/json',
'Authorization': 'Bearer <YOUR_API_KEY>', // notice the Bearer before your token
}
})
.then((response) => response.json())
.then((data) => console.log(data));
Python
import requests
url = 'https://nichesss.com/api/documents/templates'
headers = {
'Content-type': 'application/json',
'Authorization': 'Bearer <YOUR_API_KEY>',
}
response = requests.get(url, headers=headers)
data = response.json()
print(data)
PHP
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://nichesss.com/api/documents/templates');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');
$headers = array();
$headers[] = 'Content-Type: application/json';
$headers[] = 'Authorization: Bearer <YOUR_API_KEY>';
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$result = curl_exec($ch);
if (curl_errno($ch)) {
echo 'Error:' . curl_error($ch);
}
curl_close ($ch);
$data = json_decode($result, true);
print_r($data);
Ruby
require 'net/http'
require 'json'
uri = URI('https://nichesss.com/api/documents/templates')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
request = Net::HTTP::Get.new(uri.request_uri)
request['Content-type'] = 'application/json'
request['Authorization'] = 'Bearer <YOUR_API_KEY>'
response = http.request(request)
puts JSON.parse(response.body)
All responses from the API are JSON
{
"success": true,
"templates": [
{
"name": "Blog Template",
"description": "A simple template for a blog post.",
"updated": 1666293761,
"no_lines": 10,
"template": "[{{TOPIC}} | intro]\n[{{TOPIC}} | blog_outline ]\n[ write about {{OUTLINE_ITEM_1}} ]\n[ talk about {{OUTLINE_ITEM_2}} ]\n[ talk about {{OUTLINE_ITEM_3}} ]\n[ {{OUTLINE_ITEM_1}}, {{OUTLINE_ITEM_2}}, and {{OUTLINE_ITEM_3}} | conclusion ]",
"id": "e1fQQFAPP",
"variables": [
"TOPIC",
"OUTLINE_ITEM_1",
"OUTLINE_ITEM_2",
"OUTLINE_ITEM_3"
]
},
... more templates ...
],
"page": 1,
"total": 31,
"total_pages": 2,
"has_more": true,
"next_uri": "https://nichesss.com/api/documents/templates?p=2"
}