Skip to main content
POST
/
interactions
/
{id}
/
documents
/
cURL
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",
          "source": "core"
        }
      ]
    }
  ],
  "templateKey": "<string>",
  "name": "<string>",
  "outputLanguage": "<string>",
  "disableGuardrails": true
}'
{
  "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
  }
}

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"

X-Corti-Retention-Policy
enum<string>

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.

Available options:
none

Path Parameters

id
string<uuid>
required

The unique identifier of the interaction. Must be a valid UUID.

Example:

"f47ac10b-58cc-4372-a567-0e02b2c3d479"

Body

application/json
  • Static Template
  • Dynamic Template

Standard method for document generation: Use template key to generate document based on pre-defined template.

context
(Facts · object | Transcript · object | String · object)[]
required

An array of context objects. Currently accepts exactly one context object to be used as input for document generation.

  • Facts
  • Transcript
  • String
templateKey
string
required

The key of the template that informs on what kind of document is to be generated.

outputLanguage
string
required

The language in which the document will be generated. Check languages page for more.

name
string

An optional name for the document.

disableGuardrails
boolean

Set to true to disable guardrails during document generation, default is false.

Response

id
string<uuid>
required

Unique ID of the generated document

Example:

"f47ac10b-58cc-4372-a567-0e02b2c3d479"

name
string
required

Name of the generated document

templateRef
string
required

Reference for the used template

isStream
boolean
required
sections
object[]
required

Individual document sections

createdAt
string<date-time>
required

The original timestamp when the document was created.

updatedAt
string<date-time>
required

The timestamp when the document was last updated.

outputLanguage
string
required

The language in which the document will be generated. Check https://docs.corti.ai/about/languages for more.

usageInfo
object
required

Credits consumed for this request.