GoodMemGoodMem
ReferenceAPIgRPC API

Space

gRPC SpaceService reference for CreateSpace, GetSpace, ListSpaces, UpdateSpace and other RPCs, with request messages, response types, and service documentation.

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 x-api-key: <api-key>

Global errors: All RPCs may return DEADLINE_EXCEEDED, CANCELLED, UNAVAILABLE, RESOURCE_EXHAUSTED, INTERNAL.

Authorization model:

  • Every RPC evaluates a typed authorization operation against the GoodMem instance or a particular space.
  • Ownership, code-defined role assignments, and direct grants can supply authority; an API-key ceiling may further restrict the authenticated principal's effective authority.
  • Listing requires LIST_SPACE on the instance and returns only spaces on which the caller has READ_SPACE.

Security considerations:

  • Space names must be unique per owner to prevent conflicts
  • Shared authenticated access is represented by authorization grants
  • Embedder associations are validated during creation to ensure at least one embedder is supplied, every referenced embedder exists, and the caller may execute every embedder

CreateSpace

Creates a new Space with embedder associations and configuration.

Type
Requestgoodmem.v1.CreateSpaceRequest
Responsegoodmem.v1.Space

Auth: gRPC metadata x-api-key: <api-key>

Authorization Required: CREATE_SPACE on the proposed space, evaluated using its proposed owner, and EXECUTE_EMBEDDER on every referenced embedder.

Summary:

  • Owner defaults to the authenticated principal unless owner_id is provided; authorization is evaluated against that proposed owner
  • At least one space_embedder must be specified
  • ALREADY_EXISTS: another space exists with identical {owner_id, name} (case-sensitive)
  • Validates all embedder IDs exist and the caller has EXECUTE_EMBEDDER on each one
  • Duplicate embedder IDs in the same request → INVALID_ARGUMENT

Side Effects:

  • Persists space with embedder associations; sets audit fields

Error Codes:

  • UNAUTHENTICATED: missing/invalid auth
  • PERMISSION_DENIED: lacks CREATE_SPACE for the proposed owner or EXECUTE_EMBEDDER on a referenced embedder
  • INVALID_ARGUMENT: empty/invalid name; duplicate embedders; unknown embedder_id; label key/len violations
  • ALREADY_EXISTS: matching space name for owner
  • INTERNAL: unexpected server error

Examples:

grpcurl -plaintext \\
-H 'x-api-key: gm_xxx' \\
-d '{
"name": "My Knowledge Base",
"space_embedders": [
{
"embedder_id": "BASE64_UUID_BYTES_HERE",
"default_retrieval_weight": 1.0
}
],
"labels": {"org": "acme", "env": "prod"}
}' \\
localhost:8080 goodmem.v1.SpaceService/CreateSpace

Note: 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
Requestgoodmem.v1.GetSpaceRequest
Responsegoodmem.v1.Space

Auth: gRPC metadata x-api-key: <api-key>

Authorization Required: READ_SPACE on the requested space.

Summary:

  • Loads the space before evaluating authorization, preserving the distinct NOT_FOUND and PERMISSION_DENIED contract
  • Returns complete space details including all embedder associations

Error Codes:

  • UNAUTHENTICATED: missing/invalid auth
  • PERMISSION_DENIED: lacks READ_SPACE on the requested space
  • INVALID_ARGUMENT: invalid space ID format
  • NOT_FOUND: space does not exist
  • INTERNAL: unexpected server error

Idempotency: Read-only; safe to retry; results may change over time.

Examples:

grpcurl -plaintext \
-H 'x-api-key: gm_xxx' \
-d '{ "space_id": "BASE64_UUID_BYTES_HERE" }' \
localhost:8080 goodmem.v1.SpaceService/GetSpace

Note: bytes fields in JSON must be base64.

ListSpaces

Lists Spaces accessible to the authenticated principal with filtering and pagination.

