Skip to content
Go To Dashboard

Data

Provision and use Redis, vector, and full-text search databases instantly — all accessible over REST, no Upstash account, no infrastructure setup, just API calls.

import { withSapiom } from "@sapiom/axios";
import axios from "axios";
const client = withSapiom(axios.create(), {
apiKey: process.env.SAPIOM_API_KEY,
serviceName: "Data Redis",
agentName: "my-agent",
});
const mgmt = "https://upstash.services.sapiom.ai";
// Step 1: Create a Redis database
const { data: db } = await client.post(`${mgmt}/v1/redis/databases`, {
name: "my-cache",
region: "us-east-1",
ttl: "1d",
});
console.log("Created:", db.id, db.url);
// Step 2: Use it via the resource URL
const { data: result } = await client.post(`${db.url}/set/my-key/my-value`);
console.log(result); // "OK"

Sapiom provides a two-plane architecture for data services:

  1. Provision a resource — Call the management API at upstash.services.sapiom.ai to create a Redis database, vector index, or search database. You get back a resource URL.
  2. Use the resource — Send commands to the resource URL (e.g., https://{id}.redis.data.sapiom.ai). Sapiom proxies requests to the underlying Upstash instance with automatic authentication.

Resources have optional TTLs (time-to-live). When a TTL expires, the resource transitions to expired status and is eventually cleaned up. You can extend a resource’s lifetime by updating its expiresAt field.

Each account can provision up to 50 resources per service (50 Redis databases, 50 vector indexes, 50 search indexes).

Powered by Upstash. Upstash provides serverless Redis, vector, and full-text search databases with per-request pricing and global replication.

Management plane (https://upstash.services.sapiom.ai):

MethodPathDescription
POST/v1/redis/databasesCreate a Redis database
GET/v1/redis/databasesList all Redis databases
GET/v1/redis/databases/:idGet a Redis database
PATCH/v1/redis/databases/:idUpdate a Redis database
DELETE/v1/redis/databases/:idDelete a Redis database
POST/v1/vector/indexesCreate a vector index
GET/v1/vector/indexesList all vector indexes
GET/v1/vector/indexes/:idGet a vector index
PATCH/v1/vector/indexes/:idUpdate a vector index
DELETE/v1/vector/indexes/:idDelete a vector index
POST/v1/search/indexesCreate a search index
GET/v1/search/indexesList all search indexes
GET/v1/search/indexes/:idGet a search index
PATCH/v1/search/indexes/:idUpdate a search index
DELETE/v1/search/indexes/:idDelete a search index

Data plane (per-resource URLs):

Host PatternDescription
{id}.redis.data.sapiom.aiRedis commands (all paths proxied)
{id}.vector.data.sapiom.aiVector operations (upsert, query, fetch, etc.)
{id}.search.data.sapiom.aiSearch operations (upsert, search, etc.)

Endpoint: POST https://upstash.services.sapiom.ai/v1/redis/databases

ParameterTypeRequiredDescription
namestringYesDatabase name (1-128 characters)
regionstringNoAWS region (default: us-east-1)
ttlstringNoTime-to-live: 30m, 1h, 1d, etc. Max 30 days
{
"name": "my-cache",
"region": "us-east-1",
"ttl": "1d"
}
{
"id": "res_ab3k9mzxq1wp7rvnlt82",
"type": "redis",
"name": "my-cache",
"status": "provisioning",
"url": "https://res_ab3k9mzxq1wp7rvnlt82.redis.data.sapiom.ai",
"region": "us-east-1",
"expiresAt": "2026-02-26T13:45:00.000Z",
"createdAt": "2026-02-25T13:45:00.000Z"
}

Endpoint: PATCH https://upstash.services.sapiom.ai/v1/redis/databases/:id

ParameterTypeRequiredDescription
namestringNoNew name (1-128 characters)
expiresAtstringNoNew expiry (ISO 8601, must be in the future)

Endpoint: DELETE https://upstash.services.sapiom.ai/v1/redis/databases/:id

Returns 204 No Content on success.

Once provisioned, interact with Redis entirely over REST — no TCP connections or Redis client libraries needed. Send any Upstash Redis REST API command to the resource URL:

// SET a key
await client.post(`${db.url}/set/my-key/my-value`);
// GET a key
const { data } = await client.get(`${db.url}/get/my-key`);
// Pipeline multiple commands
const { data: results } = await client.post(`${db.url}/pipeline`, [
["set", "key1", "value1"],
["set", "key2", "value2"],
["get", "key1"],
]);

Endpoint: POST https://upstash.services.sapiom.ai/v1/vector/indexes

ParameterTypeRequiredDescription
namestringYesIndex name (1-128 characters)
regionstringNoAWS region (default: us-east-1)
dimensionsnumberNoVector dimensions, 1-10000 (default: 1536)
similarityFunctionstringNocosine, euclidean, or dotProduct (default: cosine)
ttlstringNoTime-to-live: 30m, 1h, 1d, etc. Max 30 days
{
"name": "my-embeddings",
"dimensions": 1536,
"similarityFunction": "cosine",
"ttl": "7d"
}
{
"id": "res_xk7p2mwn9qr4jtbv5s01",
"type": "vector",
"name": "my-embeddings",
"status": "provisioning",
"url": "https://res_xk7p2mwn9qr4jtbv5s01.vector.data.sapiom.ai",
"region": "us-east-1",
"dimensions": 1536,
"similarityFunction": "cosine",
"expiresAt": "2026-03-04T13:45:00.000Z",
"createdAt": "2026-02-25T13:45:00.000Z"
}

Use the Upstash Vector REST API through the resource URL:

// Upsert vectors
await client.post(`${index.url}/upsert`, [
{ id: "doc-1", vector: [0.1, 0.2, ...], metadata: { title: "Hello" } },
{ id: "doc-2", vector: [0.3, 0.4, ...], metadata: { title: "World" } },
]);
// Query similar vectors
const { data } = await client.post(`${index.url}/query`, {
vector: [0.1, 0.2, ...],
topK: 5,
includeMetadata: true,
});

Endpoint: POST https://upstash.services.sapiom.ai/v1/search/indexes

ParameterTypeRequiredDescription
namestringYesIndex name (1-128 characters)
regionstringNous-central1 or eu-west-1 (default: us-central1)
ttlstringNoTime-to-live: 30m, 1h, 1d, etc. Max 30 days
{
"name": "my-search-index",
"region": "us-central1",
"ttl": "7d"
}
{
"id": "res_mn4q8rvw2xp5kjtb6h93",
"type": "search",
"name": "my-search-index",
"status": "provisioning",
"url": "https://res_mn4q8rvw2xp5kjtb6h93.search.data.sapiom.ai",
"region": "us-central1",
"expiresAt": "2026-03-04T13:45:00.000Z",
"createdAt": "2026-02-25T13:45:00.000Z"
}

Use the Upstash Search REST API through the resource URL.

// Upsert documents — content is a key-value object matching the index schema
await client.post(`${searchDb.url}/upsert/${indexName}`, [
{ id: "doc-1", content: { title: "TypeScript", text: "TypeScript is a typed superset of JavaScript" } },
{ id: "doc-2", content: { title: "Rust", text: "Rust is a systems programming language" } },
]);
// Search
const { data } = await client.post(`${searchDb.url}/search/${indexName}`, {
query: "typed programming language",
topK: 5,
});

All resources follow this lifecycle:

StatusDescription
provisioningResource is being created (transitions to active within seconds)
activeReady for use
expiredTTL has passed, pending cleanup
deletingDeletion in progress
deletedFully removed
CodeDescription
400Invalid request — check parameter formats (name length, TTL format, dimensions range)
402Payment required — ensure you’re using the Sapiom SDK
404Resource not found or not owned by your account
409Resource is not in a valid state for the operation (e.g., deleting a non-active resource)
410Resource has expired (data plane only)
422Resource limit exceeded — maximum 50 per service per account
429Rate limit exceeded
502Upstream provisioning error from Upstash
import { withSapiom } from "@sapiom/axios";
import axios from "axios";
const client = withSapiom(axios.create(), {
apiKey: process.env.SAPIOM_API_KEY,
serviceName: "Data Redis",
agentName: "my-agent",
});
const mgmt = "https://upstash.services.sapiom.ai";
async function cacheWorkflow() {
// Create a Redis database with 1-hour TTL
const { data: db } = await client.post(`${mgmt}/v1/redis/databases`, {
name: "session-cache",
ttl: "1h",
});
console.log(`Redis ready at ${db.url}`);
// Store session data
await client.post(`${db.url}/set/session:abc/active`);
await client.post(`${db.url}/expire/session:abc/3600`);
// Read it back
const { data: value } = await client.get(`${db.url}/get/session:abc`);
console.log("Session:", value.result); // "active"
// List all databases
const { data: list } = await client.get(`${mgmt}/v1/redis/databases`);
console.log(`Total databases: ${list.databases.length}`);
// Clean up
await client.delete(`${mgmt}/v1/redis/databases/${db.id}`);
}
await cacheWorkflow();
OperationCost
Redis command$0.000002 per command
Redis pipeline$0.000002 per command in batch
Vector upsert$0.000004 per vector
Vector query/fetch/other$0.000004 per request
Search upsert$0.00005 per request
Search query$0.00005 per request
Search query with reranking$0.00105 per request
Management operations (create, list, get, update, delete)Nominal