Skip to main content
GET
/
identity
Python
import os
from datagrid_ai import Datagrid

client = Datagrid(
    api_key=os.environ.get("DATAGRID_API_KEY"),  # This is the default and can be omitted
)
identity = client.identity.retrieve()
print(identity.current_teamspace_id)
{
  "object": "identity",
  "user_id": "<string>",
  "current_teamspace_id": "<string>",
  "teamspaces": [
    {
      "teamspace_id": "<string>",
      "permissions": {
        "agent_ids": [
          "<string>"
        ]
      }
    }
  ]
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Response

Caller identity

object
enum<string>
required
Available options:
identity
user_id
string
required

The ID of the authenticated user.

current_teamspace_id
string
required

The teamspace ID this request is scoped to. Resolution depends on the caller type:

  • Org-scoped API keys (default): always the teamspace the key was minted in. The Datagrid-Teamspace header is ignored.
  • Account-scoped API keys (scopeLevel: "account"): the teamspace selected by the Datagrid-Teamspace header, when that teamspace lives under the same account as the key. Falls back to the key's home teamspace when the header is absent.
  • JWT callers: the Datagrid-Teamspace header when present (and the user is a member), otherwise the user's default teamspace.
teamspaces
object[]
required

All teamspaces the authenticated user is a member of.