Facebook Pixel

Create Document Using Template

Creates a document using a template

Endpoint

POSThttps://nichesss.com/api/documents/push-to-queue

Generations *

This endpoint consumes at least one, potentially many generations each time it is called, depending on how many tools the template calls.

Call /api/generations or visit the API Dashboard to see how many generation credits you have.

Authorization 🔒

Pass your API Key as a Bearer Token.

Request Query Parameters

This endpoint has no request query parameters.

Request Body Parameters

The request body for this endpoint is a JSON payload with the following keys:

Key Description Type Example
template_idID of Template, see /api/documents/templatesrequiredString"nSw3cz9E3"
...All the required variables of the templaterequiredMixedGet the required fields from /api/documents/templates endpoint
webhook_urlURL of Webhook, POST request is sent after text is generatedString"https://a-cool-webhook.com"
languageObject containing id and formality of language your want your copy to be in.
Defaults to English if left empty.
Object
language.idID of language, see /api/languages
Defaults to English if left empty.
String"deepl_PT-BR"
language.formalityFormalness of text, only works with select languages and DeepL.
Acceptable values are "more", "less", or "default".
String"more"

Here's an example of the body parameters represented as a JSON object.

{
    "template_id": "nSw3cz9E3",
    "title": "The Beauty of Jamaica",
    "about": "The beautiful things Jamaica has to offer for tourists and locals.",
    "TOPIC": "Swimming and other activities in Jamaica",
    "OUTLINE_ITEM_1": "Jamaica's beaches",
    "OUTLINE_ITEM_2": "Jamaica's nature trails",
    "OUTLINE_ITEM_3": "Jamaica's waterfalls and hiking trails",
    "webhook_url": "https://a-cool-webhook.com",
    "language": {
        "id": "deepl_PT-BR",
        "formality": "more"
    }
}

Example API calls

Command Line (curl)

curl -X POST "https://nichesss.com/api/documents/push-to-queue" -H "Content-type: application/json" -H "Authorization: Bearer <YOUR_API_KEY>" -d "{\"template_id\":\"nSw3cz9E3\",\"title\":\"The Beauty of Jamaica\",\"about\":\"The beautiful things Jamaica has to offer for tourists and locals.\",\"TOPIC\":\"Swimming and other activities in Jamaica\",\"OUTLINE_ITEM_1\":\"Jamaica's beaches\",\"OUTLINE_ITEM_2\":\"Jamaica's nature trails\",\"OUTLINE_ITEM_3\":\"Jamaica's waterfalls and hiking trails\",\"webhook_url\":\"https://a-cool-webhook.com\",\"language\":{\"id\":\"deepl_PT-BR\",\"formality\":\"more\"}}"

JavaScript

fetch('https://nichesss.com/api/documents/push-to-queue', {
    method: 'POST',
    headers: {
        'Content-type': 'application/json',
        'Authorization': 'Bearer <YOUR_API_KEY>',
    },
    body: JSON.stringify({"template_id":"nSw3cz9E3","title":"The Beauty of Jamaica","about":"The beautiful things Jamaica has to offer for tourists and locals.","TOPIC":"Swimming and other activities in Jamaica","OUTLINE_ITEM_1":"Jamaica's beaches","OUTLINE_ITEM_2":"Jamaica's nature trails","OUTLINE_ITEM_3":"Jamaica's waterfalls and hiking trails","webhook_url":"https://a-cool-webhook.com","language":{"id":"deepl_PT-BR","formality":"more"}})
})
.then((response) => response.json())
.then((data) => console.log(data));

Python

import requests

url = 'https://nichesss.com/api/documents/push-to-queue'
payload = {"template_id":"nSw3cz9E3","title":"The Beauty of Jamaica","about":"The beautiful things Jamaica has to offer for tourists and locals.","TOPIC":"Swimming and other activities in Jamaica","OUTLINE_ITEM_1":"Jamaica's beaches","OUTLINE_ITEM_2":"Jamaica's nature trails","OUTLINE_ITEM_3":"Jamaica's waterfalls and hiking trails","webhook_url":"https://a-cool-webhook.com","language":{"id":"deepl_PT-BR","formality":"more"}}
headers = {'Content-type': 'application/json', 'Authorization': 'Bearer <YOUR_API_KEY>'}

response = requests.post(url, json=payload, headers=headers)
data = response.json()

print(data)

PHP

$api_key = '<YOUR_API_KEY>';
$request_url = 'https://nichesss.com/api/documents/push-to-queue';

$request_options = array(
    'http' => array(
        'method' => 'POST',
        'header' => 'Content-type: application/json' . "\r\n" .
                    'Authorization: Bearer ' . $api_key . "\r\n",
        'content' => '{"template_id":"nSw3cz9E3","title":"The Beauty of Jamaica","about":"The beautiful things Jamaica has to offer for tourists and locals.","TOPIC":"Swimming and other activities in Jamaica","OUTLINE_ITEM_1":"Jamaica's beaches","OUTLINE_ITEM_2":"Jamaica's nature trails","OUTLINE_ITEM_3":"Jamaica's waterfalls and hiking trails","webhook_url":"https://a-cool-webhook.com","language":{"id":"deepl_PT-BR","formality":"more"}}'
    )
);

$request_context = stream_context_create($request_options);
$request_result = file_get_contents($request_url, false, $request_context);
$data = json_decode($request_result);

echo $data;

Ruby

require 'net/http'
require 'json'

uri = URI('https://nichesss.com/api/documents/push-to-queue')

http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true

request = Net::HTTP::Post.new(uri.request_uri)
request['Content-type'] = 'application/json'
request['Authorization'] = 'Bearer <YOUR_API_KEY>'
request.body = {"template_id":"nSw3cz9E3","title":"The Beauty of Jamaica","about":"The beautiful things Jamaica has to offer for tourists and locals.","TOPIC":"Swimming and other activities in Jamaica","OUTLINE_ITEM_1":"Jamaica's beaches","OUTLINE_ITEM_2":"Jamaica's nature trails","OUTLINE_ITEM_3":"Jamaica's waterfalls and hiking trails","webhook_url":"https://a-cool-webhook.com","language":{"id":"deepl_PT-BR","formality":"more"}}.to_json

response = http.request(request)

puts JSON.parse(response.body)

Sample Response

All responses from the API are JSON

{
    "success": true,
    "message": "Successfully queued the document. Now just sit back and wait for it to get generated!"
}
all endpoints (20)
Documents
Generations
Languages
Tools