GoodMemGoodMem
ReferenceAPIREST APIMemories

Create a new memory

POST /v1/memories: Creates a new memory in a specified space and starts asynchronous processing.

POST
/v1/memories

Creates a new memory in a specified space and starts asynchronous processing. The memory begins in PENDING status while a background job performs chunking and embedding generation.

IDEMPOTENCY: If memoryId is omitted, the server generates a new UUID and retries are not idempotent. If the client supplies a stable memoryId, the operation behaves as create-if-absent: the first request creates the memory and subsequent retries return HTTP 409 Conflict (ALREADY_EXISTS) rather than creating duplicates. Returns INVALID_ARGUMENT if space_id, original_content, or content_type is missing or invalid. Returns NOT_FOUND if the specified space does not exist.

AUTHORIZATION: Requires CREATE_MEMORY on the containing space. Side effects include creating the memory record and enqueuing a background processing job.

Authorization

ApiKeyAuth
headerx-api-key<token>

Header Parameters

GoodMem-Timeout-Ms?integer

Optional waiting budget in milliseconds, measured from REST servlet ingress and shared across all internal gRPC calls. Supply one decimal integer from 1 to 86400000. Omission adds no deadline. Existing shorter deadlines still apply. Expiry returns HTTP 504 before streaming starts; after streaming starts, no successful completion event is sent. Use SSE or opt into GoodMem-Stream-Terminal for an explicit terminal outcome. Retrieval work is cooperatively cancelled. An accepted mutation may still commit after timeout or disconnect; a failed response does not imply rollback.

Formatint64
Range1 <= value <= 86400000

Request Body

Memory creation details. For application/json requests, provide exactly one of originalContent or originalContentB64. For multipart/form-data, provide a JSON request part plus a file part.

  1. body

Application/json memory creation requires exactly one of originalContent or originalContentB64.

memoryId?|

Optional client-provided UUID for the memory. If omitted, the server generates one. Returns ALREADY_EXISTS if the ID is already in use.

Formatuuid
Example"f47ac10b-58cc-4372-a567-0e02b2c3d479"
spaceId*string

ID of the space where this memory will be stored

Formatuuid
Example"550e8400-e29b-41d4-a716-446655440000"
originalContent?|

Original content as plain text (use either this or originalContentB64)

Example"This is the text content to be stored as a memory."
originalContentB64?|

Original content as base64-encoded binary data (use either this or originalContent)

Example"VGhpcyBpcyBiYXNlNjQgZW5jb2RlZCBjb250ZW50"
originalContentRef?|

Reference to external content location

Example"s3://my-bucket/document.pdf"
contentType*string

MIME type of the content

Example"text/plain"
metadata?|

Additional metadata for the memory. A top-level textual title is an optional document-title hint for embedding providers that support one; blank or non-string titles are ignored. Later metadata edits do not automatically re-embed existing chunks.

Propertiesproperties <= 50
Example
{  "source": "document",  "author": "John Doe",  "tags": [    "important"  ],  "title": "Quarterly report"}
chunkingConfig?||

Chunking strategy for this memory (if not provided, uses space default)

Example
{  "recursive": {    "chunkSize": 1000,    "chunkOverlap": 200,    "separators": [      "\n\n",      "\n",      ".",      " "    ],    "keepStrategy": "KEEP_END",    "separatorIsRegex": false,    "lengthMeasurement": "CHARACTER_COUNT"  },  "sentence": {    "maxChunkSize": 1000,    "minChunkSize": 100,    "enableLanguageDetection": true,    "lengthMeasurement": "CHARACTER_COUNT"  }}
extractPageImages?|

Optional hint to extract page images for eligible document types (for example, PDFs)

fileField?|

Optional multipart file field name to bind binary content; required when multiple files are uploaded in a batch multipart request.

Response Body

Successfully created memory

application/json
  1. response

Memory object containing stored content and metadata

memoryId*string

Unique identifier of the memory

Formatuuid
Example"550e8400-e29b-41d4-a716-446655440000"
spaceId*string

ID of the space containing this memory

Formatuuid
Example"550e8400-e29b-41d4-a716-446655440001"
originalContent?|

Original content (only included if requested)

Formatbinary
Example"VGhpcyBpcyBiYXNlNjQgYmluYXJ5Lg=="
originalContentLength?|

Size in bytes of the inline original content

Formatint64
Range0 <= value
originalContentSha256?|

SHA-256 digest of the inline original content, hex encoded

Example"9f2c8c5a9d740eb56d..."
originalContentRef?|

Reference to external content location

Example"s3://my-bucket/document.pdf"
contentType*string

MIME type of the content

Example"text/plain"
processingStatus*string

Processing status of the memory

Example"COMPLETED"
Value in"UNSPECIFIED""PENDING""PROCESSING""COMPLETED""FAILED"
pageImageStatus*string

Processing status of page-image extraction for this memory

Example"COMPLETED"
Value in"UNSPECIFIED""PENDING""PROCESSING""COMPLETED""FAILED"
pageImageCount*integer

