---
title: "Get Sparse Embeddings. Returns a 424 status code if the model is not an embedding model with SPLADE pooling."
method: POST
path: "/embed_sparse"
tags: ["Text Embeddings Inference"]
---

# Get Sparse Embeddings. Returns a 424 status code if the model is not an embedding model with SPLADE pooling.

`POST /embed_sparse`

## Request body

- EmbedSparseRequest
  - `inputs` union, required
    - union
      - string
      - integer[]
    - InputType[]
      - union
        - string
        - integer[]
  - `prompt_name` string, nullable — The name of the prompt that should be used by for encoding. If not set, no prompt will be applied. Must be a key in the `sentence-transformers` configuration `prompts` dictionary. For example if ``prompt_name`` is "query" and the ``prompts`` is {"query": "query: ", ...}, then the sentence "What is the capital of France?" will be encoded as "query: What is the capital of France?" because the prompt text will be prepended before any text to encode.
  - `truncate` boolean, nullable
  - `truncation_direction` 'Left' | 'Right'

## Response `200`

Embeddings

- array[]
  - SparseValue[]
    - `index` integer, required
    - `value` number, float, required

## Other responses

- `400` — Batch is empty
- `413` — Batch size error
- `422` — Tokenization error
- `424` — Embedding Error
- `429` — Model is overloaded

## Changes

- **2025-09-01** `9988d0e89620` — 4 warning, 1 info
  - added the new `Empty` enum value to the `error_type` response property for the response status `413`
  - added the new `Empty` enum value to the `error_type` response property for the response status `422`
  - added the new `Empty` enum value to the `error_type` response property for the response status `424`
  - added the new `Empty` enum value to the `error_type` response property for the response status `429`
  - …1 more
- **2024-06-28** `b923798e3868` — 1 breaking, 4 info
  - removed `subschema #1, subschema #2` from the `inputs` request property `oneOf` list
  - added the new optional request property `prompt_name`
  - added the new optional request property `truncation_direction`
  - the request property `truncate` became nullable
  - …1 more
- **2024-03-07** `e3df177c5175` — 1 info
  - endpoint added
- **2023-10-13** `8c00768ef703` — 1 breaking
  - api path removed without deprecation

[Change history](https://skmtc.dev/huggingface/apis/text-embeddings-inference/changes/embed_sparse/post.md)

---

[API](https://skmtc.dev/huggingface/apis/text-embeddings-inference.md) · [All operations](https://skmtc.dev/huggingface/apis/text-embeddings-inference/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/huggingface/text-embeddings-inference/revisions/4656d1fa2ca4/schema)
