POST
/
embeddings
/
image
Generate Image Embedding
curl --request POST \
  --url https://mavi-backend.memories.ai/serve/api/v2/embeddings/image \
  --header 'Authorization: <api-key>' \
  --header 'Content-Type: multipart/form-data' \
  --form model=multimodalembedding@001 \
  --form file='@example-file'
{
  "code": "0000",
  "msg": "success",
  "data": {
    "embedding": [
      0.0234375,
      -0.015625,
      0.0078125,
      0.0390625,
      -0.0234375,
      "... (continues for vector length)"
    ]
  },
  "success": true,
  "failed": false
}
This endpoint generates vector embeddings for images. You can either upload an image file directly or reference an existing asset by its ID.

Code Examples

const formData = new FormData();
formData.append('file', imageFile);
formData.append('model', 'multimodalembedding@001');

const response = await fetch('/embeddings/image', {
  method: 'POST',
  headers: {
    'Authorization': 'sk-8483027fe3abfe535f6ae01a9979b4f7'
  },
  body: formData
});

const data = await response.json();
console.log(data);

Request Parameters

This endpoint supports two methods of providing images: Method 1: File Upload (multipart/form-data)
FieldTypeRequiredDescription
filefileYesImage file to upload (JPEG, PNG, GIF, WebP, etc.)
modelstringYesEmbedding model name
Method 2: Asset ID (application/json)
FieldTypeRequiredDescription
asset_idstringYesExisting image asset ID from a previous upload
modelstringYesEmbedding model name
Supported Models:
  • multimodalembedding@001 - Google’s multimodal embedding model
  • mobileclip - Efficient mobile-optimized CLIP model

Response

Returns the embedding vector synchronously.
{
  "code": "0000",
  "msg": "success",
  "data": {
    "embedding": [
      0.0234375,
      -0.015625,
      0.0078125,
      0.0390625,
      -0.0234375,
      "... (continues for vector length)"
    ]
  },
  "success": true,
  "failed": false
}

Response Parameters

ParameterTypeDescription
codestringResponse code indicating the result status (“0000” indicates success)
msgstringResponse message describing the operation result
dataobjectResponse data object containing the embedding
data.embeddingarray[number]Vector embedding array (dimensionality depends on the model)
successbooleanIndicates whether the operation was successful
failedbooleanIndicates whether the operation failed

Notes

  • Image embeddings are returned synchronously in the response
  • Embedding dimensions vary by model (typically 512-1024 dimensions)
  • Supported image formats: JPEG, PNG, GIF, WebP, BMP, TIFF
  • Maximum file size may vary by deployment
  • Use the file upload method for one-time embedding generation
  • Use the asset ID method when you’ve already uploaded the image via the /upload endpoint
  • Embeddings can be used for image similarity search, classification, and clustering

Authorizations

Authorization
string
header
required

Body

model
enum<string>
required

Embedding model name

Available options:
multimodalembedding@001,
mobileclip
Example:

"multimodalembedding@001"

file
file

Image file to upload

Response

200 - application/json

Embedding generated successfully

code
string

Response code indicating the result status

Example:

"0000"

msg
string

Response message describing the operation result

Example:

"success"

data
object

Response data object containing the embedding

success
boolean

Indicates whether the operation was successful

Example:

true

failed
boolean

Indicates whether the operation failed

Example:

false