Create embeddings
POST /projects/:projectid/embeddings
Generate vector embeddings for text.
Authenticates a project API key, then sends one text or a batch of texts to Intellectible's hosted embedding worker.
Authentication
- Project API key: The credential for everything external. Created in Project Settings, bound to one project, and limited to the scopes it was granted. Format:
proj.<keyId>.<secret>. - Required permission:
embeddings.createon all.
Path parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
projectid | string | Yes | - | The project id. |
Request body
Content type: application/json
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
input | string | string[] | Yes | - | The text to embed, or a non-empty array of texts to embed as a batch. |
Example
{
"input": [
"First text to embed",
"Second text to embed"
]
}
Example request
curl -X POST \
-H "Authorization: proj.KEY_ID.SECRET" \
-H "Content-Type: application/json" \
-d '{"input":["First text to embed","Second text to embed"]}' \
{{BASE_URL}}/projects/{{PROJECT_ID}}/embeddings
Responses
200
An embedding result for each input, in input order.
{
"data": [
{
"embedding": [
0.12,
-0.03
]
}
]
}
400
input is missing, empty, or contains a value that is not a string.
401
Missing, invalid, or disabled project API key.
403
The key is not permitted to create embeddings.
502
The queue service or embedding worker could not complete the request.