curl --request POST \
--url https://api.{environment}.corti.app/v2/interactions/{id}/documents/ \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Tenant-Name: <tenant-name>' \
--data '
{
"context": [
{
"type": "facts",
"data": [
{
"text": "<string>",
"group": "Others"
}
]
}
],
"templateKey": "<string>",
"outputLanguage": "<string>",
"name": "<string>",
"disableGuardrails": true,
"documentationMode": "global_sequential"
}
'import { CortiClient, CortiEnvironment } from "@corti/sdk";
const client = new CortiClient({
environment: CortiEnvironment.Eu,
auth: {
clientId: "YOUR_CLIENT_ID",
clientSecret: "YOUR_CLIENT_SECRET"
},
tenantName: "YOUR_TENANT_NAME"
});
await client.documents.classic.create("f47ac10b-58cc-4372-a567-0e02b2c3d479", {
context: [{
type: "facts",
data: [{
text: "text"
}]
}],
templateKey: "templateKey",
outputLanguage: "outputLanguage"
});
using Corti;
var client = new CortiClient(
"TENANT_NAME",
CortiClientEnvironment.Eu,
new CortiClientAuth.ClientCredentials("client_id", "client_secret")
);
await client.Documents.Classic.CreateAsync(
"f47ac10b-58cc-4372-a567-0e02b2c3d479",
new DocumentsCreateRequestWithTemplateKey
{
Context = new List<DocumentsContext>()
{
new DocumentsContextWithFacts
{
Type = DocumentsContextWithFactsType.Facts,
Data = new List<FactsContext>() { new FactsContext { Text = "text" } },
},
},
TemplateKey = "templateKey",
OutputLanguage = "outputLanguage",
}
);
import requests
url = "https://api.{environment}.corti.app/v2/interactions/{id}/documents/"
payload = {
"context": [
{
"type": "facts",
"data": [
{
"text": "<string>",
"group": "Others"
}
]
}
],
"templateKey": "<string>",
"outputLanguage": "<string>",
"name": "<string>",
"disableGuardrails": True,
"documentationMode": "global_sequential"
}
headers = {
"Tenant-Name": "<tenant-name>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.{environment}.corti.app/v2/interactions/{id}/documents/",
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([
'context' => [
[
'type' => 'facts',
'data' => [
[
'text' => '<string>',
'group' => 'Others'
]
]
]
],
'templateKey' => '<string>',
'outputLanguage' => '<string>',
'name' => '<string>',
'disableGuardrails' => true,
'documentationMode' => 'global_sequential'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"Tenant-Name: <tenant-name>"
],
]);
$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.{environment}.corti.app/v2/interactions/{id}/documents/"
payload := strings.NewReader("{\n \"context\": [\n {\n \"type\": \"facts\",\n \"data\": [\n {\n \"text\": \"<string>\",\n \"group\": \"Others\"\n }\n ]\n }\n ],\n \"templateKey\": \"<string>\",\n \"outputLanguage\": \"<string>\",\n \"name\": \"<string>\",\n \"disableGuardrails\": true,\n \"documentationMode\": \"global_sequential\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Tenant-Name", "<tenant-name>")
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.{environment}.corti.app/v2/interactions/{id}/documents/")
.header("Tenant-Name", "<tenant-name>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"context\": [\n {\n \"type\": \"facts\",\n \"data\": [\n {\n \"text\": \"<string>\",\n \"group\": \"Others\"\n }\n ]\n }\n ],\n \"templateKey\": \"<string>\",\n \"outputLanguage\": \"<string>\",\n \"name\": \"<string>\",\n \"disableGuardrails\": true,\n \"documentationMode\": \"global_sequential\"\n}")
.asString();{
"id": "f47ac10b-58cc-4372-a567-0e02b2c3d479",
"name": "<string>",
"templateRef": "<string>",
"isStream": true,
"sections": [
{
"key": "<string>",
"name": "<string>",
"text": "<string>",
"sort": 123,
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z"
}
],
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"outputLanguage": "<string>",
"usageInfo": {
"creditsConsumed": 123
}
}{
"requestid": "<string>",
"status": 123,
"type": "<string>",
"detail": "<string>",
"validationErrors": [
{}
]
}{
"requestid": "<string>",
"status": 123,
"type": "<string>",
"detail": "<string>",
"validationErrors": [
{}
]
}{
"requestid": "<string>",
"status": 123,
"type": "<string>",
"detail": "<string>",
"validationErrors": [
{}
]
}{
"requestid": "<string>",
"status": 123,
"type": "<string>",
"detail": "<string>",
"validationErrors": [
{}
]
}Generate Document
This endpoint offers different ways to generate a document. Find guides to document generation here.
This endpoint is deprecated in favour of the corresponding GUIDED endpoint. See the deprecation notice for more details and migration guidance.
curl --request POST \
--url https://api.{environment}.corti.app/v2/interactions/{id}/documents/ \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Tenant-Name: <tenant-name>' \
--data '
{
"context": [
{
"type": "facts",
"data": [
{
"text": "<string>",
"group": "Others"
}
]
}
],
"templateKey": "<string>",
"outputLanguage": "<string>",
"name": "<string>",
"disableGuardrails": true,
"documentationMode": "global_sequential"
}
'import { CortiClient, CortiEnvironment } from "@corti/sdk";
const client = new CortiClient({
environment: CortiEnvironment.Eu,
auth: {
clientId: "YOUR_CLIENT_ID",
clientSecret: "YOUR_CLIENT_SECRET"
},
tenantName: "YOUR_TENANT_NAME"
});
await client.documents.classic.create("f47ac10b-58cc-4372-a567-0e02b2c3d479", {
context: [{
type: "facts",
data: [{
text: "text"
}]
}],
templateKey: "templateKey",
outputLanguage: "outputLanguage"
});
using Corti;
var client = new CortiClient(
"TENANT_NAME",
CortiClientEnvironment.Eu,
new CortiClientAuth.ClientCredentials("client_id", "client_secret")
);
await client.Documents.Classic.CreateAsync(
"f47ac10b-58cc-4372-a567-0e02b2c3d479",
new DocumentsCreateRequestWithTemplateKey
{
Context = new List<DocumentsContext>()
{
new DocumentsContextWithFacts
{
Type = DocumentsContextWithFactsType.Facts,
Data = new List<FactsContext>() { new FactsContext { Text = "text" } },
},
},
TemplateKey = "templateKey",
OutputLanguage = "outputLanguage",
}
);
import requests
url = "https://api.{environment}.corti.app/v2/interactions/{id}/documents/"
payload = {
"context": [
{
"type": "facts",
"data": [
{
"text": "<string>",
"group": "Others"
}
]
}
],
"templateKey": "<string>",
"outputLanguage": "<string>",
"name": "<string>",
"disableGuardrails": True,
"documentationMode": "global_sequential"
}
headers = {
"Tenant-Name": "<tenant-name>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.{environment}.corti.app/v2/interactions/{id}/documents/",
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([
'context' => [
[
'type' => 'facts',
'data' => [
[
'text' => '<string>',
'group' => 'Others'
]
]
]
],
'templateKey' => '<string>',
'outputLanguage' => '<string>',
'name' => '<string>',
'disableGuardrails' => true,
'documentationMode' => 'global_sequential'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"Tenant-Name: <tenant-name>"
],
]);
$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.{environment}.corti.app/v2/interactions/{id}/documents/"
payload := strings.NewReader("{\n \"context\": [\n {\n \"type\": \"facts\",\n \"data\": [\n {\n \"text\": \"<string>\",\n \"group\": \"Others\"\n }\n ]\n }\n ],\n \"templateKey\": \"<string>\",\n \"outputLanguage\": \"<string>\",\n \"name\": \"<string>\",\n \"disableGuardrails\": true,\n \"documentationMode\": \"global_sequential\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Tenant-Name", "<tenant-name>")
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.{environment}.corti.app/v2/interactions/{id}/documents/")
.header("Tenant-Name", "<tenant-name>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"context\": [\n {\n \"type\": \"facts\",\n \"data\": [\n {\n \"text\": \"<string>\",\n \"group\": \"Others\"\n }\n ]\n }\n ],\n \"templateKey\": \"<string>\",\n \"outputLanguage\": \"<string>\",\n \"name\": \"<string>\",\n \"disableGuardrails\": true,\n \"documentationMode\": \"global_sequential\"\n}")
.asString();{
"id": "f47ac10b-58cc-4372-a567-0e02b2c3d479",
"name": "<string>",
"templateRef": "<string>",
"isStream": true,
"sections": [
{
"key": "<string>",
"name": "<string>",
"text": "<string>",
"sort": 123,
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z"
}
],
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"outputLanguage": "<string>",
"usageInfo": {
"creditsConsumed": 123
}
}{
"requestid": "<string>",
"status": 123,
"type": "<string>",
"detail": "<string>",
"validationErrors": [
{}
]
}{
"requestid": "<string>",
"status": 123,
"type": "<string>",
"detail": "<string>",
"validationErrors": [
{}
]
}{
"requestid": "<string>",
"status": 123,
"type": "<string>",
"detail": "<string>",
"validationErrors": [
{}
]
}{
"requestid": "<string>",
"status": 123,
"type": "<string>",
"detail": "<string>",
"validationErrors": [
{}
]
}Authorizations
Input your token
Headers
Identifies a distinct entity within Corti's multi-tenant system. Ensures correct routing and authentication of the request.
"base"
With the optional header X-Corti-Retention-Policy:none the API will generate and return the document as expected, but the generated document will not be saved to the database. The response will include the header X-Corti-Retention-Policy:acknowledged to confirm that your retention preference was respected. If the header is omitted or set to any other value, the default retention policy will apply, and the document will be stored in the database.
none Path Parameters
The unique identifier of the interaction. Must be a valid UUID.
"f47ac10b-58cc-4372-a567-0e02b2c3d479"
Body
- Static Template
- Dynamic Template
Standard method for document generation: Use template key to generate document based on pre-defined template.
The key of the template referencing the sections for generating a document.
The language in which the document will be generated. Check languages page for more.
An optional name for the document.
Set to true to disable guardrails during document generation, default is false.
Configures the approach and underlying system prompt that govern how the LLM generates documentation.
global_sequential, routed_parallel "global_sequential"
Response
Unique ID of the generated document
"f47ac10b-58cc-4372-a567-0e02b2c3d479"
Name of the generated document
Reference for the used template
Individual document sections
Show child attributes
Show child attributes
The original timestamp when the document was created.
The timestamp when the document was last updated.
The language in which the document will be generated. Check https://docs.corti.ai/stt/languages for more.
Credits consumed for this request.
Show child attributes
Show child attributes
Was this page helpful?