canonical: https://jentic.com/apis/momentohq.com/momento-cache-http-api

# Momentohq Momento Cache HTTP API

Jentic publishes the only available OpenAPI specification for Momento Cache HTTP API, keeping it validated and agent-ready. Momento is a serverless cache that exposes a minimal HTTP surface for get, set, and delete operations against named caches, removing the need for a long-lived TCP connection or a Redis-style client library. The HTTP API is purpose-built for serverless and edge runtimes where opening connections is expensive, and it integrates cleanly with Lambda, Cloudflare Workers, and other ephemeral execution environments. It targets engineering teams that want managed caching without the operational cost of running Redis themselves.

## For AI agents

Get, set, and delete cache items from a Momento serverless cache via a minimal HTTP API designed for serverless and edge runtimes.

## Scope

Does not handle persistent database storage, full-text search, or pub-sub messaging - use for ephemeral key-value caching only.

## Capabilities

- Set cache items in a named Momento cache via HTTP PUT
- Get cache items by key from a named Momento cache
- Delete cache items by key when the underlying source data changes
- Cache responses inside Lambda or Cloudflare Workers without a persistent client connection
- Use Momento as a session or rate-limit store for serverless APIs

## Use cases

### Lambda-Friendly API Response Caching

Cache slow API responses inside AWS Lambda or other serverless functions without paying the cost of opening a Redis connection on every cold start. Momento's HTTP API returns cached values via a single GET call and writes via PUT, so a Lambda handler checks the cache, falls through to the upstream call on miss, and writes the response back - all in plain HTTP. Suitable for serverless backends where connection-pool exhaustion or cold-start latency rules out connection-based cache clients.

Example prompt: Inside a Lambda handler, call GET `/cache/{cacheName}` with the request hash key; on 404, call the upstream, then PUT `/cache/{cacheName}` with the response body.

### Edge-Runtime Session Storage

Store short-lived session tokens or per-user data in Momento from Cloudflare Workers or Vercel Edge Functions where opening a TCP connection is impossible. The HTTP-only surface means the cache works exactly the same way at the edge as in regular cloud functions. Useful for teams adopting edge runtimes for low-latency reads but still needing a shared key-value store.

Example prompt: Call PUT `/cache/sessions` with the session token under the user's session key; on the next request, GET `/cache/sessions` retrieves it.

### Cache Invalidation on Database Updates

Drop stale cache entries with DELETE whenever the underlying database row changes, so reads served from Momento stay consistent with the source of truth. The minimal HTTP surface means the invalidation logic is one line in any language with an HTTP client. Practical for teams running write-through caching against Postgres or DynamoDB.

Example prompt: On a database update event, call DELETE `/cache/{cacheName}` with the affected row's key to invalidate the stale cache entry.

### Agent-Driven Cache Operations

AI agents that need ephemeral storage between tool calls use Momento through Jentic to set and get intermediate values without holding the bearer token in their context. Jentic's spec is the only structured definition for this HTTP API, so schema-aware agents rely on it for tool selection and parameter shape.

Example prompt: Search Jentic for 'cache a value in a serverless store', load PUT `/cache/{cacheName}`, and execute with the cache name and key-value pair.

## Key endpoints

| Method | Path | Description |
| --- | --- | --- |
| GET | `/cache/{cacheName}` | Get a cached item by key from a named cache |
| PUT | `/cache/{cacheName}` | Set a cached item under a key in a named cache |
| DELETE | `/cache/{cacheName}` | Delete a cached item by key from a named cache |

## Key resources

- **Cache** — Get, set, and delete cache items in a named Momento cache via HTTP

## Why Jentic

- **Setup:** Wiring the Momento Cache HTTP API by hand means managing its bearer token, targeting the correct regional cell host such as cell-1-us-west-2, and coding the get, set, and delete calls yourself. Through Jentic you install once, import the Momento Cache HTTP API from the API Directory, store the token once, and your agent calls it.
- **Permission scoping:** Momento puts the cache name in the URL path (`/cache/{cacheName}`), so a rule can pin your agent to one cache. You choose the operations it may call, so a destructive one like deleting a key is not included unless you add it.
- **Credential handling:** Your Momento token is stored once, encrypted, by your own Jentic One instance and injected at execution time. It never enters the agent's prompt, logs, or context.
- **Discovery method:** Agents search Jentic by intent such as 'cache a value in a serverless store', and Jentic returns the matching Momento GET or PUT operation with its cache-name and key-value schema so the agent calls the right endpoint without browsing the reference docs.

## Related APIs

- **Upstash Redis API** — Serverless Redis with an HTTP REST API designed for edge and Lambda runtimes
- **AWS API** — AWS service APIs including Lambda, where Momento is most commonly deployed as the cache layer
- **Cloudflare API** — Cloudflare account and Workers management APIs that pair with Momento for edge-runtime caching

## FAQ

### Why is there no official OpenAPI spec for Momento Cache HTTP API?

Momento publishes documentation for the HTTP API but not a structured OpenAPI specification. Jentic generates and maintains this spec so that AI agents and developers can call Momento Cache HTTP API via structured tooling. It is validated against the live API and kept up to date. Get started with Jentic One, the self-hosted execution layer.

### What authentication does the Momento Cache HTTP API use?

Momento uses HTTP Bearer authentication. Generate a Momento API token from the console, then send it as Authorization: Bearer <token>. Through Jentic, the token is held encrypted in the credential vault and injected at request time so the secret never enters agent context.

### Can I use Momento as a Redis replacement in Lambda?

Yes - and it is purpose-built for that. Because the API is HTTP, there is no connection to manage and no cold-start penalty to pay opening a TCP socket. Call GET `/cache/{cacheName}` for reads, PUT `/cache/{cacheName}` for writes, and DELETE `/cache/{cacheName}` for invalidation, all over standard HTTPS.

### What are the rate limits for the Momento Cache HTTP API?

Momento applies per-account throughput and item-size limits documented at https://docs.momentohq.com. The Free Tier covers low-traffic workloads with no card; production usage is metered by data transferred and operations per second.

### How do I cache an API response through Jentic?

Run pip install jentic, search for 'cache a value in a serverless store', load PUT `/cache/{cacheName}`, and execute with the cache name, key, and value. On the next call, use GET `/cache/{cacheName}` to retrieve it through the same Jentic search-and-load flow.

### Does Momento support TTLs on cached items?

Yes. The PUT endpoint accepts a TTL via query parameter or header so cached items expire automatically without separate invalidation calls. Combine TTL-based expiration with explicit DELETE calls for write-through invalidation when source data changes mid-TTL.

### Can I limit what my agent is allowed to do with the Momento Cache HTTP API?

Yes. Because you run Jentic One yourself, your own rules decide which Momento operations the agent can call, so you can grant read-only GET `/cache/{cacheName}` access while withholding the destructive DELETE `/cache/{cacheName}.` Since the cache name sits in the URL path, you can also pin the agent to a single named cache rather than every cache on the account. The Momento token stays under your control and is injected only for the operations you have allowed.
