Skip to main content
POST
/
documents
/
templates
/
cURL
curl --request POST \
  --url https://api.{environment}.corti.app/v2/documents/templates/ \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --header 'Tenant-Name: <tenant-name>' \
  --data '
{
  "name": "<string>",
  "inheritFromId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "description": "<string>",
  "languages": [
    "<string>"
  ],
  "regions": [
    "<string>"
  ],
  "specialties": [
    "<string>"
  ],
  "labels": [
    {
      "key": "<string>",
      "value": "<string>"
    }
  ],
  "publish": true,
  "generation": {
    "instructions": {
      "prompt": "<string>"
    },
    "sections": [
      {
        "sectionId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
        "orderIndex": 123
      }
    ]
  }
}
'
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.templates.create({
name: "name",
inheritFromId: "inheritFromId"
});
using Corti;

var client = new CortiClient(
"TENANT_NAME",
CortiClientEnvironment.Eu,
new CortiClientAuth.ClientCredentials("client_id", "client_secret")
);
await client.Documents.Templates.CreateAsync(
new GuidedTemplatesCreateFromInheritanceRequest
{
Name = "name",
InheritFromId = "inheritFromId",
}
);
import requests

url = "https://api.{environment}.corti.app/v2/documents/templates/"

payload = {
"name": "<string>",
"inheritFromId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"description": "<string>",
"languages": ["<string>"],
"regions": ["<string>"],
"specialties": ["<string>"],
"labels": [
{
"key": "<string>",
"value": "<string>"
}
],
"publish": True,
"generation": {
"instructions": { "prompt": "<string>" },
"sections": [
{
"sectionId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"orderIndex": 123
}
]
}
}
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/documents/templates/",
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([
'name' => '<string>',
'inheritFromId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'description' => '<string>',
'languages' => [
'<string>'
],
'regions' => [
'<string>'
],
'specialties' => [
'<string>'
],
'labels' => [
[
'key' => '<string>',
'value' => '<string>'
]
],
'publish' => true,
'generation' => [
'instructions' => [
'prompt' => '<string>'
],
'sections' => [
[
'sectionId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'orderIndex' => 123
]
]
]
]),
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/documents/templates/"

payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"inheritFromId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"description\": \"<string>\",\n \"languages\": [\n \"<string>\"\n ],\n \"regions\": [\n \"<string>\"\n ],\n \"specialties\": [\n \"<string>\"\n ],\n \"labels\": [\n {\n \"key\": \"<string>\",\n \"value\": \"<string>\"\n }\n ],\n \"publish\": true,\n \"generation\": {\n \"instructions\": {\n \"prompt\": \"<string>\"\n },\n \"sections\": [\n {\n \"sectionId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"orderIndex\": 123\n }\n ]\n }\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/documents/templates/")
.header("Tenant-Name", "<tenant-name>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"inheritFromId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"description\": \"<string>\",\n \"languages\": [\n \"<string>\"\n ],\n \"regions\": [\n \"<string>\"\n ],\n \"specialties\": [\n \"<string>\"\n ],\n \"labels\": [\n {\n \"key\": \"<string>\",\n \"value\": \"<string>\"\n }\n ],\n \"publish\": true,\n \"generation\": {\n \"instructions\": {\n \"prompt\": \"<string>\"\n },\n \"sections\": [\n {\n \"sectionId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"orderIndex\": 123\n }\n ]\n }\n}")
.asString();
{
  "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "name": "<string>",
  "languages": [
    "<string>"
  ],
  "regions": [
    "<string>"
  ],
  "specialties": [
    "<string>"
  ],
  "labels": [
    {
      "key": "<string>",
      "value": "<string>"
    }
  ],
  "createdAt": "2023-11-07T05:31:56Z",
  "updatedAt": "2023-11-07T05:31:56Z",
  "inheritedFromId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "autoGenerated": true,
  "description": "<string>",
  "createdBy": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "deletedAt": "2023-11-07T05:31:56Z",
  "publishedVersion": {
    "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
    "versionNumber": 123,
    "generation": {
      "instructions": {
        "prompt": "<string>"
      },
      "sections": [
        {
          "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
          "name": "<string>",
          "languages": [
            "<string>"
          ],
          "regions": [
            "<string>"
          ],
          "specialties": [
            "<string>"
          ],
          "labels": [
            {
              "key": "<string>",
              "value": "<string>"
            }
          ],
          "createdAt": "2023-11-07T05:31:56Z",
          "updatedAt": "2023-11-07T05:31:56Z",
          "inheritedFromId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
          "autoGenerated": true,
          "description": "<string>",
          "createdBy": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
          "deletedAt": "2023-11-07T05:31:56Z",
          "publishedVersion": {
            "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
            "versionNumber": 123,
            "generation": {
              "heading": "<string>",
              "instructions": {
                "contentPrompt": "<string>",
                "writingStylePrompt": "<string>",
                "miscPrompt": "<string>"
              },
              "outputSchema": {
                "type": "string",
                "description": "<string>",
                "default": "<string>",
                "enum": [
                  "<string>"
                ],
                "pattern": "<string>"
              }
            },
            "deletedAt": "2023-11-07T05:31:56Z"
          }
        }
      ]
    },
    "deletedAt": "2023-11-07T05:31:56Z"
  }
}
{
"requestid": "<string>",
"status": 123,
"type": "<string>",
"detail": "<string>",
"validationErrors": [
{}
]
}

