Space
Space service API reference
Services
SpaceService Service
Service for managing Spaces in the GoodMem system.
Spaces are the fundamental storage units for organizing memories with associated embedding models and access controls. This service provides lifecycle management including creation, retrieval, listing, updating, and deletion of spaces.
Authentication: gRPC metadata authorization: Bearer <api-key>
Global errors: All RPCs may return DEADLINE_EXCEEDED, CANCELLED, UNAVAILABLE, RESOURCE_EXHAUSTED, INTERNAL.
Permissions model:
*_SPACE_OWN: operate on caller-owned spaces*_SPACE_ANY: operate on any user's spaces (requires elevated role)- Public spaces (
public_read=true) can be read by anyone with basic permissions
Security considerations:
- Space names must be unique per owner to prevent conflicts
- Public read access bypasses ownership restrictions for query operations
- Embedder associations are validated during creation to ensure embedder existence
- Default embedder is used if no embedders are specified during creation
CreateSpace
Creates a new Space with embedder associations and configuration.
| Type | |
|---|---|
| Request | goodmem.v1.CreateSpaceRequest |
| Response | goodmem.v1.Space |
Auth: gRPC metadata authorization: Bearer <api-key>
Permissions Required: CREATE_SPACE_OWN or CREATE_SPACE_ANY
Summary:
- Owner defaults to authenticated user unless
owner_idis provided (requires*_ANYif differs) - If no embedders are specified, a system-default embedder is attached
ALREADY_EXISTS: another space exists with identical{owner_id, name}(case-sensitive)- Validates all embedder IDs exist before creation
- Duplicate embedder IDs in the same request →
INVALID_ARGUMENT
Side Effects:
- Persists space with embedder associations; sets audit fields
Error Codes:
UNAUTHENTICATED: missing/invalid authPERMISSION_DENIED: lacksCREATE_SPACE_*INVALID_ARGUMENT: empty/invalidname; duplicate embedders; unknownembedder_id; label key/len violationsALREADY_EXISTS: matching spacenamefor ownerINTERNAL: unexpected server error
Examples:
grpcurl -plaintext \\
-H 'authorization: Bearer gm_xxx' \\
-d '{
"name": "My Knowledge Base",
"labels": {"org": "acme", "env": "prod"},
"public_read": false
}' \\
localhost:8080 goodmem.v1.SpaceService/CreateSpaceNote: bytes fields in JSON must be base64.
Idempotency: Non-idempotent; clients SHOULD NOT blindly retry on unknown failures.
GetSpace
Retrieves details of a specific Space including embedder associations.
| Type | |
|---|---|
| Request | goodmem.v1.GetSpaceRequest |
| Response | goodmem.v1.Space |
Auth: gRPC metadata authorization: Bearer <api-key>
Permissions Required: DISPLAY_SPACE_OWN or DISPLAY_SPACE_ANY (public spaces bypass ownership restrictions)
Summary:
- When
public_read=true, any authenticated user can retrieve the space metadata - Otherwise, requires ownership or
DISPLAY_SPACE_ANYpermission - Returns complete space details including all embedder associations
Error Codes:
UNAUTHENTICATED: missing/invalid authPERMISSION_DENIED: lacksDISPLAY_SPACE_*for private space or owned spaceINVALID_ARGUMENT: invalid space ID formatNOT_FOUND: space does not existINTERNAL: unexpected server error
Idempotency: Read-only; safe to retry; results may change over time.
Examples:
grpcurl -plaintext \
-H 'authorization: Bearer gm_xxx' \
-d '{ "space_id": "BASE64_UUID_BYTES_HERE" }' \
localhost:8080 goodmem.v1.SpaceService/GetSpaceNote: bytes fields in JSON must be base64.
ListSpaces
Lists Spaces accessible to the authenticated user with filtering and pagination.
| Type | |
|---|---|
| Request | goodmem.v1.ListSpacesRequest |
| Response | goodmem.v1.ListSpacesResponse |
Auth: gRPC metadata authorization: Bearer <api-key>
Permissions Required: LIST_SPACE_OWN or LIST_SPACE_ANY
Request Parameters:
owner_id(optional, bytes UUID): withLIST_SPACE_ANYandowner_idomitted, returns all visible spaces; otherwise caller-ownedlabel_selectors(optional): AND of exact key=value matches (case-sensitive)name_filter(optional): glob over full name;*any sequence;?single char;\escapes; case-sensitive- Pagination:
next_tokenis an opaque string; do not parse.max_resultsdefaults to 50; clamped to [1, 1000] - Sorting:
sort_byin{"created_at","name"};sort_order{"ASCENDING","DESCENDING"}. Default:created_at DESC. Unsupportedsort_by→INVALID_ARGUMENT
Note: bytes fields in JSON must be base64.
Error Codes:
UNAUTHENTICATED: missing/invalid authPERMISSION_DENIED: lacksLIST_SPACE_*INVALID_ARGUMENT: invalid filters, pagination token, or parametersINTERNAL: unexpected server error
Idempotency: Read-only; safe to retry; results may change over time.
Examples:
grpcurl -plaintext \
-H 'authorization: Bearer gm_xxx' \
-d '{ "label_selectors": {"env": "prod"}, "name_filter": "kb*", "max_results": 25 }' \
localhost:8080 goodmem.v1.SpaceService/ListSpacesUpdateSpace
Updates mutable properties of a Space (name, labels, public_read).
| Type | |
|---|---|
| Request | goodmem.v1.UpdateSpaceRequest |
| Response | goodmem.v1.Space |
Auth: gRPC metadata authorization: Bearer <api-key>
Permissions Required: UPDATE_SPACE_OWN or UPDATE_SPACE_ANY
Summary:
- Only mutable fields can be updated:
name,labels,public_read space_embeddersanddefault_chunking_configare immutable- Label updates support replace (clear all, set new) or merge (upsert) strategies
- Name uniqueness is enforced per owner during updates
Side Effects:
- Persists changes; updates
updated_atandupdated_by_id
Error Codes:
UNAUTHENTICATED: missing/invalid authPERMISSION_DENIED: lacksUPDATE_SPACE_*INVALID_ARGUMENT: invalid fields, emptyname, both label strategies set, or no updatable fields providedNOT_FOUND: space does not existALREADY_EXISTS:nameconflicts with existing space for ownerINTERNAL: unexpected server error
Idempotency: Idempotent with identical input; safe to retry.
Examples:
grpcurl -plaintext \
-H 'authorization: Bearer gm_xxx' \
-d '{
"space_id": "BASE64_UUID_BYTES_HERE",
"name": "Updated Knowledge Base",
"merge_labels": { "items": {"status": "active"} }
}' \
localhost:8080 goodmem.v1.SpaceService/UpdateSpaceNote: bytes fields in JSON must be base64.
DeleteSpace
Permanently deletes a Space and its associated content.
| Type | |
|---|---|
| Request | goodmem.v1.DeleteSpaceRequest |
| Response | google.protobuf.Empty |
Auth: gRPC metadata authorization: Bearer <api-key>
Permissions Required: DELETE_SPACE_OWN or DELETE_SPACE_ANY
Side Effects:
- Removes the space record permanently
- Cascades deletion to associated memories, chunks, and embedder associations
Error Codes:
UNAUTHENTICATED: missing/invalid authPERMISSION_DENIED: lacksDELETE_SPACE_*INVALID_ARGUMENT: invalid space ID formatNOT_FOUND: space does not existINTERNAL: unexpected server error
Idempotency: Safe to retry; may return NOT_FOUND if already deleted or never existed.
Examples:
grpcurl -plaintext \
-H 'authorization: Bearer gm_xxx' \
-d '{ "space_id": "BASE64_UUID_BYTES_HERE" }' \
localhost:8080 goodmem.v1.SpaceService/DeleteSpaceNote: bytes fields in JSON must be base64.
Messages
SpaceEmbedder
Represents the association between a Space and an Embedder with retrieval configuration.
SpaceEmbedders define which embedding models are available for a space and their relative weights during retrieval operations. Each space must have at least one embedder association, with a default embedder used if none are specified at creation.
Immutability:
- All fields are immutable after creation (no update operations supported).
- Created as part of space creation process.
Notes:
- All timestamps are UTC (
google.protobuf.Timestamp). - Weights are used for blending multiple embedder results during retrieval.
| Field | Type | Description |
|---|---|---|
space_id | bytes | OUTPUT_ONLY UUID (16 bytes); space this embedder is associated with |
embedder_id | bytes | OUTPUT_ONLY UUID (16 bytes); embedder model identifier |
default_retrieval_weight | double | OUTPUT_ONLY; > 0 and finite; used for blending across embedders; server may normalize across all embedders. |
created_at | google.protobuf.Timestamp | Standard audit fields OUTPUT_ONLY |
updated_at | google.protobuf.Timestamp | OUTPUT_ONLY |
created_by_id | bytes | OUTPUT_ONLY creator UUID (16 bytes) |
updated_by_id | bytes | OUTPUT_ONLY last updater UUID (16 bytes) |
Space
Represents a Space - the fundamental storage unit in GoodMem for organizing memories.
A Space is a logical container for memories with associated embedding models, access controls, and metadata. Each space has a unique name per owner and defines the embedding and chunking strategies for its contained memories.
Security:
public_readcontrols access to space metadata and content. When true, the space's metadata (GetSpace) and content (Query) are accessible to any authenticated user. When false, access is restricted by ownership and permissions (e.g.,*_SPACE_ANY).- Space ownership and creator are tracked separately for administrative purposes.
Immutability:
space_embeddersare effectively immutable (no update operations supported)owner_idis set at creation and cannot be modifieddefault_chunking_configupdates are not yet supported
Uniqueness:
- Space names must be unique per owner (case-sensitive).
- System prevents duplicate spaces with identical
{owner_id, name}combination.
Notes:
- All timestamps are UTC (
google.protobuf.Timestamp) - Each space must have at least one associated embedder for memory processing
See also: SpaceService for management operations, SpaceEmbedder for embedder associations
| Field | Type | Description |
|---|---|---|
space_id | bytes | OUTPUT_ONLY UUID (16 bytes); immutable primary identifier |
name | string | REQUIRED on create; human-friendly name; unique per owner; cannot be empty after trimming |
labels | goodmem.v1.Space.LabelsEntry | OPTIONAL key-value pairs for organization and filtering. Keys must match [a-z0-9._-], case-sensitive. ≤100 entries; keys/values ≤255 chars. |
space_embedders | goodmem.v1.SpaceEmbedder | OUTPUT_ONLY list of embedder associations; at least one required. Weights are positive and server-normalized at retrieval time; they need not sum to 1. |
owner_id | bytes | OUTPUT_ONLY owner UUID (16 bytes); set at create; not updatable |
public_read | bool | OPTIONAL access control; if true, allows public metadata and content access; defaults to false. |
default_chunking_config | goodmem.v1.ChunkingConfig | OPTIONAL default chunking strategy for memories; updates not yet supported |
created_at | google.protobuf.Timestamp | Standard audit fields OUTPUT_ONLY |
updated_at | google.protobuf.Timestamp | OUTPUT_ONLY |
created_by_id | bytes | OUTPUT_ONLY creator UUID (16 bytes) |
updated_by_id | bytes | OUTPUT_ONLY last updater UUID (16 bytes) |
Space.LabelsEntry
| Field | Type | Description |
|---|---|---|
key | string | |
value | string |
CreateSpaceRequest
| Field | Type | Description |
|---|---|---|
space_id | bytes | Optional: client-provided UUID (16 bytes); server generates if omitted; returns ALREADY_EXISTS if ID exists |
name | string | Required: Space name (cannot be empty after trimming); unique per owner; ≤255 chars |
labels | ...CreateSpaceRequest.LabelsEntry | Optional: Labels for organization (≤100 entries; keys/values ≤255 chars; includes reserved keys) |
space_embedders | goodmem.v1.SpaceEmbedderConfig | Optional: Embedder configurations; if empty, default embedder used; no duplicates allowed |
public_read | bool | Optional: Public read access; defaults to false if not provided |
owner_id | bytes | Optional: Owner ID (16 bytes UUID); if omitted → authenticated user; requires CREATE_SPACE_ANY if different from caller |
default_chunking_config | goodmem.v1.ChunkingConfig | Optional: Default chunking strategy for memories in this space |
CreateSpaceRequest.LabelsEntry
| Field | Type | Description |
|---|---|---|
key | string | |
value | string |
SpaceEmbedderConfig
Configuration for creating a space-embedder association during space creation.
Used to specify which embedders should be associated with the space and their retrieval weights. All specified embedders must exist before space creation.
| Field | Type | Description |
|---|---|---|
embedder_id | bytes | Required: Embedder UUID (16 bytes); must reference existing embedder. |
default_retrieval_weight | double | Optional: > 0 and finite; defaults to 1.0; need not sum to 1 across configs. |
GetSpaceRequest
| Field | Type | Description |
|---|---|---|
space_id | bytes | Required: Space ID (16 bytes UUID) |
ListSpacesRequest
| Field | Type | Description |
|---|---|---|
owner_id | bytes | Optional filters Optional: Filter by owner (16 bytes UUID) |
label_selectors | ...cesRequest.LabelSelectorsEntry | Optional: Conjunction (AND) of exact key=value matches; all pairs must be present in space labels |
name_filter | string | Optional: Glob pattern for space name matching; supports * (any chars), ? (single char), \ (escape); full-string match; case-sensitive |
max_results | int32 | Pagination Optional: Max results per page; defaults to 50; clamped to 1-1000 range |
next_token | string | Optional: Opaque pagination token; do not parse. |
sort_by | string | Sorting Optional: "created_at" or "name"; default "created_at". |
sort_order | goodmem.v1.SortOrder | Optional: default DESCENDING. |
ListSpacesRequest.LabelSelectorsEntry
| Field | Type | Description |
|---|---|---|
key | string | |
value | string |
ListSpacesResponse
| Field | Type | Description |
|---|---|---|
spaces | goodmem.v1.Space | Page of space results with complete metadata and embedder associations |
next_token | string | Opaque pagination token for next page; omitted on final page. |
ListSpacesNextPageToken
INTERNAL: Pagination token structure for ListSpaces.
Clients MUST treat next_token as opaque and MUST NOT construct or parse it.
The current implementation encodes this structure as base64, but this may change without notice.
| Field | Type | Description |
|---|---|---|
start | int32 | Cursor offset position in result set |
owner_id | bytes | Owner filter from original request (16 bytes UUID) |
label_selectors | ...tPageToken.LabelSelectorsEntry | Label selector filters from original request |
name_filter | string | Name filter pattern from original request |
requestor_id | bytes | Authenticated user ID for token validation (16 bytes UUID) |
sort_by | string | Sort field from original request |
sort_order | goodmem.v1.SortOrder | Sort direction from original request |
ListSpacesNextPageToken.LabelSelectorsEntry
| Field | Type | Description |
|---|---|---|
key | string | |
value | string |
UpdateSpaceRequest
| Field | Type | Description |
|---|---|---|
space_id | bytes | Required: ID of the space to update (16 bytes UUID) |
name | string | Optional fields to update Optional: New space name (cannot be empty after trimming); must be unique per owner |
public_read | bool | Optional: Update public read access |
replace_labels | goodmem.v1.StringMap | Replace all existing labels with this set. Empty StringMap clears all labels. See: goodmem.v1.StringMap |
merge_labels | goodmem.v1.StringMap | Merge with existing labels: upserts with overwrite. Labels not mentioned are preserved. See: goodmem.v1.StringMap |
DeleteSpaceRequest
| Field | Type | Description |
|---|---|---|
space_id | bytes | Required: Space ID to delete (16 bytes UUID) |