Skip to main content

Upsert Vectors

POST /api/v1/apps/{appId}/vector/{vectorName}/upsert
vectors
object[]
required
Non-empty array of points to insert or update.
curl -X POST https://suite.sundaypyjamas.com/api/v1/apps/app_123/vector/docs/upsert \
  -H "Authorization: Bearer spj_ai_your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "vectors": [
      { "id": "chunk_1", "vector": [0.012, -0.034, "..."], "payload": { "text": "Refunds are processed within 5 business days." } }
    ]
  }'
{ "upserted": 1, "collectionName": "docs" }

Query Vectors

POST /api/v1/apps/{appId}/vector/{vectorName}/query
vector
number[]
Query embedding. Required unless query is provided and the app’s vector backend is a Bedrock Knowledge Base.
query
string
Natural-language query text. Only used (and required) for apps backed by a Bedrock Knowledge Base — ignored by other backends.
topK
number
default:"10"
Number of nearest results to return.
filter
object
Backend-specific metadata filter.
includePayload
boolean
default:"true"
Include each result’s stored payload in the response.
curl -X POST https://suite.sundaypyjamas.com/api/v1/apps/app_123/vector/docs/query \
  -H "Authorization: Bearer spj_ai_your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{ "vector": [0.011, -0.028, "..."], "topK": 5 }'
{
  "results": [
    {
      "id": "chunk_1",
      "score": 0.912,
      "payload": { "text": "Refunds are processed within 5 business days." }
    }
  ]
}

Errors

StatusErrorApplies to
400vectorSize must be a positive integerCreate Index
400distance must be one of: Cosine, Dot, Euclid, ManhattanCreate Index
400vectors must be a non-empty arrayUpsert
400vector must be a non-empty array of numbers (or query for Bedrock Knowledge Base apps)Query
401Unauthorized or app not foundAll
404Collection "{vectorName}" not foundQuery, Upsert, Get/Delete Index
409Collection "{vectorName}" already existsCreate Index