Create an embedding

Creates a new embedding configuration for a Warehouse source.

POST https://warehouse.betterstack.com/api/v1/sources/{source_id}/embeddings

URL parameters

source_id
required string

Headers

Authorization
required string
Content-Type
required string

Body parameters

embed_from
required string
embed_to
required string
model
required string
dimension
required integer
201

Response body

{
  "data": {
    "id": "9012",
    "type": "embedding",
    "attributes": {
      "embed_from": "message",
      "embed_to": "message_embedding",
      "dimension": 512,
      "model": "embeddinggemma:300m"
    }
  }
}
401

Response body

{
  "errors": "Invalid authentication"
}
404

Response body

{
  "errors": "Source with the provided ID was not found"
}
422

Response body

{
  "errors": "Validation errors",
  "invalid_values": {
    "embed_from": [
      "cannot be the same as embed_to"
    ]
  }
}

Example cURL

Example
curl --request POST \
  --url https://warehouse.betterstack.com/api/v1/sources/123/embeddings \
  --header "Authorization: Bearer $TOKEN" \
  --header 'Content-Type: application/json' \
  --data '{
    "embed_from": "description",
    "embed_to": "description_embedding",
    "model": "embeddinggemma:300m",
    "dimension": 512
  }'