Ingest a session's messages into a profile
Store a session. Facts are extracted from whatever you send — the body is taken as any JSON value and stored whole, so a framework’s own transcript shape works unchanged. messages of role/content is the conventional shape, not a requirement. An empty object or a null body is refused. Carry a session_id to name the session: re-ingesting the same one replaces what it held. Omit it and a session is opened and returned. Extraction runs asynchronously — poll the returned operation.
import Telnyx from 'telnyx';
const client = new Telnyx({
apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
});
const response = await client.ai.memory.namespaces.profiles.ingest('namespace', 'profile_id');
console.log(response.data);import os
from telnyx import Telnyx
client = Telnyx(
api_key=os.environ.get("TELNYX_API_KEY"), # This is the default and can be omitted
)
response = client.ai.memory.namespaces.profiles.ingest(
namespace="namespace",
profile_id="profile_id",
)
print(response.data)
package main
import (
"context"
"fmt"
"github.com/team-telnyx/telnyx-go"
"github.com/team-telnyx/telnyx-go/option"
)
func main() {
client := telnyx.NewClient(
option.WithAPIKey("My API Key"),
)
response, err := client.AI.Memory.Namespaces.Profiles.Ingest(
context.TODO(),
"namespace",
"profile_id",
telnyx.AIMemoryNamespaceProfileIngestParams{
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", response.Data)
}
package com.telnyx.sdk.example;
import com.telnyx.sdk.client.TelnyxClient;
import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;
import com.telnyx.sdk.models.ai.memory.namespaces.profiles.ProfileIngestParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
TelnyxClient client = TelnyxOkHttpClient.fromEnv();
ProfileIngestParams params = ProfileIngestParams.builder()
.build();
var response = client.ai().memory().namespaces().profiles().ingest("namespace", "profile_id", params);
}
}require "telnyx"
telnyx = Telnyx::Client.new(api_key: "My API Key")
response = telnyx.ai.memory.namespaces.profiles.ingest("namespace", "profile_id")
puts(response)<?php
require_once dirname(__DIR__) . '/vendor/autoload.php';
use Telnyx\Client;
use Telnyx\Core\Exceptions\APIException;
$client = new Client(apiKey: getenv('TELNYX_API_KEY') ?: 'My API Key');
try {
$response = $client->ai->memory->namespaces->profiles->ingest(
'namespace',
'profile_id',
);
var_dump($response);
} catch (APIException $e) {
echo $e->getMessage();
}telnyx ai:memory:namespaces:profiles ingest \
--api-key 'My API Key' \
--namespace namespace \
--profile-id profile_idcurl --request POST \
--url https://api.telnyx.com/v2/ai/memory/namespaces/{namespace}/profiles/{profile_id}/ingest \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"messages": [
{
"role": "user",
"content": "Invoices go to 220 W Chicago Ave now."
},
{
"role": "assistant",
"content": "Got it."
}
]
}
'{
"data": {
"operation_id": "op_01HZY4M7Q9",
"profile_id": "caller:+13128675309",
"session_id": "conv_8901",
"source_id": "b1e6c0a2-4f3d-4a2e-9c7b-8e1f2a3b4c5d"
}
}{
"errors": [
{
"code": "10009",
"title": "Authentication failed",
"detail": "Could not find any usable credentials in the request.",
"source": {
"pointer": "/"
},
"meta": {
"url": "https://developers.telnyx.com/docs/overview/errors/10009"
}
}
]
}{
"errors": [
{
"code": "namespace_not_found",
"detail": "no such namespace"
}
]
}{
"errors": [
{
"code": "empty_payload",
"detail": "payload must carry something to remember"
}
]
}{
"errors": [
{
"code": "upstream_error",
"detail": "the memory dataplane is unavailable"
}
]
}Authorizations
Telnyx API key
Query Parameters
Names the session. Re-ingesting the same session replaces what it held and keeps its source_id. Omit it to have one derived from the content and returned. No whitespace, control characters, or any of / \ # ? %.
128Body
The session's messages, in whatever shape your framework produces. Any JSON value but null is accepted and stored whole, as long as it holds something to remember: a body with no content anywhere in it -- {}, [], "", {"messages": []} -- is a 422.
Response
Successful Response
Show child attributes
Show child attributes
Was this page helpful?
import Telnyx from 'telnyx';
const client = new Telnyx({
apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
});
const response = await client.ai.memory.namespaces.profiles.ingest('namespace', 'profile_id');
console.log(response.data);import os
from telnyx import Telnyx
client = Telnyx(
api_key=os.environ.get("TELNYX_API_KEY"), # This is the default and can be omitted
)
response = client.ai.memory.namespaces.profiles.ingest(
namespace="namespace",
profile_id="profile_id",
)
print(response.data)
package main
import (
"context"
"fmt"
"github.com/team-telnyx/telnyx-go"
"github.com/team-telnyx/telnyx-go/option"
)
func main() {
client := telnyx.NewClient(
option.WithAPIKey("My API Key"),
)
response, err := client.AI.Memory.Namespaces.Profiles.Ingest(
context.TODO(),
"namespace",
"profile_id",
telnyx.AIMemoryNamespaceProfileIngestParams{
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", response.Data)
}
package com.telnyx.sdk.example;
import com.telnyx.sdk.client.TelnyxClient;
import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;
import com.telnyx.sdk.models.ai.memory.namespaces.profiles.ProfileIngestParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
TelnyxClient client = TelnyxOkHttpClient.fromEnv();
ProfileIngestParams params = ProfileIngestParams.builder()
.build();
var response = client.ai().memory().namespaces().profiles().ingest("namespace", "profile_id", params);
}
}require "telnyx"
telnyx = Telnyx::Client.new(api_key: "My API Key")
response = telnyx.ai.memory.namespaces.profiles.ingest("namespace", "profile_id")
puts(response)<?php
require_once dirname(__DIR__) . '/vendor/autoload.php';
use Telnyx\Client;
use Telnyx\Core\Exceptions\APIException;
$client = new Client(apiKey: getenv('TELNYX_API_KEY') ?: 'My API Key');
try {
$response = $client->ai->memory->namespaces->profiles->ingest(
'namespace',
'profile_id',
);
var_dump($response);
} catch (APIException $e) {
echo $e->getMessage();
}telnyx ai:memory:namespaces:profiles ingest \
--api-key 'My API Key' \
--namespace namespace \
--profile-id profile_idcurl --request POST \
--url https://api.telnyx.com/v2/ai/memory/namespaces/{namespace}/profiles/{profile_id}/ingest \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"messages": [
{
"role": "user",
"content": "Invoices go to 220 W Chicago Ave now."
},
{
"role": "assistant",
"content": "Got it."
}
]
}
'{
"data": {
"operation_id": "op_01HZY4M7Q9",
"profile_id": "caller:+13128675309",
"session_id": "conv_8901",
"source_id": "b1e6c0a2-4f3d-4a2e-9c7b-8e1f2a3b4c5d"
}
}{
"errors": [
{
"code": "10009",
"title": "Authentication failed",
"detail": "Could not find any usable credentials in the request.",
"source": {
"pointer": "/"
},
"meta": {
"url": "https://developers.telnyx.com/docs/overview/errors/10009"
}
}
]
}{
"errors": [
{
"code": "namespace_not_found",
"detail": "no such namespace"
}
]
}{
"errors": [
{
"code": "empty_payload",
"detail": "payload must carry something to remember"
}
]
}{
"errors": [
{
"code": "upstream_error",
"detail": "the memory dataplane is unavailable"
}
]
}