Authorizations

Authorization
string
header
required

Input your token

Headers

Tenant-Name
string
required

Identifies a distinct entity within Corti's multi-tenant system. Ensures correct routing and authentication of the request.

Example:

"base"

Body

application/json

Creates a template that inherits from another template. Any fields omitted in generation are inherited from the referenced template's published version; any fields provided override the inherited values.

name
string
required

The name of this template. Not passed to the LLM.

inheritFromId
string<uuid>
required

Reference to the template to inherit instructions and sections from. Inherits from the published version of the referenced template.

description
string

A description for this template. Not passed to the LLM.

languages
string[]

BCP 47 language tags this template has been tweaked for (e.g. ["fr", "de", "en-GB"]).

regions
string[]

ISO 3166-1 alpha-3 country codes this template has been tweaked for (e.g. ["BEL"]).

specialties
string[]

Clinical specialties this template has been tweaked for.

labels
object[]

Labels work as query param filter in the LIST /templates endpoint.

publish
boolean
default:true

Defaults to true when omitted. Set this to false if you do not want the template to automatically show up in LIST templates.

generation
object

Partial overrides applied on top of the inherited template. All inner fields are optional. Any field omitted is inherited from the referenced template.

Response

Created

Template as returned by single-resource endpoints (GET, POST, PATCH on /documents/templates/{templateID}). Extends GuidedTemplateListItem with the resolved publishedVersion.

id
string<uuid>
required

The UUID of the template.

name
string
required

The name of this template. Not passed to the LLM.

languages
string[]
required

BCP 47 language tags this template has been tweaked for (e.g. ["fr", "de", "en-GB"]). Empty means no language-specific tweaks.

regions
string[]
required

ISO 3166-1 alpha-3 country codes this template has been tweaked for (e.g. ["BEL"]). Empty means no region-specific tweaks.

specialties
string[]
required

Clinical specialties this template has been tweaked for. Empty means no specialty-specific tweaks.

labels
object[]
required

The available labels to use as query param filter in the LIST /templates endpoint.

createdAt
string<date-time>
required

The original timestamp when the template was created.

updatedAt
string<date-time>
required

The original timestamp when the template was last updated.

inheritedFromId
string<uuid> | null

Reference to the template to inherit template instructions and sections from. Inherits from published version by default.

autoGenerated
boolean

True if the template was auto-generated based on the section-composed POST /documents request.

source
enum<string>

Whether this template was created by the user, a project-related API Client or is a Corti standard resource.

Available options:
user,
corti,
project
description
string

A description for this template. Not passed to the LLM.

createdBy
string<uuid>

The UUID of the creator of this template.

deletedAt
string<date-time> | null

Present when the template has been deleted. GET by ID still returns the full resource with this field populated.

publishedVersion
object

The currently published version with inheritance fully resolved. Present when a version has been published.