---
title: "Create embeddings"
method: POST
path: "/api/inference/v1/embeddings"
tags: ["AI"]
---

# Create embeddings

`POST /api/inference/v1/embeddings`

## Request

- Base URL: `https://docs.anzworldline-solutions.com.au`
- URL: `https://docs.anzworldline-solutions.com.au/api/inference/v1/embeddings`
- Auth: none declared
- TypeScript: <https://skmtc.dev/anzworldline-solutions/apis/dotcms-rest-api/docs/api/inference/v1/embeddings/post.ts> (a function with typed inputs; its response is checked against the schema)

Embeds text against the model the resolved site has configured for embeddings, in the OpenAI-compatible request and response shape. The input field accepts either a single string or an array of strings embedded as one batch; the response is always a list with one entry per input, each carrying the index of the input it corresponds to. An absent, null or empty input is refused, as is a blank or whitespace-only string wherever it appears, and every element of an array must be a string — arrays of token ids are not supported. The model field is required and is validated against the site's embeddings configuration, not its chat models; there is no implicit default. Every response reports the serving site in the X-dotCMS-Resolved-Site header.

## Query parameters

- `siteId` string

## Request body

- EmbeddingsRequestView: Embeddings request in the OpenAI-compatible shape
  - `model` string: Model id, as configured for this site's embeddings
  - `input` JsonNode

## Response `200`

The vectors, one per input

- EmbeddingListView: Embeddings response in the OpenAI-compatible shape
  - `object` string: Object type
  - `model` string: Model that served the request
  - `data` EmbeddingView[]: One entry per input
    - `object` string: Object type
    - `index` integer: Position of the input this vector embeds
    - `embedding` number[]: The vector
  - `usage` UsageView: Tokens consumed
    - `prompt_tokens` integer: Tokens across every input
    - `total_tokens` integer: Total tokens

## Other responses

- `400`: Malformed request, or one asking for something unsupported
- `401`: Unauthorized - authentication required
- `403`: Forbidden - the caller cannot read the requested site
- `404`: The requested model is not configured for the resolved site
- `502`: The model provider failed to complete the request

## Changes

- **2026-10-30** `4fd8e917d458`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/anzworldline-solutions/apis/dotcms-rest-api/changes/api/inference/v1/embeddings/post.md)

---

[API](https://skmtc.dev/anzworldline-solutions/apis/dotcms-rest-api.md) - [All operations](https://skmtc.dev/anzworldline-solutions/apis/dotcms-rest-api/llms.txt) - [OpenAPI document](https://skmtc.dev/anzworldline-solutions/apis/dotcms-rest-api/revisions/4fd8e917d458?raw)
