MemoryKit

Upsert User

Create or update a user. Upsert is idempotent.

POST/v1/users

Request body

idstringrequired

Your app's user ID.

namestring

User's display name.

emailstring

User's email.

metadataobject

Arbitrary key-value pairs. Merged with existing metadata on update.

Response

idstring

The user ID.

namestring

User's display name.

emailstring

User's email.

metadataobject

Arbitrary key-value pairs.

created_atstring

ISO 8601 creation timestamp.

updated_atstring

ISO 8601 last update timestamp.

Example response
{
  "id": "user_123",
  "name": "Alice",
  "email": "alice@example.com",
  "metadata": { "plan": "pro" },
  "created_at": "2025-01-15T10:30:00Z",
  "updated_at": "2025-01-15T10:30:00Z"
}
const user = await mk.users.upsert({
  id: "user_123",
  name: "Alice",
  email: "alice@example.com",
  metadata: { plan: "pro" },
});
Edit on GitHub

On this page