Skip to content

Namespace management

Namespaces are managed through the Cloudflare REST API. A namespace is a top-level container that scopes memory profiles for your application.

All requests require an API token with the appropriate permissions.

Base URL

https://api.cloudflare.com/client/v4/accounts/{account_id}/agent-memory/namespaces

Authentication

Include your API token in the Authorization header:

Authorization: Bearer {api_token}

Create a namespace

Creates a new namespace for the given account.

Request

POST /client/v4/accounts/{account_id}/agent-memory/namespaces

Request body

{
"name": "my-app"
}
FieldTypeRequiredDescription
namestringYesThe namespace name. Maximum 32 characters. Lowercase letters, digits, and hyphens only ([a-z0-9-]). Must be unique within the account.

Response

{
"result": {
"namespace_id": "01JSGCEXAMPLE000000000000",
"name": "my-app",
"created_at": "2026-04-21T00:00:00.000Z",
"updated_at": "2026-04-21T00:00:00.000Z"
},
"success": true,
"errors": [],
"messages": []
}

Example

Terminal window
curl -X POST "https://api.cloudflare.com/client/v4/accounts/{account_id}/agent-memory/namespaces" \
-H "Authorization: Bearer {api_token}" \
-H "Content-Type: application/json" \
-d '{"name": "my-app"}'

List namespaces

Lists all namespaces for the given account. Results are paginated.

Request

GET /client/v4/accounts/{account_id}/agent-memory/namespaces

Query parameters

ParameterTypeDefaultDescription
per_pageinteger20Number of results per page. Range: 1 to 1000.
cursorstringCursor for the next page of results. Returned in the result_info of the previous response.

Response

{
"result": [
{
"namespace_id": "01JSGCEXAMPLE000000000000",
"name": "my-app",
"created_at": "2026-04-21T00:00:00.000Z",
"updated_at": "2026-04-21T00:00:00.000Z"
}
],
"result_info": {
"count": 1,
"cursor": ""
},
"success": true,
"errors": [],
"messages": []
}

Example

Terminal window
curl "https://api.cloudflare.com/client/v4/accounts/{account_id}/agent-memory/namespaces?per_page=50" \
-H "Authorization: Bearer {api_token}"

Get a namespace

Retrieves a single namespace by name.

Request

GET /client/v4/accounts/{account_id}/agent-memory/namespaces/{namespace_name}

Response

{
"result": {
"namespace_id": "01JSGCEXAMPLE000000000000",
"name": "my-app",
"created_at": "2026-04-21T00:00:00.000Z",
"updated_at": "2026-04-21T00:00:00.000Z"
},
"success": true,
"errors": [],
"messages": []
}

Example

Terminal window
curl "https://api.cloudflare.com/client/v4/accounts/{account_id}/agent-memory/namespaces/my-app" \
-H "Authorization: Bearer {api_token}"

Delete a namespace

Soft-deletes a namespace. The namespace name becomes available for reuse after deletion.

Request

DELETE /client/v4/accounts/{account_id}/agent-memory/namespaces/{namespace_name}

Response

{
"result": null,
"success": true,
"errors": [],
"messages": []
}

Example

Terminal window
curl -X DELETE "https://api.cloudflare.com/client/v4/accounts/{account_id}/agent-memory/namespaces/my-app" \
-H "Authorization: Bearer {api_token}"

Error responses

All endpoints return standard Cloudflare V4 error responses on failure:

{
"result": null,
"success": false,
"errors": [
{
"code": 10001,
"message": "Namespace name already exists"
}
],
"messages": []
}

Common error scenarios:

ScenarioHTTP status
Invalid namespace name format400
Authentication failure401
Namespace name already exists409
Namespace not found404