Skip to main content
POST
/
tools
/
extract-facts
cURL
curl --request POST \
  --url https://api.{environment}.corti.app/v2/tools/extract-facts \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --header 'Tenant-Name: <tenant-name>' \
  --data '
{
  "context": [
    {
      "type": "text",
      "text": "<string>"
    }
  ],
  "outputLanguage": "<string>"
}
'
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.facts.extract({
context: [{
type: "text",
text: "text"
}],
outputLanguage: "outputLanguage"
});
using Corti;

var client = new CortiClient(
"TENANT_NAME",
CortiClientEnvironment.Eu,
new CortiClientAuth.ClientCredentials("client_id", "client_secret")
);
await client.Facts.ExtractAsync(
new FactsExtractRequest
{
Context = new List<CommonTextContext>() { new CommonTextContext { Text = "text" } },
OutputLanguage = "outputLanguage",
}
);
import requests

url = "https://api.{environment}.corti.app/v2/tools/extract-facts"

payload = {
"context": [
{
"type": "text",
"text": "<string>"
}
],
"outputLanguage": "<string>"
}
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/tools/extract-facts",
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' => 'text',
'text' => '<string>'
]
],
'outputLanguage' => '<string>'
]),
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/tools/extract-facts"

payload := strings.NewReader("{\n \"context\": [\n {\n \"type\": \"text\",\n \"text\": \"<string>\"\n }\n ],\n \"outputLanguage\": \"<string>\"\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/tools/extract-facts")
.header("Tenant-Name", "<tenant-name>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"context\": [\n {\n \"type\": \"text\",\n \"text\": \"<string>\"\n }\n ],\n \"outputLanguage\": \"<string>\"\n}")
.asString();
{
  "facts": [
    {
      "group": "<string>",
      "value": "<string>",
      "text": "<string>"
    }
  ],
  "outputLanguage": "<string>",
  "usageInfo": {
    "creditsConsumed": 123
  }
}
{
"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
context
Text · object[]
required
outputLanguage
string
required

The desired output language code for extracted facts. Check languages page for more.

Response

Returns the extracted facts.

facts
object[]
required

List of extracted facts based on the provided input context.

outputLanguage
string
required

The language locale of the output.

usageInfo
object
required

Credits consumed for this request.