GoodMemGoodMem

Spaces

Memory space management.

Methods on this page are called through client.spaces.

client.spaces.create

client.spaces.create(request: SpaceCreationRequest, requestOptions?: RequestOptions): Promise<SpaceResponseShape>

Creates a new space with the provided name, labels, and embedder configuration. A space is a container for organizing related memories. OWNER DEFAULTS: Owner defaults to authenticated user unless ownerId is provided (requires CREATE_SPACE_ANY if differs). EMBEDDER REQUIREMENTS: At least one embedder configuration must be specified. DUPLICATE DETECTION: Returns ALREADY_EXISTS if another space exists with identical {ownerId, name} (case-sensitive). Requires CREATE_SPACE_OWN permission (or CREATE_SPACE_ANY for admin users). This operation is NOT idempotent.

HTTP: POST /v1/spaces

Parameters

ParameterTypeDescription
requestSpaceCreationRequestRequest body.
requestOptionsRequestOptions optionalPer-call signal, timeout, or headers.

Returns: Promise&lt;SpaceResponseShape&gt;

Example

const space = await client.spaces.create({
  name: "Doc Space",
  spaceEmbedders: [{ embedderId: "your-embedder-id" }],
  labels: { env: "docs" },
});

client.spaces.delete

client.spaces.delete(id: string, requestOptions?: RequestOptions): Promise<void>

Permanently deletes a space and all associated content. This operation cannot be undone. CASCADE DELETION: Removes the space record and cascades deletion to associated memories, chunks, and embedder associations. Requires DELETE_SPACE_OWN permission for spaces you own (or DELETE_SPACE_ANY for admin users). This operation is safe to retry - may return NOT_FOUND if already deleted.

HTTP: DELETE /v1/spaces/&#123;id&#125;

Parameters

ParameterTypeDescription
idstringThe unique identifier of the space to delete
requestOptionsRequestOptions optionalPer-call signal, timeout, or headers.

Returns: Promise&lt;void&gt;

Example

await client.spaces.delete("your-space-id");

client.spaces.get

client.spaces.get(id: string, requestOptions?: RequestOptions): Promise<SpaceResponseShape>

Retrieves a specific space by its unique identifier. Returns the complete space information, including name, labels, embedder configuration, and metadata. PUBLIC SPACE ACCESS: When public_read=true, any authenticated user can retrieve the space metadata, bypassing ownership checks. Otherwise, requires ownership or DISPLAY_SPACE_ANY permission. Requires DISPLAY_SPACE_OWN permission for owned spaces (or DISPLAY_SPACE_ANY for admin users to view any space). This is a read-only operation safe to retry.

HTTP: GET /v1/spaces/&#123;id&#125;

Parameters

ParameterTypeDescription
idstringThe unique identifier of the space to retrieve
requestOptionsRequestOptions optionalPer-call signal, timeout, or headers.

Returns: Promise&lt;SpaceResponseShape&gt;

Example

const fetchedSpace = await client.spaces.get("your-space-id");
console.log(fetchedSpace.name);

client.spaces.list

client.spaces.list(options?: SpacesListOptions, requestOptions?: RequestOptions): Promise<Page<SpaceResponseShape>>

Retrieves a list of spaces accessible to the caller, with optional filtering by owner, labels, and name. Results are paginated with a maximum number of spaces per response. LABEL FILTERS: Label filters accept either label.<key>=<value> or label[key]=value (for example, label.environment=production or label[environment]=production). PERMISSION-BASED FILTERING: With LIST_SPACE_ANY and ownerId omitted, returns all visible spaces; otherwise returns caller-owned spaces only. DEFAULT SORT: Results ordered by created_at DESCENDING unless specified otherwise. MAX_RESULTS CLAMPING: maxResults defaults to 50 and is clamped to [1, 1000] range. Requires LIST_SPACE_OWN or LIST_SPACE_ANY permission.

HTTP: GET /v1/spaces

Parameters

ParameterTypeDescription
optionsSpacesListOptions optionalOptional query parameters.
requestOptionsRequestOptions optionalPer-call signal, timeout, or headers.

Returns: Promise&lt;Page&lt;SpaceResponseShape&gt;&gt;

Example

Example 1:

for await (const item of await client.spaces.list()) {
  console.log(item.spaceId, item.name);
}