Number of extracted page-image renditions linked to this memory

Formatint32
Range0 <= value
Example12
metadata?|

Additional metadata for the memory. A top-level textual title may have been used as a document-title hint when its chunks were embedded; changing it does not automatically re-embed existing chunks.

Example
{  "source": "document",  "author": "John Doe"}
createdAt*integer

Timestamp when the memory was created (milliseconds since epoch)

Formatint64
Example1672531200000
updatedAt*integer

Timestamp when the memory was last updated (milliseconds since epoch)

Formatint64
Example1672531200000
createdById*string

Exact principal or API-key audit actor that created this memory

Formatuuid
Example"550e8400-e29b-41d4-a716-446655440002"
updatedById*string

Exact principal or API-key audit actor that last updated this memory

Formatuuid
Example"550e8400-e29b-41d4-a716-446655440002"
chunkingConfig?||

Chunking strategy used for this memory

Example
{  "recursive": {    "chunkSize": 1000,    "chunkOverlap": 200,    "separators": [      "\n\n",      "\n",      ".",      " "    ],    "keepStrategy": "KEEP_END",    "separatorIsRegex": false,    "lengthMeasurement": "CHARACTER_COUNT"  },  "sentence": {    "maxChunkSize": 1000,    "minChunkSize": 100,    "enableLanguageDetection": true,    "lengthMeasurement": "CHARACTER_COUNT"  }}
processingHistory?|

Background job processing history associated with this memory

Example
{  "latestJob": {    "jobId": 42,    "jobType": "document_processor",    "status": "BACKGROUND_JOB_RUNNING",    "attempts": 1,    "maxAttempts": 5,    "runAt": 1714713600000,    "leaseUntil": 1714713660000,    "lockedBy": "worker-1",    "lastError": "Transient network failure",    "updatedAt": 1714713615000,    "failureStage": "DOCUMENT_PROCESSING_STAGE_GENERATING_EMBEDDINGS"  }}
Example Request
curl -X POST 'https://your-goodmem-server.example.com/v1/memories' \  -H 'GoodMem-Timeout-Ms: 30000' \  -H 'Content-Type: application/json' \  -d '{  "memoryId": "f47ac10b-58cc-4372-a567-0e02b2c3d479",  "spaceId": "550e8400-e29b-41d4-a716-446655440000",  "originalContent": "This is the content to be stored and processed as a memory.",  "originalContentB64": "VGhpcyBpcyBiYXNlNjQgZW5jb2RlZCBjb250ZW50",  "originalContentRef": "s3://my-bucket/document.pdf",  "contentType": "text/plain",  "metadata": {    "source": "document",    "author": "John Doe",    "tags": [      "important",      "research"    ],    "title": "Quarterly report"  },  "chunkingConfig": {    "recursive": {      "chunkSize": 500,      "chunkOverlap": 50,      "separators": [        "\\n\\n",        "\\n",        "."      ],      "separatorIsRegex": false,      "keepStrategy": "KEEP_END",      "lengthMeasurement": "CHARACTER_COUNT"    }  }}'
Example Response
{  "memoryId": "550e8400-e29b-41d4-a716-446655440000",  "spaceId": "550e8400-e29b-41d4-a716-446655440001",  "originalContent": "VGhpcyBpcyBiYXNlNjQgYmluYXJ5Lg==",  "originalContentLength": 0,  "originalContentSha256": "9f2c8c5a9d740eb56d...",  "originalContentRef": "s3://my-bucket/document.pdf",  "contentType": "text/plain",  "processingStatus": "COMPLETED",  "pageImageStatus": "COMPLETED",  "pageImageCount": 12,  "metadata": {    "source": "document",    "author": "John Doe"  },  "createdAt": 1672531200000,  "updatedAt": 1672531200000,  "createdById": "550e8400-e29b-41d4-a716-446655440002",  "updatedById": "550e8400-e29b-41d4-a716-446655440002",  "chunkingConfig": {    "recursive": {      "chunkSize": 1000,      "chunkOverlap": 200,      "separators": [        "\n\n",        "\n",        ".",        " "      ],      "keepStrategy": "KEEP_END",      "separatorIsRegex": false,      "lengthMeasurement": "CHARACTER_COUNT"    },    "sentence": {      "maxChunkSize": 1000,      "minChunkSize": 100,      "enableLanguageDetection": true,      "lengthMeasurement": "CHARACTER_COUNT"    }  },  "processingHistory": {    "latestJob": {      "jobId": 42,      "jobType": "document_processor",      "status": "BACKGROUND_JOB_RUNNING",      "attempts": 1,      "maxAttempts": 5,      "runAt": 1714713600000,      "leaseUntil": 1714713660000,      "lockedBy": "worker-1",      "lastError": "Transient network failure",      "updatedAt": 1714713615000,      "failureStage": "DOCUMENT_PROCESSING_STAGE_GENERATING_EMBEDDINGS"    }  }}