API Reference
Base URL https://polyembed.com/api/v1
Authentication
Header
Authorization: Bearer pe_<team>_<key>
Endpoints
POST
/api/v1/embed/
Generate an embedding vector for the given text.
| Field | Type | Required | Values |
|---|---|---|---|
| text | string | Yes | any length |
| input_type | string | Yes | "document" | "query" |
| model | string | No | "base" | "enhanced" |
| shielded | boolean | No | true | false |
Response — 200
{
"embedding": [0.0229, 0.0319, -0.0165, ...],
"model": "base",
"shielded": false,
"dimensions": 1024
}
Code
Cause
200
Success
400
Missing or invalid fields
401
Invalid, revoked, or expired key
429
Rate limit exceeded
503
Enhanced model unavailable
Examples
Python
cURL
Node.js
import requests response = requests.post( "https://polyembed.com/api/v1/embed/", headers={"Authorization": f"Bearer {api_key}"}, json={ "text": "Quarterly revenue exceeded projections by 12%", "input_type": "document", } ) embedding = response.json()["embedding"] # 1024 floats
curl -X POST https://polyembed.com/api/v1/embed/ \ -H "Authorization: Bearer pe_your_team_key" \ -H "Content-Type: application/json" \ -d '{ "text": "Quarterly revenue exceeded projections by 12%", "input_type": "document" }'
const data = await fetch( "https://polyembed.com/api/v1/embed/", { method: "POST", headers: { "Authorization": `Bearer ${apiKey}`, "Content-Type": "application/json", }, body: JSON.stringify({ text: "Quarterly revenue exceeded projections by 12%", input_type: "document", }), } ).then(r => r.json()); const embedding = data.embedding; // 1024 floats
Shielded request
curl -X POST https://polyembed.com/api/v1/embed/ \ -H "Authorization: Bearer pe_your_team_key" \ -H "Content-Type: application/json" \ -d '{ "text": "Classified document excerpt", "input_type": "document", "shielded": true }' # Embedding is encrypted. Preserves similarity ordering. # Cannot be reversed. Only comparable within same team.