Type
Requestgoodmem.v1.ListSpacesRequest
Responsegoodmem.v1.ListSpacesResponse

Auth: gRPC metadata x-api-key: <api-key>

Authorization Required: LIST_SPACE on the GoodMem instance and READ_SPACE on each returned space. The standard user role may enumerate the catalog and read owned spaces; direct grants can expose additional spaces.

Request Parameters:

  • owner_id (optional, bytes UUID): filter the already-authorized result set by owner
  • label_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_token is an opaque string; do not parse. max_results defaults to 50; clamped to [1, 1000]
  • Sorting: sort_by in {"created_at","name"}; sort_order {"ASCENDING","DESCENDING"}. Default: created_at DESC. Unsupported sort_byINVALID_ARGUMENT

Note: bytes fields in JSON must be base64.

Error Codes:

  • UNAUTHENTICATED: missing/invalid auth
  • PERMISSION_DENIED: lacks instance-level LIST_SPACE
  • INVALID_ARGUMENT: invalid filters, pagination token, or parameters
  • INTERNAL: unexpected server error

Idempotency: Read-only; safe to retry; results may change over time.

Examples:

grpcurl -plaintext \
-H 'x-api-key: gm_xxx' \
-d '{ "label_selectors": {"env": "prod"}, "name_filter": "kb*", "max_results": 25 }' \
localhost:8080 goodmem.v1.SpaceService/ListSpaces

UpdateSpace

Updates mutable properties of a Space (name, labels).

Type
Requestgoodmem.v1.UpdateSpaceRequest
Responsegoodmem.v1.Space

Auth: gRPC metadata x-api-key: <api-key>

Authorization Required: UPDATE_SPACE on the requested space.

Summary:

  • Only mutable fields can be updated: name, labels
  • space_embedders and default_chunking_config are 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_at and updated_by_id

Error Codes:

  • UNAUTHENTICATED: missing/invalid auth
  • PERMISSION_DENIED: lacks UPDATE_SPACE on the requested space
  • INVALID_ARGUMENT: invalid fields, empty name, both label strategies set, or no updatable fields provided
  • NOT_FOUND: space does not exist
  • ALREADY_EXISTS: name conflicts with existing space for owner
  • INTERNAL: unexpected server error

Idempotency: Idempotent with identical input; safe to retry.

Examples:

grpcurl -plaintext \
-H 'x-api-key: gm_xxx' \
-d '{
"space_id": "BASE64_UUID_BYTES_HERE",
"name": "Updated Knowledge Base",
"merge_labels": { "items": {"status": "active"} }
}' \
localhost:8080 goodmem.v1.SpaceService/UpdateSpace

Note: bytes fields in JSON must be base64.

TransferSpaceOwnership

Transfers ownership of a Space to another active principal.

Type
Requestgoodmem.v1.TransferSpaceOwnershipRequest
Responsegoodmem.v1.TransferSpaceOwnershipResponse

Auth: gRPC metadata x-api-key: <api-key>

Authorization Required: TRANSFER_RESOURCE_OWNERSHIP on the requested space, derived from current space ownership, current instance ownership, or an instance-level ADMIN role. A space-level SPACE_ADMIN role and MANAGE_ACCESS alone are insufficient. A scoped API key must also carry a matching immutable ceiling.

Summary:

  • Loads the requested space before evaluating authorization, preserving GoodMem's distinct NOT_FOUND and PERMISSION_DENIED contract
  • Resolves new_owner_id only after the caller passes authorization
  • Accepts an active human or service principal as the new owner
  • Rejects transfer to the current owner without changing audit history

Side Effects:

  • Changes only the space owner and update-audit fields
  • Preserves all grants and role assignments
  • Immediately changes the derived ownership domain of every memory contained by the space

