Skip to main content
POST
/
embeddings
/
retrieve_by_ids
Retrieve Embeddings Based On Chunk Ids
curl --request POST \
  --url https://api.usecortex.ai/embeddings/retrieve_by_ids \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "chunk_ids": [
    "CortexEmbeddings123_0",
    "CortexEmbeddings123_1"
  ],
  "tenant_id": "tenant_1234",
  "sub_tenant_id": "sub_tenant_4567"
}'
{
  "embeddings": [
    [
      0.123413,
      0.655367,
      0.987654,
      0.123456,
      0.789012
    ],
    [
      0.123413,
      0.655367,
      0.987654,
      0.123456,
      0.789012
    ]
  ],
  "not_found_chunk_ids": [
    "<string>"
  ],
  "success": true,
  "message": "Embeddings retrieved successfully"
}
Hit the Try it button to try this API now in our playground. It’s the best way to check the full request and response in one place, customize your parameters, and generate ready-to-use code snippets.

Sample Request

curl --request POST \
  --url https://api.usecortex.ai/embeddings/retrieve_by_ids \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "chunk_ids": [],
  "tenant_id": "tenant_1234",
  "sub_tenant_id": "sub_tenant_4567"
}'
Retrieve embedding vectors for specific chunk IDs that you previously obtained from uploading embeddings or searching.

Requirements

  • chunk_ids: Array of valid chunk ID strings (cannot be empty)
  • tenant_id: Required for multi-tenancy support
  • sub_tenant_id: Optional, defaults to tenant_id if not provided

Response Details

  • embeddings: Dictionary mapping chunk IDs to their embedding vectors
  • not_found_chunk_ids: Array of chunk IDs that were not found in the system

Sample Response

{
  "embeddings": {
    "CortexEmbeddings123_0": [
      21.0,
      22.0,
      23.0,
      24.0,
      25.0,
      26.0
    ],
    "CortexEmbeddings123_1": [
      20.100000381469727,
      20.200000762939453,
      20.299999237060547,
      20.399999618530273,
      20.5,
      20.600000381469727
    ],
    "CortexEmbeddings456_0": [
      1.5,
      2.5,
      8.5,
      8.5,
      8.5,
      6.5
    ]
  },
  "not_found_chunk_ids": [
    "CortexEmbeddings789_2"
  ]
}

Error Responses

All endpoints return consistent error responses following the standard format. For detailed error information, see our Error Responses documentation.

Authorizations

Authorization
string
header
required

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

Body

application/json
chunk_ids
string[]
required

The chunk IDs of the source you want to get embeddings for

Example:
[
"CortexEmbeddings123_0",
"CortexEmbeddings123_1"
]
tenant_id
string
required

Unique identifier for the tenant/organization

Example:

"tenant_1234"

sub_tenant_id
string
default:""

Optional sub-tenant identifier used to organize data within a tenant. If omitted, the default sub-tenant created during tenant setup will be used.

Example:

"sub_tenant_4567"

Response

Successful Response

embeddings
object
required

Dictionary mapping chunk IDs to their embedding vectors (lists of float values)

Example:
[
[
0.123413,
0.655367,
0.987654,
0.123456,
0.789012
],
[
0.123413,
0.655367,
0.987654,
0.123456,
0.789012
]
]
not_found_chunk_ids
string[]
required

List of chunk IDs that were not found in the embeddings collection

success
boolean
default:true

Indicates whether the embeddings retrieval operation completed successfully

Example:

true

message
string
default:Embeddings retrieved successfully

Status message about the retrieval operation

I