Create a namespace
Create a namespace. An organization can have at most five, default among them — a sixth returns 403.
POST
/
ai
/
memory
/
namespaces
JavaScript
import Telnyx from 'telnyx';
const client = new Telnyx({
apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
});
const Namespace = await client.ai.memory.namespaces.create({
name: 'name',
});
console.log(Namespace.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
)
namespace = client.ai.memory.namespaces.create(
name="name",
)
print(namespace.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"),
)
namespace, err := client.AI.Memory.Namespaces.New(
context.TODO(),
telnyx.AIMemoryNamespaceNewParams{
Name: "name",
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", namespace.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.NamespaceCreateParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
TelnyxClient client = TelnyxOkHttpClient.fromEnv();
NamespaceCreateParams params = NamespaceCreateParams.builder()
.name("name")
.build();
var response = client.ai().memory().namespaces().create(params);
}
}require "telnyx"
telnyx = Telnyx::Client.new(api_key: "My API Key")
namespace = telnyx.ai.memory.namespaces.create(name: "name")
puts(namespace)<?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 {
$namespace = $client->ai->memory->namespaces->create(
name: 'name',
);
var_dump($namespace);
} catch (APIException $e) {
echo $e->getMessage();
}telnyx ai:memory:namespaces create \
--api-key 'My API Key' \
--name namecurl --request POST \
--url https://api.telnyx.com/v2/ai/memory/namespaces \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "staging"
}
'{
"data": {
"id": "b3c17d90-2e4f-5a1b-9c8d-6f0a2b3c4d5e",
"name": "staging"
}
}{
"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": "10039",
"title": "Forbidden",
"detail": "an organization can have 5 namespaces, `default` among them, and this one already has that many",
"meta": {
"url": "https://developers.telnyx.com/docs/overview/errors/10039"
}
}
]
}{
"errors": [
{
"code": "upstream_error",
"detail": "the memory dataplane is unavailable"
}
]
}Was this page helpful?
JavaScript
import Telnyx from 'telnyx';
const client = new Telnyx({
apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
});
const Namespace = await client.ai.memory.namespaces.create({
name: 'name',
});
console.log(Namespace.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
)
namespace = client.ai.memory.namespaces.create(
name="name",
)
print(namespace.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"),
)
namespace, err := client.AI.Memory.Namespaces.New(
context.TODO(),
telnyx.AIMemoryNamespaceNewParams{
Name: "name",
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", namespace.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.NamespaceCreateParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
TelnyxClient client = TelnyxOkHttpClient.fromEnv();
NamespaceCreateParams params = NamespaceCreateParams.builder()
.name("name")
.build();
var response = client.ai().memory().namespaces().create(params);
}
}require "telnyx"
telnyx = Telnyx::Client.new(api_key: "My API Key")
namespace = telnyx.ai.memory.namespaces.create(name: "name")
puts(namespace)<?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 {
$namespace = $client->ai->memory->namespaces->create(
name: 'name',
);
var_dump($namespace);
} catch (APIException $e) {
echo $e->getMessage();
}telnyx ai:memory:namespaces create \
--api-key 'My API Key' \
--name namecurl --request POST \
--url https://api.telnyx.com/v2/ai/memory/namespaces \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "staging"
}
'{
"data": {
"id": "b3c17d90-2e4f-5a1b-9c8d-6f0a2b3c4d5e",
"name": "staging"
}
}{
"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": "10039",
"title": "Forbidden",
"detail": "an organization can have 5 namespaces, `default` among them, and this one already has that many",
"meta": {
"url": "https://developers.telnyx.com/docs/overview/errors/10039"
}
}
]
}{
"errors": [
{
"code": "upstream_error",
"detail": "the memory dataplane is unavailable"
}
]
}