SmartMemory
POST
/memory/graph/bulk

Bulk upsert nodes and edges into the knowledge graph.

Optionally deletes the caller's own nodes matching delete_prefix (scoped to the caller's workspace) before writing, enabling clean replace-all semantics. In a shared workspace, nodes other members or no one authored are kept (SEC-CLEAR-ALL-SHARED-WS-1).

Authorization

AuthorizationBearer <token>

Send Authorization: Bearer <token>. The token is either a Clerk session JWT or a SmartMemory API key (prefix sm_live_, sm_test_, or legacy sk_).

In: header

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Request body for bulk graph writes with optional prefix deletion.

Response Body

application/json

application/json

curl -X POST "https://example.com/memory/graph/bulk" \  -H "Content-Type: application/json" \  -d '{}'
{
  "nodes_upserted": 0,
  "edges_upserted": 0,
  "nodes_deleted": 0,
  "nodes_refused": [
    "string"
  ]
}
{
  "detail": [
    {
      "loc": [
        "string"
      ],
      "msg": "string",
      "type": "string",
      "input": null,
      "ctx": {}
    }
  ]
}