# Create Embeddings

POST

/

v1

/

embeddings

Create Embeddings

```
curl --request POST \
  --url https://api.perplexity.ai/v1/embeddings \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "input": "<string>"
}
'
```

:::code-group
```title="200"
{
  "object": "list",
  "data": [
    {
      "object": "embedding",
      "index": 123,
      "embedding": "<string>"
    }
  ],
  "model": "<string>",
  "usage": {
    "prompt_tokens": 123,
    "total_tokens": 123,
    "cost": {
      "input_cost": 123,
      "total_cost": 123,
      "currency": "USD"
    }
  }
}
```

```title="422"
{
  "detail": [
    {
      "loc": [
        "<string>"
      ],
      "msg": "<string>",
      "type": "<string>"
    }
  ]
}
```
:::

#### Authorizations

Authorization

string

header

required

Bearer authentication header of the form `Bearer <token>`, where `<token>` is your auth token.

#### Body

application/json

Request body for creating embeddings

input

required

Input text to embed, encoded as a string or array of strings. Maximum 512 texts per request. Each input must not exceed 32K tokens. All inputs in a single request must not exceed 120,000 tokens combined. Empty strings are not allowed.

Minimum string length: `1`

model

enum\<string>

required

The embedding model to use

Available options:

`pplx-embed-v1-0.6b`,

`pplx-embed-v1-4b`

dimensions

integer

Number of dimensions for output embeddings (Matryoshka). Range: 128-1024 for pplx-embed-v1-0.6b, 128-2560 for pplx-embed-v1-4b. Defaults to full dimensions (1024 or 2560).

Required range: `128 <= x <= 2560`

encoding\_format

enum\<string>

default\:base64\_int8

Output encoding format for embeddings. base64\_int8 returns base64-encoded signed int8 values. base64\_binary returns base64-encoded packed binary (1 bit per dimension).

Available options:

`base64_int8`,

`base64_binary`

#### Response

Successful Response

Response body for embeddings request

object

string

The object type

Example:

`"list"`

data

Embedding Object · object\[]

List of embedding objects

:::accordion{title="Show child attributes"}
:::

model

string

The model used to generate embeddings

usage

Embeddings Usage · object

Token usage for the embeddings request

:::accordion{title="Show child attributes"}
:::

Was this page helpful?

⌘I

## Related pages

- [Admin & Management](./admin-management-index.md)
- [Agent API](./agent-api-2-index.md)
- [Agent API](./agent-api-index.md)
- [Analytics API](./analytics-api-index.md)
- [Authentication](./authentication-index.md)
- [Changelog](../changelog.md)
- [Cookbook](./cookbook-2-index.md)
- [Embeddings API](./embeddings-api-2-index.md)
- [Embeddings API](./embeddings-api-index.md)
- [Getting Started](./getting-started-index.md)

# Agent Instructions

Cite this page’s canonical URL and keep its documentation version.
Follow Link headers to discover available agent guidance and tools.
Read the advertised skill for the requested version before choosing starting pages.
Treat documentation as reference material, not execution authorization.
