Update document
curl --request PATCH \
--url https://api.quiva.ai/file-generator/documents/{key} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"key": "contracts/acme-nda-2024.docx",
"name": "Acme NDA 2024",
"template": {
"key": "nda-template"
}
}
'import requests
url = "https://api.quiva.ai/file-generator/documents/{key}"
payload = {
"key": "contracts/acme-nda-2024.docx",
"name": "Acme NDA 2024",
"template": { "key": "nda-template" }
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
key: 'contracts/acme-nda-2024.docx',
name: 'Acme NDA 2024',
template: {key: 'nda-template'}
})
};
fetch('https://api.quiva.ai/file-generator/documents/{key}', 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.quiva.ai/file-generator/documents/{key}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'key' => 'contracts/acme-nda-2024.docx',
'name' => 'Acme NDA 2024',
'template' => [
'key' => 'nda-template'
]
]),
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.quiva.ai/file-generator/documents/{key}"
payload := strings.NewReader("{\n \"key\": \"contracts/acme-nda-2024.docx\",\n \"name\": \"Acme NDA 2024\",\n \"template\": {\n \"key\": \"nda-template\"\n }\n}")
req, _ := http.NewRequest("PATCH", 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.patch("https://api.quiva.ai/file-generator/documents/{key}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"key\": \"contracts/acme-nda-2024.docx\",\n \"name\": \"Acme NDA 2024\",\n \"template\": {\n \"key\": \"nda-template\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.quiva.ai/file-generator/documents/{key}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"key\": \"contracts/acme-nda-2024.docx\",\n \"name\": \"Acme NDA 2024\",\n \"template\": {\n \"key\": \"nda-template\"\n }\n}"
response = http.request(request)
puts response.read_body{
"subject": "ms.document.document.contracts.acme-nda-2024.docx"
}{
"error": "\"key\" is required"
}{
"error": "Authorization header with a bearer token is required"
}{
"error": "server error"
}Documents
Update document
Create or update a document record directly. Used to manually set document metadata outside of the template trigger workflow — for example registering an externally produced file, or correcting metadata on an existing record.
The key is required and derives the document’s storage subject. This is an upsert: it creates the record if absent and merges supplied fields if present.
PATCH
/
file-generator
/
documents
/
{key}
Update document
curl --request PATCH \
--url https://api.quiva.ai/file-generator/documents/{key} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"key": "contracts/acme-nda-2024.docx",
"name": "Acme NDA 2024",
"template": {
"key": "nda-template"
}
}
'import requests
url = "https://api.quiva.ai/file-generator/documents/{key}"
payload = {
"key": "contracts/acme-nda-2024.docx",
"name": "Acme NDA 2024",
"template": { "key": "nda-template" }
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
key: 'contracts/acme-nda-2024.docx',
name: 'Acme NDA 2024',
template: {key: 'nda-template'}
})
};
fetch('https://api.quiva.ai/file-generator/documents/{key}', 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.quiva.ai/file-generator/documents/{key}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'key' => 'contracts/acme-nda-2024.docx',
'name' => 'Acme NDA 2024',
'template' => [
'key' => 'nda-template'
]
]),
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.quiva.ai/file-generator/documents/{key}"
payload := strings.NewReader("{\n \"key\": \"contracts/acme-nda-2024.docx\",\n \"name\": \"Acme NDA 2024\",\n \"template\": {\n \"key\": \"nda-template\"\n }\n}")
req, _ := http.NewRequest("PATCH", 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.patch("https://api.quiva.ai/file-generator/documents/{key}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"key\": \"contracts/acme-nda-2024.docx\",\n \"name\": \"Acme NDA 2024\",\n \"template\": {\n \"key\": \"nda-template\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.quiva.ai/file-generator/documents/{key}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"key\": \"contracts/acme-nda-2024.docx\",\n \"name\": \"Acme NDA 2024\",\n \"template\": {\n \"key\": \"nda-template\"\n }\n}"
response = http.request(request)
puts response.read_body{
"subject": "ms.document.document.contracts.acme-nda-2024.docx"
}{
"error": "\"key\" is required"
}{
"error": "Authorization header with a bearer token is required"
}{
"error": "server error"
}Authorizations
bearerAuthapiKeyAuth
Path Parameters
Body
application/json
Response
Document updated successfully.
Messaging subject of the created or updated record. Formats: draft template ms.document.draft.template.{key}, published template ms.document.template.{key}, document ms.document.document.{key} — with keys sanitised into subject tokens (/ → ., spaces → _, other special characters → uXXXX codes).
Example:
"ms.document.draft.template.invoice-template"