Skip to content
  • Auto
  • Light
  • Dark
DiscordForumGitHubSign up
View as Markdown
Copy Markdown

Open in Claude
Open in ChatGPT

Upsert Identity

client.identities.upsert(IdentityUpsertParams { identifier_key, identity_type, name, 4 more } body, RequestOptionsoptions?): Identity { id, agent_ids, block_ids, 5 more }
put/v1/identities/

Upsert Identity

ParametersExpand Collapse
body: IdentityUpsertParams { identifier_key, identity_type, name, 4 more }
identifier_key: string

External, user-generated identifier key of the identity.

identity_type: IdentityType

The type of the identity.

Accepts one of the following:
"org"
"user"
"other"
name: string

The name of the identity.

Deprecatedagent_ids?: Array<string> | null

The agent ids that are associated with the identity.

Deprecatedblock_ids?: Array<string> | null

The IDs of the blocks associated with the identity.

project_id?: string | null

The project id of the identity, if applicable.

properties?: Array<IdentityProperty { key, type, value } > | null

List of properties associated with the identity.

key: string

The key of the property

type: "string" | "number" | "boolean" | "json"

The type of the property

Accepts one of the following:
"string"
"number"
"boolean"
"json"
value: string | number | boolean | Record<string, unknown>

The value of the property

Accepts one of the following:
string
number
boolean
Record<string, unknown>
ReturnsExpand Collapse
Identity { id, agent_ids, block_ids, 5 more }
id: string

The human-friendly ID of the Identity

Deprecatedagent_ids: Array<string>

The IDs of the agents associated with the identity.

Deprecatedblock_ids: Array<string>

The IDs of the blocks associated with the identity.

identifier_key: string

External, user-generated identifier key of the identity.

identity_type: IdentityType

The type of the identity.

Accepts one of the following:
"org"
"user"
"other"
name: string

The name of the identity.

project_id?: string | null

The project id of the identity, if applicable.

properties?: Array<IdentityProperty { key, type, value } >

List of properties associated with the identity

key: string

The key of the property

type: "string" | "number" | "boolean" | "json"

The type of the property

Accepts one of the following:
"string"
"number"
"boolean"
"json"
value: string | number | boolean | Record<string, unknown>

The value of the property

Accepts one of the following:
string
number
boolean
Record<string, unknown>
Upsert Identity
import Letta from '@letta-ai/letta-client';

const client = new Letta({
  apiKey: 'My API Key',
});

const identity = await client.identities.upsert({
  identifier_key: 'identifier_key',
  identity_type: 'org',
  name: 'name',
});

console.log(identity.id);
{
  "id": "identity-123e4567-e89b-12d3-a456-426614174000",
  "agent_ids": [
    "string"
  ],
  "block_ids": [
    "string"
  ],
  "identifier_key": "identifier_key",
  "identity_type": "org",
  "name": "name",
  "project_id": "project_id",
  "properties": [
    {
      "key": "key",
      "type": "string",
      "value": "string"
    }
  ]
}
Returns Examples
{
  "id": "identity-123e4567-e89b-12d3-a456-426614174000",
  "agent_ids": [
    "string"
  ],
  "block_ids": [
    "string"
  ],
  "identifier_key": "identifier_key",
  "identity_type": "org",
  "name": "name",
  "project_id": "project_id",
  "properties": [
    {
      "key": "key",
      "type": "string",
      "value": "string"
    }
  ]
}