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

# Current caller

> Discover the organizations, environments, tenants, and knowledge bases available to the current caller.

Use the current-caller endpoint to bootstrap a dashboard session or inspect an API key's effective context before making resource requests.

## Endpoints

| Method | Path        | Description                                                        | Auth        |
| ------ | ----------- | ------------------------------------------------------------------ | ----------- |
| `GET`  | `/users/me` | Return the signed-in user's resource tree or the API key's context | \[User+Key] |

***

### Get the current caller

`GET /users/me`

The response shape depends on how the request is authenticated.

<CardGroup cols={2}>
  <Card title="User session" icon="user">
    Returns the current user plus every organization membership, role, environment, tenant, and knowledge base available through that membership.
  </Card>

  <Card title="API key" icon="key">
    Returns `authType: "api_key"`, key metadata and scopes, tenant and knowledge-base allowlists, and the key's environment and organization.
  </Card>
</CardGroup>

```bash theme={null}
curl "https://api.autosage.ai/api/v1/users/me" \
  -H "Authorization: Bearer $AUTOSAGE_KEY"
```

For a user session:

```bash theme={null}
curl "https://api.autosage.ai/api/v1/users/me" \
  -H "Cookie: YOUR_SESSION_COOKIE"
```

<Tip>
  Call this endpoint during setup to discover IDs instead of storing organization and environment configuration in multiple places. For API keys, an empty `tenantIds` or `knowledgeBaseIds` array is an unrestricted allowlist within the key's higher-level boundary, not zero access.
</Tip>

<Note>
  This endpoint describes the caller's context; it does not replace endpoint-specific scope and role checks. A key can only call routes that allow API-key actors and for which it has the required scope.
</Note>

## Next steps

<CardGroup cols={2}>
  <Card title="Authentication" icon="key" href="/developers/authentication">
    Choose between user sessions and API keys.
  </Card>

  <Card title="Tenancy" icon="sitemap" href="/developers/concepts/tenancy">
    Understand the resource tree returned here.
  </Card>

  <Card title="API keys" icon="shield-keyhole" href="/developers/api/api-keys">
    Configure scopes and resource allowlists.
  </Card>
</CardGroup>
