API reference
Upsert vectors
Upsert one or more vectors into the collection. Each vector has a
user-provided string ID (up to 64 bytes), a dense embedding in the
vector attribute, and optional metadata attributes.
If a vector with the same ID already exists, it is replaced.
Supports both binary protobuf (application/protobuf) and ProtoJSON
(application/protobuf+json) request bodies.
POST
/
api
/
v1
/
vector
/
write
Upsert vectors
curl --request POST \
--url http://localhost:8080/api/v1/vector/write \
--header 'Content-Type: application/protobuf+json' \
--data '
{
"upsertVectors": [
{
"id": "<string>",
"attributes": {}
}
]
}
'import requests
url = "http://localhost:8080/api/v1/vector/write"
payload = { "upsertVectors": [
{
"id": "<string>",
"attributes": {}
}
] }
headers = {"Content-Type": "application/protobuf+json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/protobuf+json'},
body: JSON.stringify({upsertVectors: [{id: '<string>', attributes: {}}]})
};
fetch('http://localhost:8080/api/v1/vector/write', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_PORT => "8080",
CURLOPT_URL => "http://localhost:8080/api/v1/vector/write",
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([
'upsertVectors' => [
[
'id' => '<string>',
'attributes' => [
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/protobuf+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 := "http://localhost:8080/api/v1/vector/write"
payload := strings.NewReader("{\n \"upsertVectors\": [\n {\n \"id\": \"<string>\",\n \"attributes\": {}\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/protobuf+json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("http://localhost:8080/api/v1/vector/write")
.header("Content-Type", "application/protobuf+json")
.body("{\n \"upsertVectors\": [\n {\n \"id\": \"<string>\",\n \"attributes\": {}\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("http://localhost:8080/api/v1/vector/write")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/protobuf+json'
request.body = "{\n \"upsertVectors\": [\n {\n \"id\": \"<string>\",\n \"attributes\": {}\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"status": "success",
"vectorsUpserted": 2
}{
"status": "error",
"message": "<string>"
}{
"status": "error",
"message": "<string>"
}Body
application/protobuf+jsonapplication/protobuf
Request body for upserting vectors.
One or more vectors to upsert.
Show child attributes
Show child attributes
⌘I
Upsert vectors
curl --request POST \
--url http://localhost:8080/api/v1/vector/write \
--header 'Content-Type: application/protobuf+json' \
--data '
{
"upsertVectors": [
{
"id": "<string>",
"attributes": {}
}
]
}
'import requests
url = "http://localhost:8080/api/v1/vector/write"
payload = { "upsertVectors": [
{
"id": "<string>",
"attributes": {}
}
] }
headers = {"Content-Type": "application/protobuf+json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/protobuf+json'},
body: JSON.stringify({upsertVectors: [{id: '<string>', attributes: {}}]})
};
fetch('http://localhost:8080/api/v1/vector/write', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_PORT => "8080",
CURLOPT_URL => "http://localhost:8080/api/v1/vector/write",
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([
'upsertVectors' => [
[
'id' => '<string>',
'attributes' => [
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/protobuf+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 := "http://localhost:8080/api/v1/vector/write"
payload := strings.NewReader("{\n \"upsertVectors\": [\n {\n \"id\": \"<string>\",\n \"attributes\": {}\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/protobuf+json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("http://localhost:8080/api/v1/vector/write")
.header("Content-Type", "application/protobuf+json")
.body("{\n \"upsertVectors\": [\n {\n \"id\": \"<string>\",\n \"attributes\": {}\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("http://localhost:8080/api/v1/vector/write")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/protobuf+json'
request.body = "{\n \"upsertVectors\": [\n {\n \"id\": \"<string>\",\n \"attributes\": {}\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"status": "success",
"vectorsUpserted": 2
}{
"status": "error",
"message": "<string>"
}{
"status": "error",
"message": "<string>"
}