Skip to main content
Custom data is the agent’s own storage: named collections of JSON entries, each optionally indexed for semantic search by a searchText. These routes are the REST twin of the Data runtime object and address the same collections your tools read. Verified against lua-cli 3.33.0.

Base URL and authentication

Reads need knowledge:read and writes knowledge:write on the agent; the host, the bearer header, and the error envelope are on the REST API overview. Collections are not partitioned by environment.

The entry

string
Entry id, a UUID.
object
The JSON you stored.
string
The text embedded for semantic search, when set.
number
Unix time in milliseconds.
number
Unix time in milliseconds.
Collection and entry ids are path segments: a collection named search cannot be read by id because .../<collection>/search is the search route.

Endpoints

GET /developer/agents/:agentId/custom-data

Lists the agent’s collections with counts and timestamps.
string
required
The agent.
Response 200 with { "data": [...], "count" }.
array
One item per collection: name, entryCount, lastUpdatedAt, firstCreatedAt (Unix milliseconds), and indexes on collections that declared one.
number
Number of collections.
Equivalent: Data.collections().

POST /developer/agents/:agentId/custom-data/:collection

Creates an entry and, when searchText is given, embeds it for semantic search.
string
required
The agent.
string
required
Collection name; created on first write.
any
required
The value to store: an object, array, string, number, or boolean. null and an empty string are refused.
string
Text to embed. Include every term you expect a search to match. A string only; the options object the SDK’s Data.create() types is not accepted here and answers 400 with searchText must be a string.
Response 201 with the entry. Errors Equivalent: Data.create('movies', data, 'Inception Nolan sci-fi').

GET /developer/agents/:agentId/custom-data/:collection

Returns the entries that match a filter, one page at a time.
string
required
The agent.
string
required
The collection.
string
A JSON Lua Query over data: dot notation for nested fields, $eq, $ne, $gt, $gte, $lt, $lte, $in, $nin, $exists, and $and or $or at the root. Omit it for every entry.
integer
default:"1"
Page number from 1.
integer
default:"10"
From 1 to 100; larger values are clamped.
Response 200 with { "data": [...entries], "pagination": { currentPage, totalPages, totalCount, limit, hasNextPage, hasPrevPage, nextPage, prevPage } }. Errors Equivalent: Data.get('movies', { year: { $gte: 2010 } }, 1, 20).

GET /developer/agents/:agentId/custom-data/:collection/search

Returns the entries whose searchText is semantically closest to a query.
string
required
The agent.
string
required
The collection.
string
required
Natural-language query.
integer
default:"5"
From 1 to 20; larger values are clamped to 20.
number
default:"0.6"
Minimum similarity from 0 to 1; results under it are dropped.
Response 200 with { "data": [...entries with score], "count" }; each entry carries a score from 0 to 1. This is a flat list, not the paginated envelope the filter route returns. Errors Equivalent: Data.search('movies', 'mind-bending thriller', 5, 0.7).

GET /developer/agents/:agentId/custom-data/:collection/:entryId

Returns one entry. Errors Equivalent: Data.getEntry('movies', '<entryId>').

PUT /developer/agents/:agentId/custom-data/:collection/:entryId

Merges new fields into an entry and optionally re-embeds it.
object
required
Fields to merge into the stored data.
string
New text to embed.
Response 200 with { "status": "success", "message": "Custom data entry updated" }. Errors Equivalent: Data.update('movies', '<entryId>', { rating: 9 }, 'Inception Nolan sci-fi').

PATCH /developer/agents/:agentId/custom-data/:collection/:entryId

Sets and unsets top-level fields of data atomically, and sets or clears the embedding.
object
Top-level fields to write.
string[]
Top-level fields to remove.
string or null
A string re-embeds the entry; null clears both the text and its vector; omit it to leave the embedding alone.
Response 200 with { "status": "success", "message" }; 404 Custom data entry not found when the entry does not exist.

DELETE /developer/agents/:agentId/custom-data/:collection/:entryId

Deletes one entry. Response 200 with { "status": "success", "message": "Custom data entry deleted" }; 404 Custom data entry not found when the entry does not exist. Equivalent: Data.delete('movies', '<entryId>').

See also

  • Data — the same collections from agent code, with declared indexes
  • Lua Query — the filter grammar the filter parameter accepts
  • Store and search data — choosing filters or semantic search
  • User data — one record per end user instead of a collection