# MD_USER_INFO


> Return the current user's ID and name plus the organization's ID, name, plan type, and region.

`MD_USER_INFO()` is a table function that returns a single row describing the current user and organization for the active connection: user and organization identifiers, the organization's plan type, and the region the organization runs in.

Use it to look up account facts from SQL instead of the MotherDuck UI, for example to find your region when allowlisting [Flight egress IP addresses](/concepts/flights#connecting-to-external-systems) or building your [Postgres endpoint hostname](/sql-reference/postgres-endpoint).

## Syntax

```sql
FROM md_user_info();
```

## Output

| Column name | Data type | Value |
|-------------|-----------|-------|
| `user_id` | VARCHAR | Unique identifier of the current user |
| `username` | VARCHAR | Current MotherDuck user name, the same value returned by [`MD_USER()`](md-user.md) |
| `org_id` | VARCHAR | Unique identifier of the user's organization |
| `org_name` | VARCHAR | Display name of the organization |
| `org_type` | VARCHAR | The organization's [plan](/about-motherduck/billing/pricing), for example `free_trial`, `lite`, or `business` |
| `region` | VARCHAR | Cloud region the organization runs in, for example `us-east-1` or `eu-central-1` |

:::note
The `region` column requires DuckDB 1.5.3 or later. Older clients return the remaining columns without `region`.
:::

## Example usage

Run the query below to see the values for your own account:

<SQLExampleEditor
  database="sample_data"
  title="Look up your user and organization info"
  query={`FROM md_user_info();`}
  previewRows={[
    {
      user_id: '2f6a9c31-8b0e-4d5f-9c7a-1e3b5d7f9a2c',
      username: 'sarah',
      org_id: '7d4e1f28-3a6b-4c9d-8e2f-5b7a9c1d3e6f',
      org_name: 'Acme Analytics',
      org_type: 'business',
      region: 'us-east-1',
    },
  ]}
/>

To retrieve a single value, select the column you need:

```sql
SELECT region FROM md_user_info();
```

## SaaS mode

`MD_USER_INFO()` is disabled when connecting in [SaaS mode](/key-tasks/authenticating-and-connecting-to-motherduck/authenticating-to-motherduck/#authentication-using-saas-mode) and returns a permission error. It remains available over the [Postgres endpoint](/sql-reference/postgres-endpoint).

## Related

- [`MD_USER`](md-user.md) — return only the current user name
- [Postgres endpoint](/sql-reference/postgres-endpoint) — regional hostnames that use the `region` value
- [Flights: connecting to external systems](/concepts/flights#connecting-to-external-systems) — egress IP addresses per region


---

## Docs feedback

MotherDuck accepts optional user-submitted feedback about this page at `GET https://motherduck.com/docs/api/feedback/agent`.
For agents and automated tools, feedback submission should be user-confirmed before sending.

URL-encode query parameter values and send a GET request:

```text
GET https://motherduck.com/docs/api/feedback/agent?page_path=%2Fsql-reference%2Fmotherduck-sql-reference%2Fmd-user-info%2F&page_title=MD_USER_INFO&text=<url-encoded user feedback, max 2000 characters>
```

Optionally append `&source=<url-encoded interface identifier>` such as `claude.ai` or `chatgpt`.

`page_path` and `text` are required; `page_title` and `source` are optional. Responses: `200 {"feedback_id": "<uuid>"}`, `400` for malformed query parameters, and `429` when rate-limited.