Error Codes:

  • UNAUTHENTICATED: missing/invalid auth
  • PERMISSION_DENIED: caller lacks derived TRANSFER_RESOURCE_OWNERSHIP authority or a scoped API key lacks the required ceiling
  • INVALID_ARGUMENT: invalid space_id or new_owner_id format
  • NOT_FOUND: space or destination principal does not exist
  • FAILED_PRECONDITION: destination principal is deleted or already owns the space
  • ALREADY_EXISTS: destination principal already owns a space with the same name
  • ABORTED: a concurrent ownership or policy change invalidated the transaction; the caller may retry after reading the current owner
  • INTERNAL: unexpected server error

Idempotency: Not idempotent under response semantics: retrying a completed transfer returns FAILED_PRECONDITION. After an unknown outcome, read the current space before retrying.

DeleteSpace

Permanently deletes a Space and its associated content.

Type
Requestgoodmem.v1.DeleteSpaceRequest
Responsegoogle.protobuf.Empty

Auth: gRPC metadata x-api-key: <api-key>

Authorization Required: DELETE_SPACE on the requested space.

Side Effects:

  • Removes the space record permanently
  • Cascades deletion to associated memories, chunks, and embedder associations

Error Codes:

  • UNAUTHENTICATED: missing/invalid auth
  • PERMISSION_DENIED: lacks DELETE_SPACE on the requested space
  • INVALID_ARGUMENT: invalid space ID format
  • NOT_FOUND: space does not exist
  • INTERNAL: unexpected server error

Idempotency: Safe to retry; may return NOT_FOUND if already deleted or never existed.

Examples:

grpcurl -plaintext \
-H 'x-api-key: gm_xxx' \
-d '{ "space_id": "BASE64_UUID_BYTES_HERE" }' \
localhost:8080 goodmem.v1.SpaceService/DeleteSpace

Note: 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.

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.
FieldTypeDescription
space_idbytesOUTPUT_ONLY UUID (16 bytes); space this embedder is associated with
embedder_idbytesOUTPUT_ONLY UUID (16 bytes); embedder model identifier
default_retrieval_weightdoubleOUTPUT_ONLY; > 0 and finite; used for blending across embedders; server may normalize across all embedders.
created_atgoogle.protobuf.TimestampStandard audit fields
OUTPUT_ONLY
updated_atgoogle.protobuf.TimestampOUTPUT_ONLY
created_by_idbytesOUTPUT_ONLY creator UUID (16 bytes)
updated_by_idbytesOUTPUT_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:

  • Shared authenticated access is represented by authorization grants.
  • Space ownership and creator are tracked separately for administrative purposes.

Immutability:

  • space_embedders are effectively immutable (no update operations supported)
  • owner_id changes only through TransferSpaceOwnership, never through UpdateSpace
  • default_chunking_config updates 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

FieldTypeDescription
space_idbytesOUTPUT_ONLY UUID (16 bytes); immutable primary identifier
namestringREQUIRED on create; human-friendly name; unique per owner; cannot be empty after trimming
labelsgoodmem.v1.Space.LabelsEntryOPTIONAL key-value pairs for organization and filtering. Keys must match [a-z0-9._-], case-sensitive. ≤20 entries; keys/values ≤255 chars.
space_embeddersgoodmem.v1.SpaceEmbedderOUTPUT_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_idbytesOUTPUT_ONLY owner principal UUID (16 bytes); changed only by TransferSpaceOwnership
default_chunking_configgoodmem.v1.ChunkingConfigOPTIONAL default chunking strategy for memories; updates not yet supported
created_atgoogle.protobuf.TimestampStandard audit fields
OUTPUT_ONLY
updated_atgoogle.protobuf.TimestampOUTPUT_ONLY
created_by_idbytesOUTPUT_ONLY creator UUID (16 bytes)
updated_by_idbytesOUTPUT_ONLY last updater UUID (16 bytes)

Space.LabelsEntry

FieldTypeDescription
keystring
valuestring

CreateSpaceRequest

