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

Open in Claude
Open in ChatGPT

List Blocks For Identity

identities.blocks.list(stridentity_id, BlockListParams**kwargs) -> SyncArrayPage[BlockResponse]
get/v1/identities/{identity_id}/blocks

Get all blocks associated with the specified identity.

ParametersExpand Collapse
identity_id: str

The ID of the identity in the format 'identity-'

minLength45
maxLength45
after: Optional[str]

Block ID cursor for pagination. Returns blocks that come after this block ID in the specified sort order

before: Optional[str]

Block ID cursor for pagination. Returns blocks that come before this block ID in the specified sort order

limit: Optional[int]

Maximum number of blocks to return

order: Optional[Literal["asc", "desc"]]

Sort order for blocks by creation time. 'asc' for oldest first, 'desc' for newest first

Accepts one of the following:
"asc"
"desc"
order_by: Optional[Literal["created_at"]]

Field to sort by

Accepts one of the following:
"created_at"
ReturnsExpand Collapse
class BlockResponse:
id: str

The id of the block.

value: str

Value of the block.

Deprecatedbase_template_id: Optional[str]

(Deprecated) The base template id of the block.

created_by_id: Optional[str]

The id of the user that made this Block.

Deprecateddeployment_id: Optional[str]

(Deprecated) The id of the deployment.

description: Optional[str]

Description of the block.

Deprecatedentity_id: Optional[str]

(Deprecated) The id of the entity within the template.

Deprecatedhidden: Optional[bool]

(Deprecated) If set to True, the block will be hidden.

is_template: Optional[bool]

Whether the block is a template (e.g. saved human/persona options).

label: Optional[str]

Label of the block (e.g. 'human', 'persona') in the context window.

last_updated_by_id: Optional[str]

The id of the user that last updated this Block.

limit: Optional[int]

Character limit of the block.

metadata: Optional[Dict[str, object]]

Metadata of the block.

Deprecatedpreserve_on_migration: Optional[bool]

(Deprecated) Preserve the block on template migration.

project_id: Optional[str]

The associated project id.

Deprecatedread_only: Optional[bool]

(Deprecated) Whether the agent has read-only access to the block.

Deprecatedtemplate_id: Optional[str]

(Deprecated) The id of the template.

Deprecatedtemplate_name: Optional[str]

(Deprecated) The name of the block template (if it is a template).

List Blocks For Identity
from letta_client import Letta

client = Letta(
    api_key="My API Key",
)
page = client.identities.blocks.list(
    identity_id="identity-123e4567-e89b-42d3-8456-426614174000",
)
page = page.items[0]
print(page.id)
[
  {
    "id": "id",
    "value": "value",
    "base_template_id": "base_template_id",
    "created_by_id": "created_by_id",
    "deployment_id": "deployment_id",
    "description": "description",
    "entity_id": "entity_id",
    "hidden": true,
    "is_template": true,
    "label": "label",
    "last_updated_by_id": "last_updated_by_id",
    "limit": 0,
    "metadata": {
      "foo": "bar"
    },
    "preserve_on_migration": true,
    "project_id": "project_id",
    "read_only": true,
    "template_id": "template_id",
    "template_name": "template_name"
  }
]
Returns Examples
[
  {
    "id": "id",
    "value": "value",
    "base_template_id": "base_template_id",
    "created_by_id": "created_by_id",
    "deployment_id": "deployment_id",
    "description": "description",
    "entity_id": "entity_id",
    "hidden": true,
    "is_template": true,
    "label": "label",
    "last_updated_by_id": "last_updated_by_id",
    "limit": 0,
    "metadata": {
      "foo": "bar"
    },
    "preserve_on_migration": true,
    "project_id": "project_id",
    "read_only": true,
    "template_id": "template_id",
    "template_name": "template_name"
  }
]