Example 2:

let seenSpaces = 0;
for await (const item of await client.spaces.list({ maxResults: 10 })) {
  console.log(item.name);
  if (++seenSpaces === 20) break;
}

Example 3:

const spacesPage = await client.spaces.list({ maxResults: 10 });
for (const item of spacesPage.items) {
  console.log(item.name);
}
if (spacesPage.nextToken) {
  await client.spaces.list({ nextToken: spacesPage.nextToken });
}

Example 4:

let token: string | undefined;
for (let pageCount = 0; pageCount < 3; pageCount++) {
  const nextPage = await client.spaces.list({ maxResults: 10, nextToken: token });
  console.log(nextPage.items.length);
  token = nextPage.nextToken;
  if (!token) break;
}

Example 5:

let emitted = 0;
for await (const item of await client.spaces.list()) {
  console.log(item.spaceId);
  if (++emitted >= 25) break;
}

Example 6:

const page = await client.spaces.list({ maxResults: 10 });
console.log(page.items.length, page.nextToken);

Example 7:

let cappedSpaces = 0;
for await (const item of await client.spaces.list({ maxResults: 5 })) {
  console.log(item.name);
  if (++cappedSpaces >= 12) break;
}

Example 8:

const firstSpacesPage = await client.spaces.list({ maxResults: 10 });
const resumedSpacesPage = await client.spaces.list({ nextToken: firstSpacesPage.nextToken });
console.log(resumedSpacesPage.items.length);

Example 9:

const resumeFrom = "opaque-next-token";
let resumedCount = 0;
for await (const item of await client.spaces.list({ nextToken: resumeFrom, maxResults: 10 })) {
  console.log(item.spaceId);
  if (++resumedCount >= 20) break;
}

client.spaces.update

client.spaces.update(id: string, request: UpdateSpaceRequest, requestOptions?: RequestOptions): Promise<SpaceResponseShape>

Updates an existing space with new values for the specified fields. Only name, publicRead, and labels can be updated. Fields not included in the request remain unchanged. IMMUTABLE FIELDS: space_embedders, default_chunking_config, and ownerId cannot be modified after creation. NAME UNIQUENESS: Name must be unique per owner - returns ALREADY_EXISTS if name conflicts with existing space. Requires UPDATE_SPACE_OWN permission for spaces you own (or UPDATE_SPACE_ANY for admin users). This operation is idempotent.

HTTP: PUT /v1/spaces/&#123;id&#125;

Parameters

ParameterTypeDescription
idstringThe unique identifier of the space to update
requestUpdateSpaceRequestRequest body.
requestOptionsRequestOptions optionalPer-call signal, timeout, or headers.

Returns: Promise&lt;SpaceResponseShape&gt;

Example

const updatedSpace = await client.spaces.update("your-space-id", {
  name: "Doc Space (updated)",
  mergeLabels: { version: "2" },
});
console.log(updatedSpace.spaceId);

Data Models

Interfaces

ListSpacesResponse

Response containing a list of spaces and optional pagination token.

FieldTypeRequiredDescription
spacesArray&lt;Space&gt;yesThe list of spaces matching the query criteria.
nextTokenstring | nullnoPagination token for retrieving the next set of results. Only present if there are more results available.

Space

A Space is a container for organizing related memories with vector embeddings.

FieldTypeRequiredDescription
spaceIdstringyesThe UUID for this space.
namestringyesThe name of the space.
labelsRecord&lt;string, string&gt;yesKey-value pairs of metadata associated with the space.
spaceEmbeddersArray&lt;SpaceEmbedder&gt;yesThe list of embedders associated with this space.
createdAtnumberyesTimestamp when this space was created (milliseconds since epoch).
updatedAtnumberyesTimestamp when this space was last updated (milliseconds since epoch).
ownerIdstringyesThe ID of the user who owns this space.
createdByIdstringyesThe ID of the user who created this space.
updatedByIdstringyesThe ID of the user who last updated this space.
publicReadbooleanyesWhether this space is publicly readable by all users.
defaultChunkingConfigChunkingConfiguration | nullnoDefault chunking strategy for memories in this space

SpaceCreationRequest

Request body for creating a new Space. A Space is a container for organizing related memories with vector embeddings.

