Embed URL content
Embed website content from a specified URL, including child pages up to 5 levels deep within the same domain. The process crawls and loads content from the main URL and its linked pages into a Telnyx Cloud Storage bucket. As soon as each webpage is added to the bucket, its content is immediately processed for embeddings, that can be used for similarity search and clustering.
POST
/
ai
/
embeddings
/
url
JavaScript
import Telnyx from 'telnyx';
const client = new Telnyx({
apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
});
const embeddingResponse = await client.ai.embeddings.url({
bucket_name: 'bucket_name',
url: 'url',
});
console.log(embeddingResponse.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
)
embedding_response = client.ai.embeddings.url(
bucket_name="bucket_name",
url="url",
)
print(embedding_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"),
)
embeddingResponse, err := client.AI.Embeddings.URL(context.TODO(), telnyx.AIEmbeddingURLParams{
BucketName: "bucket_name",
URL: "url",
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", embeddingResponse.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.embeddings.EmbeddingResponse;
import com.telnyx.sdk.models.ai.embeddings.EmbeddingUrlParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
TelnyxClient client = TelnyxOkHttpClient.fromEnv();
EmbeddingUrlParams params = EmbeddingUrlParams.builder()
.bucketName("bucket_name")
.url("url")
.build();
EmbeddingResponse embeddingResponse = client.ai().embeddings().url(params);
}
}require "telnyx"
telnyx = Telnyx::Client.new(api_key: "My API Key")
embedding_response = telnyx.ai.embeddings.url(bucket_name: "bucket_name", url: "url")
puts(embedding_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 {
$embeddingResponse = $client->ai->embeddings->url(
bucketName: 'bucket_name', url: 'url'
);
var_dump($embeddingResponse);
} catch (APIException $e) {
echo $e->getMessage();
}telnyx ai:embeddings url \
--api-key 'My API Key' \
--bucket-name bucket_name \
--url urlcurl --request POST \
--url https://api.telnyx.com/v2/ai/embeddings/url \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"url": "<string>",
"bucket_name": "<string>"
}
'{
"data": {
"task_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"task_name": "<string>",
"status": "<string>",
"created_at": "<string>",
"finished_at": "<string>",
"user_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
application/json
Response
Successful Response
Show child attributes
Show child attributes
Was this page helpful?
⌘I
JavaScript
import Telnyx from 'telnyx';
const client = new Telnyx({
apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
});
const embeddingResponse = await client.ai.embeddings.url({
bucket_name: 'bucket_name',
url: 'url',
});
console.log(embeddingResponse.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
)
embedding_response = client.ai.embeddings.url(
bucket_name="bucket_name",
url="url",
)
print(embedding_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"),
)
embeddingResponse, err := client.AI.Embeddings.URL(context.TODO(), telnyx.AIEmbeddingURLParams{
BucketName: "bucket_name",
URL: "url",
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", embeddingResponse.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.embeddings.EmbeddingResponse;
import com.telnyx.sdk.models.ai.embeddings.EmbeddingUrlParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
TelnyxClient client = TelnyxOkHttpClient.fromEnv();
EmbeddingUrlParams params = EmbeddingUrlParams.builder()
.bucketName("bucket_name")
.url("url")
.build();
EmbeddingResponse embeddingResponse = client.ai().embeddings().url(params);
}
}require "telnyx"
telnyx = Telnyx::Client.new(api_key: "My API Key")
embedding_response = telnyx.ai.embeddings.url(bucket_name: "bucket_name", url: "url")
puts(embedding_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 {
$embeddingResponse = $client->ai->embeddings->url(
bucketName: 'bucket_name', url: 'url'
);
var_dump($embeddingResponse);
} catch (APIException $e) {
echo $e->getMessage();
}telnyx ai:embeddings url \
--api-key 'My API Key' \
--bucket-name bucket_name \
--url urlcurl --request POST \
--url https://api.telnyx.com/v2/ai/embeddings/url \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"url": "<string>",
"bucket_name": "<string>"
}
'{
"data": {
"task_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"task_name": "<string>",
"status": "<string>",
"created_at": "<string>",
"finished_at": "<string>",
"user_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}