Skip to main content
Pinecone Docs
current

Search documentation

Type to search this documentation.

Generate vectors

Generate vector embeddings for input data. This endpoint uses Pinecone's hosted embedding models.

POST /embed

cURL
curl --request POST \
  --url https://api.pinecone.io/embed \
  --header 'Api-Key: <api-key>' \
  --header 'X-Pinecone-Api-Version: <x-pinecone-api-version>' \
  --header 'Content-Type: application/json' \
  --data '{
  "model": "multilingual-e5-large",
  "parameters": {
    "input_type": "passage",
    "truncate": "END"
  },
  "inputs": [
    {
      "text": "The quick brown fox jumps over the lazy dog."
    }
  ]
}'
Python
import requests

url = "https://api.pinecone.io/embed"

payload = {
  "model": "multilingual-e5-large",
  "parameters": {
    "input_type": "passage",
    "truncate": "END"
  },
  "inputs": [
    {
      "text": "The quick brown fox jumps over the lazy dog."
    }
  ]
}
headers = {
    "Api-Key": "<api-key>",
    "X-Pinecone-Api-Version": "<x-pinecone-api-version>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
JavaScript
const options = {method: "POST", headers: {"Api-Key": "<api-key>", "X-Pinecone-Api-Version": "<x-pinecone-api-version>", "Content-Type": "application/json"}, body: JSON.stringify({
  "model": "multilingual-e5-large",
  "parameters": {
    "input_type": "passage",
    "truncate": "END"
  },
  "inputs": [
    {
      "text": "The quick brown fox jumps over the lazy dog."
    }
  ]
})};

fetch("https://api.pinecone.io/embed", options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));
PHP
<?php

$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => "https://api.pinecone.io/embed",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => "{\"model\":\"multilingual-e5-large\",\"parameters\":{\"input_type\":\"passage\",\"truncate\":\"END\"},\"inputs\":[{\"text\":\"The quick brown fox jumps over the lazy dog.\"}]}",
  CURLOPT_HTTPHEADER => [
    "Api-Key: <api-key>",
    "X-Pinecone-Api-Version: <x-pinecone-api-version>",
    "Content-Type: application/json"
  ],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
Go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.pinecone.io/embed"

	payload := strings.NewReader("{\"model\":\"multilingual-e5-large\",\"parameters\":{\"input_type\":\"passage\",\"truncate\":\"END\"},\"inputs\":[{\"text\":\"The quick brown fox jumps over the lazy dog.\"}]}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Api-Key", "<api-key>")
	req.Header.Add("X-Pinecone-Api-Version", "<x-pinecone-api-version>")
	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))

}
Java
HttpResponse<String> response = Unirest.post("https://api.pinecone.io/embed")
  .header("Api-Key", "<api-key>")
  .header("X-Pinecone-Api-Version", "<x-pinecone-api-version>")
  .header("Content-Type", "application/json")
  .body("{\"model\":\"multilingual-e5-large\",\"parameters\":{\"input_type\":\"passage\",\"truncate\":\"END\"},\"inputs\":[{\"text\":\"The quick brown fox jumps over the lazy dog.\"}]}")
  .asString();
Ruby
require 'uri'
require 'net/http'

url = URI("https://api.pinecone.io/embed")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Api-Key"] = '<api-key>'
request["X-Pinecone-Api-Version"] = '<x-pinecone-api-version>'
request["Content-Type"] = 'application/json'
request.body = "{\"model\":\"multilingual-e5-large\",\"parameters\":{\"input_type\":\"passage\",\"truncate\":\"END\"},\"inputs\":[{\"text\":\"The quick brown fox jumps over the lazy dog.\"}]}"

response = http.request(request)
puts response.read_body
200
{
  "model": "multilingual-e5-large",
  "vector_type": "dense",
  "data": [
    {
      "values": [
        0.1,
        0.2,
        0.3
      ],
      "vector_type": null
    }
  ],
  "usage": {
    "total_tokens": 205
  }
}
400
{
  "error": {
    "code": "INVALID_ARGUMENT",
    "message": "Bad request. The request body included invalid request parameters."
  },
  "status": 400
}
401
{
  "error": {
    "code": "UNAUTHENTICATED",
    "message": "Invalid API key."
  },
  "status": 401
}
500
{
  "error": {
    "code": "UNKNOWN",
    "message": "Internal server error"
  },
  "status": 500
}
Api-Keystringrequired

An API Key is required to call Pinecone APIs. Get yours from the console.

X-Pinecone-Api-Versionstringrequired

Required date-based version header

Typestring
Default2026-07

Generate embeddings for inputs.

modelstringrequired

Example: multilingual-e5-large

Typestring

The model to use for embedding generation.

parameters?object

Additional model-specific parameters. Refer to the model guide for available model parameters.

inputsobject[]required

List of inputs to generate embeddings for.

Typeobject[]
Show child attributes
text?string

The text input to generate embeddings for.

Example: The quick brown fox jumps over the lazy dog.

Typestring

200 — OK

Embeddings generated for the input.

modelstringrequired

The model used to generate the embeddings

Example: multilingual-e5-large

Typestring
vector_typestringrequired

Indicates whether the response data contains 'dense' or 'sparse' embeddings.

Example: dense

Typestring
dataobject[]required

The embeddings generated for the inputs.

Typeobject[]
Show child attributes
valuesnumber[]required

The dense embedding values.

Typenumber[]
vector_typestringrequired

Indicates whether this is a 'dense' or 'sparse' embedding.

Typestring
usageobjectrequired

Usage statistics for the model inference.

Typeobject
Show child attributes
total_tokens?integer

Total number of tokens consumed across all inputs.

Required range: 0 <= x. Example: 205

Typeinteger
Suggest an edit

Propose a replacement for this page. The site team reviews it before applying any changes.

Export
Documentation menu