Generate an embedding vector
curl --request POST \
--url https://api.example.com/search/embeddings \
--header 'Content-Type: application/json' \
--data '
{
"text": "<string>",
"model": "gemini-embedding-001"
}
'import requests
url = "https://api.example.com/search/embeddings"
payload = {
"text": "<string>",
"model": "gemini-embedding-001"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({text: '<string>', model: 'gemini-embedding-001'})
};
fetch('https://api.example.com/search/embeddings', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/search/embeddings",
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([
'text' => '<string>',
'model' => 'gemini-embedding-001'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$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.example.com/search/embeddings"
payload := strings.NewReader("{\n \"text\": \"<string>\",\n \"model\": \"gemini-embedding-001\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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.example.com/search/embeddings")
.header("Content-Type", "application/json")
.body("{\n \"text\": \"<string>\",\n \"model\": \"gemini-embedding-001\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/search/embeddings")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"text\": \"<string>\",\n \"model\": \"gemini-embedding-001\"\n}"
response = http.request(request)
puts response.read_body{
"embedding": [
123
],
"model": "<string>",
"dimensions": 123
}{
"error": {
"message": "<string>",
"request_id": "<string>",
"timestamp": "2023-11-07T05:31:56Z",
"details": {}
}
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}{
"error": {
"message": "<string>",
"request_id": "<string>",
"timestamp": "2023-11-07T05:31:56Z",
"details": {}
}
}embeddings
Generate an embedding vector
Generates an embedding vector for the provided text using the configured embedding provider (default: Google Gemini). Used by publishing services to embed entity text before indexing, and by the global search endpoint to vectorise natural language queries.
POST
/
search
/
embeddings
Generate an embedding vector
curl --request POST \
--url https://api.example.com/search/embeddings \
--header 'Content-Type: application/json' \
--data '
{
"text": "<string>",
"model": "gemini-embedding-001"
}
'import requests
url = "https://api.example.com/search/embeddings"
payload = {
"text": "<string>",
"model": "gemini-embedding-001"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({text: '<string>', model: 'gemini-embedding-001'})
};
fetch('https://api.example.com/search/embeddings', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/search/embeddings",
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([
'text' => '<string>',
'model' => 'gemini-embedding-001'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$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.example.com/search/embeddings"
payload := strings.NewReader("{\n \"text\": \"<string>\",\n \"model\": \"gemini-embedding-001\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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.example.com/search/embeddings")
.header("Content-Type", "application/json")
.body("{\n \"text\": \"<string>\",\n \"model\": \"gemini-embedding-001\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/search/embeddings")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"text\": \"<string>\",\n \"model\": \"gemini-embedding-001\"\n}"
response = http.request(request)
puts response.read_body{
"embedding": [
123
],
"model": "<string>",
"dimensions": 123
}{
"error": {
"message": "<string>",
"request_id": "<string>",
"timestamp": "2023-11-07T05:31:56Z",
"details": {}
}
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}{
"error": {
"message": "<string>",
"request_id": "<string>",
"timestamp": "2023-11-07T05:31:56Z",
"details": {}
}
}Body
application/json
Request body for POST /utils/embeddings.
Text to embed
Minimum string length:
1Model override. Uses the server-configured default if omitted.
Example:
"gemini-embedding-001"
Was this page helpful?
⌘I

