Control plane
The Long-term Memory Service uses projects and API keys (SKs) to manage an application's access scope. This topic describes how to create and delete projects and how to create, disable, activate, revoke, and delete SKs.
Prerequisites
LindormTable, LindormSearch, LindormVector, and LindormAI are enabled, and the Long-term Memory Service activation configuration is complete.
The username and password of the Lindorm instance account. Control plane API requests use these credentials for authentication.
Each project must also have access permissions for the Long-term Memory Service. If access permissions are not enabled for a project, the API returns HTTP 403 with the error identifier PROJECT_NOT_ENABLED. For details, see Data plane access restriction.
Authentication
Control plane APIs use HTTP Basic authentication with a Lindorm instance account. The request header uses the format Authorization: Basic <credentials>, where <credentials> is the Base64-encoded UTF-8 value of username:password. Obtain and manage the account information in the Lindorm console. When you use curl, pass the instance account in the form curl -u "username:password"; curl automatically generates the Basic authentication request header.
The request URL consists of the service endpoint and the API path.
Control plane request parameters use names such as projectId and keyId, whereas native data APIs use names such as user_id. For the exact parameter names, see the parameter description of each API in this topic.
The control plane manages the lifecycle of projects and SKs. The data plane (/lmemo/v1/*) provides APIs for memories, sessions, user profiles, and user contexts.
Response format
A successful response contains status and payload. For example, status is 200 OK. payload contains the business result of the operation.
An HTTP status code of 200 does not guarantee that the operation succeeded. A failed request can return HTTP status code 200 with payload.success set to false and an error identifier in payload.error_code. To determine whether a request succeeded, check both the HTTP status code and payload.success.
API list
| Method | API path | Description |
| POST | /lmemo/project/register | Register a project |
| POST | /lmemo/project/delete | Delete a project |
| POST | /lmemo/project/key/create | Create an SK |
| POST | /lmemo/project/key/disable | Disable an SK |
| POST | /lmemo/project/key/activate | Reactivate an SK |
| POST | /lmemo/project/key/revoke | Revoke an SK |
| POST | /lmemo/project/key/delete | Delete an SK |
| POST | /lmemo/project/list | List projects |
| POST | /lmemo/project/get | Query project details |
| POST | /lmemo/project/keys | List the SKs for a project |
All control plane APIs use the POST method. Pass business parameters in a JSON request body. If an API takes no business parameters, use {} as the request body.
Prepare the connection information
Replace ENDPOINT in the sample commands with the service endpoint, which includes the protocol, hostname, and port. The username and password in the commands are those of the Lindorm instance account.
ENDPOINT="<service-endpoint>"Register a project
Create a project to manage an application's access scope.
Sample request
Run the following command to register a project:
curl --request POST "${ENDPOINT}/lmemo/project/register" \
-u "username:password" \
--header "Content-Type: application/json" \
--data-raw '{
"projectId": "proj_demo",
"name": "demo",
"description": "demo",
"isDefault": false
}'| Parameter | Required | Description |
projectId | Yes | The project ID. |
name | No | The display name. |
description | No | The description. |
isDefault | No | Default value: false. |
This operation is idempotent. If you register a project that already exists, the original project information is retained.
Create an SK
Create an SK for a specified project. After the request succeeds, the SK plaintext and the SK metadata are returned.
Sample request
Run the following command to create an SK:
curl --request POST "${ENDPOINT}/lmemo/project/key/create" \
-u "username:password" \
--header "Content-Type: application/json" \
--data-raw '{
"projectId": "proj_demo",
"keyId": "key_default",
"description": "default"
}'| Parameter | Required | Description |
projectId | Yes | The project ID. |
keyId | Yes | The ID of the SK. |
description | No | The description. |
Sample response
The following sample response is returned:
{
"status": "200 OK",
"payload": {
"action": "key_create",
"project_id": "proj_demo",
"key_id": "key_default",
"sk": "sk-...",
"sk_prefix": "sk-abc...",
"status": "active",
"one_time_reveal": true,
"message": "SK plaintext is shown only once. Rotate key if lost.",
"success": true
}
}The SK plaintext is returned only once, when the SK is created successfully. Store it securely. A lost plaintext cannot be queried again. Create a new SK and complete key rotation.
Manage key states
A key state management request specifies the target by using projectId and keyId, and the response contains action, project_id, key_id, and success. A project deletion request specifies the target by using projectId.
disableandactivate: Temporarily disable an SK and restore it.revoke: Sets the SK status torevoked. The original SK cannot be used for data APIs, but you can still reactivate it withactivate.delete: Deletes the SK record and invalidates the original SK. The deletion is irreversible. To permanently disable the original SK, usedelete.
After an SK is disabled, revoked, or deleted, data API requests that use the SK return HTTP 401. To restore data plane access, use activate to reactivate a disabled or revoked SK.
Sample requests
Disable a key
Run the following command:
curl --request POST "${ENDPOINT}/lmemo/project/key/disable" \
-u "username:password" \
--header "Content-Type: application/json" \
--data-raw '{
"projectId": "proj_demo",
"keyId": "key_default"
}'Activate a key
Run the following command:
curl --request POST "${ENDPOINT}/lmemo/project/key/activate" \
-u "username:password" \
--header "Content-Type: application/json" \
--data-raw '{
"projectId": "proj_demo",
"keyId": "key_default"
}'Revoke a key
Run the following command:
curl --request POST "${ENDPOINT}/lmemo/project/key/revoke" \
-u "username:password" \
--header "Content-Type: application/json" \
--data-raw '{
"projectId": "proj_demo",
"keyId": "key_default"
}'Delete a key
Run the following command:
curl --request POST "${ENDPOINT}/lmemo/project/key/delete" \
-u "username:password" \
--header "Content-Type: application/json" \
--data-raw '{
"projectId": "proj_demo",
"keyId": "key_default"
}'Delete a project
Deleting a project also removes its SKs, but does not clean up existing sessions, profiles, or memory data. If you need to clean up the data, do so before deleting the project.
Run the following command to delete a project:
curl --request POST "${ENDPOINT}/lmemo/project/delete" \
-u "username:password" \
--header "Content-Type: application/json" \
--data-raw '{
"projectId": "proj_demo"
}'Query projects and keys
Sample requests
Run the following commands to list projects, query project details, and list the SKs for a project:
curl --request POST "${ENDPOINT}/lmemo/project/list" \
-u "username:password" \
--header "Content-Type: application/json" \
--data-raw '{}'
curl --request POST "${ENDPOINT}/lmemo/project/get" \
-u "username:password" \
--header "Content-Type: application/json" \
--data-raw '{
"projectId": "proj_demo"
}'
curl --request POST "${ENDPOINT}/lmemo/project/keys" \
-u "username:password" \
--header "Content-Type: application/json" \
--data-raw '{
"projectId": "proj_demo",
"includeSecret": false
}'Each element in the keys array contains metadata such as key_id, sk_prefix, status, and created_at. It does not contain the SK plaintext. The SK plaintext cannot be retrieved through this API: if you call /lmemo/project/keys with includeSecret=true, the HTTP status code is 200, but payload.success=false and payload.error_code=SK_NOT_RETRIEVABLE. Set includeSecret to false to query the SK metadata.
Data plane access restriction
A project must have access permissions for the Long-term Memory Service. If access permissions are not enabled for a project, the API returns HTTP 403 with the error identifier PROJECT_NOT_ENABLED. Make sure that the project activation configuration is complete.