Facebook Pixel

Edit Document

Updates the text in a document

Endpoint

PUThttps://nichesss.com/api/documents/<DOCUMENT_ID>

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
textDocument textrequiredString"This will override the document and become the entire text of the document. Try it out and see what happens!"

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

{
    "text": "This will override the document and become the entire text of the document.\n\nTry it out and see what happens!"
}

Example API calls

Command Line (curl)

curl -X PUT "https://nichesss.com/api/documents/<DOCUMENT_ID>" -H "Content-type: application/json" -H "Authorization: Bearer <YOUR_API_KEY>" -d "{\"text\":\"This will override the document and become the entire text of the document.\n\nTry it out and see what happens!\"}"

JavaScript

fetch('https://nichesss.com/api/documents/<DOCUMENT_ID>', {
    method: 'PUT',
    headers: {
        'Content-type': 'application/json',
        'Authorization': 'Bearer <YOUR_API_KEY>',
    },
    body: JSON.stringify({"text":"This will override the document and become the entire text of the document.\n\nTry it out and see what happens!"})
})
.then((response) => response.json())
.then((data) => console.log(data));

Python

import requests

url = 'https://nichesss.com/api/documents/<DOCUMENT_ID>'
payload = {"text":"This will override the document and become the entire text of the document.\n\nTry it out and see what happens!"}
headers = {'Content-type': 'application/json', 'Authorization': 'Bearer <YOUR_API_KEY>'}

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

print(data)

PHP

$api_key = '<YOUR_API_KEY>';
$request_url = 'https://nichesss.com/api/documents/<DOCUMENT_ID>';

$request_options = array(
    'http' => array(
        'method' => 'PUT',
        'header' => 'Content-type: application/json' . "\r\n" .
                    'Authorization: Bearer ' . $api_key . "\r\n",
        'content' => '{"text":"This will override the document and become the entire text of the document.\n\nTry it out and see what happens!"}'
    )
);

$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/<DOCUMENT_ID>')

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

request = Net::HTTP::Put.new(uri.request_uri)
request['Content-type'] = 'application/json'
request['Authorization'] = 'Bearer <YOUR_API_KEY>'
request.body = {"text":"This will override the document and become the entire text of the document.\n\nTry it out and see what happens!"}.to_json

response = http.request(request)

puts JSON.parse(response.body)

Sample Response

All responses from the API are JSON. You won't get the copy back immediately. We recommended you use webhooks to get your copy back, or follow the queue uri and wait.

{
    "success": true,
    "message": "Updated the document successfully.",
    "id": "BeEAeihyI"
}
all endpoints (20)
Documents
Generations
Languages
Tools