FieldTypeDescription
space_idbytesOptional: client-provided UUID (16 bytes); server generates if omitted; returns ALREADY_EXISTS if ID exists
namestringRequired: Space name (cannot be empty after trimming); unique per owner; ≤255 chars
labels...CreateSpaceRequest.LabelsEntryOptional: Labels for organization (≤20 entries; keys/values ≤255 chars; includes reserved keys)
space_embeddersgoodmem.v1.SpaceEmbedderConfigREQUIRED: At least one embedder configuration; no duplicates allowed
owner_idbytesOptional: Owner principal UUID (16 bytes); if omitted → authenticated principal; CREATE_SPACE is evaluated using this proposed owner
default_chunking_configgoodmem.v1.ChunkingConfigOptional: Default chunking strategy for memories in this space

CreateSpaceRequest.LabelsEntry

FieldTypeDescription
keystring
valuestring

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.

FieldTypeDescription
embedder_idbytesRequired: Embedder UUID (16 bytes); must reference existing embedder.
default_retrieval_weightdoubleOptional: > 0 and finite; defaults to 1.0; need not sum to 1 across configs.

GetSpaceRequest

FieldTypeDescription
space_idbytesRequired: Space ID (16 bytes UUID)

ListSpacesRequest

FieldTypeDescription
owner_idbytesOptional filters
Optional: Filter by owner (16 bytes UUID)
label_selectors...cesRequest.LabelSelectorsEntryOptional: Conjunction (AND) of exact key=value matches; all pairs must be present in space labels
name_filterstringOptional: Glob pattern for space name matching; supports * (any chars), ? (single char), \ (escape); full-string match; case-sensitive
max_resultsint32Pagination
Optional: Max results per page; defaults to 50; clamped to 1-1000 range
next_tokenstringOptional: Opaque pagination token; do not parse.
sort_bystringSorting
Optional: "created_at" or "name"; default "created_at".
sort_ordergoodmem.v1.SortOrderOptional: default DESCENDING.

ListSpacesRequest.LabelSelectorsEntry

FieldTypeDescription
keystring
valuestring

ListSpacesResponse

FieldTypeDescription
spacesgoodmem.v1.SpacePage of space results with complete metadata and embedder associations
next_tokenstringOpaque 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.

FieldTypeDescription
startint32Cursor offset position in result set
owner_idbytesOwner filter from original request (16 bytes UUID)
label_selectors...tPageToken.LabelSelectorsEntryLabel selector filters from original request
name_filterstringName filter pattern from original request
requestor_idbytesAuthenticated principal ID for token validation (16-byte UUID)
sort_bystringSort field from original request
sort_ordergoodmem.v1.SortOrderSort direction from original request

ListSpacesNextPageToken.LabelSelectorsEntry

FieldTypeDescription
keystring
valuestring

UpdateSpaceRequest

FieldTypeDescription
space_idbytesRequired: ID of the space to update (16 bytes UUID)
namestringOptional fields to update
Optional: New space name (cannot be empty after trimming); must be unique per owner
replace_labelsgoodmem.v1.StringMapReplace all existing labels with this set (≤20 entries). Empty StringMap clears all labels.
See: goodmem.v1.StringMap
merge_labelsgoodmem.v1.StringMapMerge with existing labels (≤20 entries): upserts with overwrite. Labels not mentioned are preserved.
See: goodmem.v1.StringMap

DeleteSpaceRequest

FieldTypeDescription
space_idbytesRequired: Space ID to delete (16 bytes UUID)

TransferSpaceOwnershipRequest

Request to transfer a Space to another principal.

FieldTypeDescription
space_idbytesExisting Space UUID (16 bytes).
new_owner_idbytesExisting, active human or service principal UUID (16 bytes) that will become owner.

TransferSpaceOwnershipResponse

Response returned after transferring ownership of a Space.

FieldTypeDescription
spacegoodmem.v1.SpaceUpdated Space, including its immutable embedder associations.