Overview
Creates a new memory space under the current project. A memory space serves as a logical isolation unit for memories and experiences. After creation, the spaceId is returned. This value must be used for the {spaceId} path parameter in all subsequent memory/experience API calls.
API details
Constraints
- The caller must have an API Key. For more information, see Manage AI API Keys.
Request path
POST {BASE_URL}/api/v1/memory/spaces
Request headers
Name |
Required |
Example Value |
Description |
|---|---|---|---|
| Authorization | Yes | Bearer {token} | Authentication Information |
| Content-Type | No | application/json | Request Body Format |
| X-OB-Project-ID | Yes | your-project-id | Project ID |
Request parameters
Body parameters
Name |
Type |
Whether required |
Example Value |
Description |
|---|---|---|---|---|
| spaceName | string | Yes | my-space | The name of the space, which must not exceed 128 characters in length. |
| description | string | No | A space for storing memories. | The maximum length of the space description is 512 characters. |
| dims | integer | No | 1536 | Vector dimensionality. If not specified, the server will determine it based on the provider's default value. |
| providerType | string | No | openai | Type of the LLM provider. This parameter does not affect the embedder (which is always qwen). |
| providerBaseUrl | string | No | https://api.openai.com | The base URL of the LLM service. |
| providerApiKey | string | No | sk-... | API key of the LLM service. |
| providerLlmModel | string | No | gpt-4 | The name of the LLM model. |
| providerEmbeddingModel | string | No | text-embedding-ada-002 | The name of the vector model. |
Response parameters
Response parameters
Name |
Type |
Description |
|---|---|---|
| success | boolean | Whether the request was successful |
| code | string | Response Code |
| message | string | Response parameters |
| data | object | Business response data |
Data field description
Upon successful creation, the data field contains information about the created memory space. The specific structure is defined by the server.
Request example
curl --request POST '{BASE_URL}/api/v1/memory/spaces' \
--header 'Authorization: Bearer {token}' \
--header 'X-OB-Project-ID: your-project-id' \
--header 'Content-Type: application/json' \
--data '{
"spaceName": "my-space",
"description": "A space for storing memories.",
"dims": 1024,
"providerType": "openai",
"providerBaseUrl": "https://api.openai.com",
"providerApiKey": "sk-...",
"providerLlmModel": "gpt-4",
"providerEmbeddingModel": "text-embedding-ada-002"
}'
Response example
{
"success": true,
"code": "201",
"message": "Created",
"data": {
"spaceId": "spc-1234567890abcdef"
}
}