FieldTypeRequiredDescription
namestringyesThe desired name for the space. Must be unique within the user's scope.
labelsRecord&lt;string, string&gt; | nullnoA set of key-value pairs to categorize or tag the space. Used for filtering and organizational purposes.
spaceEmbeddersArray&lt;SpaceEmbedderConfig&gt;yesList of embedder configurations to associate with this space. At least one embedder configuration is required. Each specifies an embedder ID and a relative default retrieval weight used when no per-request overrides are provided.
publicReadboolean | nullnoIndicates if the space and its memories can be read by unauthenticated users or users other than the owner. Defaults to false.
ownerIdstring | nullnoOptional owner ID. If not provided, derived from the authentication context. Requires CREATE_SPACE_ANY permission if specified.
defaultChunkingConfigChunkingConfigurationyesDefault chunking strategy for memories in this space
spaceIdstring | nullnoOptional client-provided UUID for idempotent creation. If not provided, server generates a new UUID. Returns ALREADY_EXISTS if ID is already in use.

SpaceEmbedder

Associates an embedder with a space, including retrieval configuration.

FieldTypeRequiredDescription
spaceIdstringyesThe UUID for the space.
embedderIdstringyesThe UUID for the embedder.
defaultRetrievalWeightnumberyesThe default weight for this embedder during retrieval operations.
createdAtnumberyesTimestamp when this association was created (milliseconds since epoch).
updatedAtnumberyesTimestamp when this association was last updated (milliseconds since epoch).
createdByIdstringyesThe ID of the user who created this association.
updatedByIdstringyesThe ID of the user who last updated this association.

SpaceEmbedderConfig

Configuration for associating an embedder with a space.

FieldTypeRequiredDescription
embedderIdstringyesThe UUID for the embedder to associate with the space.
defaultRetrievalWeightnumber | nullnoRelative weight for this embedder used by default during retrieval. If omitted, defaults to 1.0; values need not sum to 1 and can be overridden per request.

UpdateSpaceRequest

Request parameters for updating a space.

FieldTypeRequiredDescription
namestring | nullnoThe new name for the space.
publicReadboolean | nullnoWhether the space is publicly readable by all users.
replaceLabelsRecord&lt;string, string&gt; | nullnoLabels to replace all existing labels. Mutually exclusive with mergeLabels.
mergeLabelsRecord&lt;string, string&gt; | nullnoLabels to merge with existing labels. Mutually exclusive with replaceLabels.

Response Shapes

Response shape types model values returned by the SDK after forward-compatible unknown enum strings are coerced to null.

ListSpacesResponseShape

FieldTypeRequiredDescription
spacesArray&lt;SpaceResponseShape&gt;yesThe list of spaces matching the query criteria.
nextTokenstring | nullnoPagination token for retrieving the next set of results. Only present if there are more results available.

SpaceResponseShape

FieldTypeRequiredDescription
spaceIdstringyesThe UUID for this space.
namestringyesThe name of the space.
labelsRecord&lt;string, string&gt;yesKey-value pairs of metadata associated with the space.
spaceEmbeddersArray&lt;SpaceEmbedderResponseShape&gt;yesThe list of embedders associated with this space.
createdAtnumberyesTimestamp when this space was created (milliseconds since epoch).
updatedAtnumberyesTimestamp when this space was last updated (milliseconds since epoch).
ownerIdstringyesThe ID of the user who owns this space.
createdByIdstringyesThe ID of the user who created this space.
updatedByIdstringyesThe ID of the user who last updated this space.
publicReadbooleanyesWhether this space is publicly readable by all users.
defaultChunkingConfigChunkingConfigurationResponseShape | nullnoDefault chunking strategy for memories in this space

SpaceEmbedderResponseShape

FieldTypeRequiredDescription
spaceIdstringyesThe UUID for the space.
embedderIdstringyesThe UUID for the embedder.
defaultRetrievalWeightnumberyesThe default weight for this embedder during retrieval operations.
createdAtnumberyesTimestamp when this association was created (milliseconds since epoch).
updatedAtnumberyesTimestamp when this association was last updated (milliseconds since epoch).
createdByIdstringyesThe ID of the user who created this association.
updatedByIdstringyesThe ID of the user who last updated this association.