Skip to main content
POST

Authorizations

Authorization
string
header
required

All endpoints require Bearer Token authentication

Add the following to your request headers:

Authorization: Bearer YOUR_API_KEY

Path Parameters

model
string
required

Embedding model name, e.g. gemini-embedding-2-preview

Example:

"gemini-embedding-2-preview"

Body

application/json
content
object
required

The content to embed

taskType
enum<string>

Embedding task type, which affects the optimization direction of the embedding vector. Note: gemini-embedding-2-preview does not support this field; that model uses a prompt prefix approach to specify task types (e.g. task: search result | query: {content})

Available options:
RETRIEVAL_QUERY,
RETRIEVAL_DOCUMENT,
SEMANTIC_SIMILARITY,
CLASSIFICATION,
CLUSTERING,
QUESTION_ANSWERING,
FACT_VERIFICATION,
CODE_RETRIEVAL_QUERY
title
string

Document title, only effective when taskType is RETRIEVAL_DOCUMENT

outputDimensionality
integer

Output vector dimensionality, used for dimensionality reduction. Default 3072

Response

Embedding response

embedding
object

Embedding result