> ## Documentation Index
> Fetch the complete documentation index at: https://developers.datagrid.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Retrieve current identity

> Returns the identity of the authenticated caller — the user ID, current teamspace, and all teamspace memberships that the API key or JWT resolves to.




## OpenAPI

````yaml get /identity
openapi: 3.0.3
info:
  version: 0.1.1
  title: Datagrid API
  description: Datagrid API
servers:
  - url: https://api.datagrid.com/v1
security:
  - BearerAuth: []
paths:
  /identity:
    get:
      tags:
        - Identity
      summary: Retrieve current identity
      description: >
        Returns the identity of the authenticated caller — the user ID, current
        teamspace, and all teamspace memberships that the API key or JWT
        resolves to.
      operationId: RetrieveMe
      responses:
        '200':
          description: Caller identity
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Identity'
        '429':
          description: >-
            Rate limit exceeded. The request has been throttled because the rate
            limit for this endpoint has been reached. Check the `Retry-After`
            response header and retry after the specified number of seconds.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RateLimitError'
components:
  schemas:
    Identity:
      type: object
      required:
        - object
        - user_id
        - current_teamspace_id
        - teamspaces
      properties:
        object:
          type: string
          enum:
            - identity
        user_id:
          type: string
          description: The ID of the authenticated user.
        current_teamspace_id:
          type: string
          description: |
            The teamspace ID this request is scoped to. Resolution depends on
            the caller type:

              - **API keys with "All Teamspaces" access** (`scopeLevel:
                "account"`): the teamspace selected by the
                `Datagrid-Teamspace` header, when that teamspace lives under
                the same account as the key's home teamspace.
              - **API keys with "Selected Teamspaces" access**
                (`scopeLevel: "org"`): the teamspace selected by the
                `Datagrid-Teamspace` header, when it is on the key's
                teamspace list. A key whose list holds only its home
                teamspace ignores the header.
              - For either kind of key, the key's home teamspace (the one
                it was created in) 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:
          type: array
          description: All teamspaces the authenticated user is a member of.
          items:
            $ref: '#/components/schemas/IdentityTeamspace'
        procore:
          $ref: '#/components/schemas/IdentityProcore'
          description: >
            The Procore company and project the current teamspace is bound to.
            Omitted when the teamspace's account is not linked to a Procore
            company.
    RateLimitError:
      type: object
      description: >-
        Returned when the rate limit is exceeded. Rate limits are enforced per
        teamspace, endpoint path, and HTTP method over a 60-second sliding
        window. Each endpoint may have its own limit — check the
        X-RateLimit-Limit response header for the effective value.
      required:
        - error
        - message
        - retryable
        - status_code
      properties:
        status_code:
          type: integer
          description: The HTTP status code (429).
        statusCode:
          type: integer
          deprecated: true
          description: Deprecated. Use status_code instead.
        error:
          type: string
          enum:
            - rate_limit_exceeded
          description: The error code identifying this as a rate limit error.
        message:
          type: string
          description: A human-readable error message.
        mitigation:
          type: string
          description: Suggested action to resolve the error.
        retryable:
          type: boolean
          description: Whether the request can be retried after a delay.
        details:
          type: object
          properties:
            reason:
              type: string
              description: A detailed explanation of why the rate limit was exceeded.
    IdentityTeamspace:
      type: object
      required:
        - teamspace_id
        - permissions
      properties:
        teamspace_id:
          type: string
          description: The ID of the teamspace.
        permissions:
          $ref: '#/components/schemas/TeamspaceUserPermissions'
          description: The permissions the user holds in this teamspace.
    IdentityProcore:
      type: object
      required:
        - company_id
        - company_name
      properties:
        company_id:
          type: string
          description: The Procore company ID the current teamspace's account is linked to.
        company_name:
          type: string
          description: The name of the linked Procore company, as stored in Datagrid.
        project_id:
          type: string
          description: >-
            The Procore project ID the current teamspace is bound to. Omitted
            when the teamspace is not project-scoped.
        zone:
          type: string
          description: The Procore zone the company lives in. Omitted when unknown.
    TeamspaceUserPermissions:
      type: object
      description: Represents a permission assigned to a user
      required:
        - role
      properties:
        role:
          type: string
          enum:
            - owner
            - admin
            - member
            - collaborator
            - agents-only
            - agent-specific
          description: >
            The role assigned to the user. Available roles:

            - **owner**: Creator of the teamspace. Full control over the
            teamspace. Can manage all users, settings, and resources.

            - **admin**: Full control over the teamspace. Can manage all users,
            settings, and resources.

            - **member**: Standard member access. Can view and interact with
            teamspace resources. Can invite other members.

            - **collaborator**: Read-only access with ability to comment and
            provide feedback.

            - **agents-only**: Access limited to AI agent interactions within
            the teamspace.

            - **agent-specific**: Limited access on teamspace level, can only
            access agents that are assigned to the teamspace.
        agent_ids:
          type: array
          nullable: true
          items:
            type: string
          description: >-
            The agent IDs that the user has access to, if the role is
            agent-specific.
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.