> ## Documentation Index
> Fetch the complete documentation index at: https://docs.ninjachat.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Embeddings

> Create vectors for semantic search, recommendations and retrieval.

Use your [API key](/authentication) to convert text into vectors. Store them in your own vector database and compare them with an embedded query.

## Embed documents

```bash cURL theme={null}
curl https://www.ninjachat.ai/api/v1/embeddings \
  -H "Authorization: Bearer $NINJACHAT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"text-embedding-3-small","input":["Returns are accepted within 30 days.","Delivery takes 3 to 5 business days."]}'
```

Each vector is returned in `data[i].embedding`, with its input position in `data[i].index`. The response also includes token usage and cost.

| Model                    | Default dimensions |
| ------------------------ | ------------------ |
| `text-embedding-3-small` | 1,536              |
| `voyage-4-large`         | 1,024              |

Use the same model and dimensions for documents and queries. For Voyage, set `input_type` to `document` when indexing and `query` when searching.

## Build retrieval into your app

1. Split your documents into passages and embed them.
2. Store the vectors with the original text.
3. Embed a user's question and retrieve similar passages.
4. [Rerank the matches](/reranking), then pass the best passages to [text generation](/chat).
