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

# Get Org Context

> Resolve which organization the caller operates under, and their role in it

## Overview

Returns the organization context for the caller: the profile ID, the organization, and the caller's role in it. The Danube MCP server uses it to attribute requests to an organization. Clients can use it to learn which organization a key is bound to before generating a team `.mcp.json` (see [Get MCP JSON](/api-reference/endpoint/claude_code_mcp_json)).

**Auth:** Accepts either JWT or API key (`danube-api-key` header).

Resolution order:

1. An explicit organization selector, the `org_id` query parameter or the `danube-org-id` header (the query parameter wins when both are sent). The caller must be a member. A non-member gets `404`, not `403`, so organization IDs are not leaked.
2. Otherwise, for an API key caller, the organization the key is bound to. Keys without a bound organization fall back to the owner's personal organization.
3. Otherwise, for a JWT caller, the personal organization.

The Python and TypeScript SDKs do not wrap this endpoint yet. Call it directly.

## Query Parameters

<ParamField query="org_id" type="string">
  Organization UUID to resolve. Requires membership.
</ParamField>

## Headers

<ParamField header="danube-org-id" type="string">
  Same as `org_id`. Ignored when the query parameter is present.
</ParamField>

## Response

<ResponseField name="user_id" type="string">
  The caller's profile ID
</ResponseField>

<ResponseField name="org_id" type="string">
  The resolved organization UUID
</ResponseField>

<ResponseField name="org_name" type="string">
  Organization display name. `null` if the organization row could not be loaded.
</ResponseField>

<ResponseField name="org_slug" type="string">
  Organization URL slug. `null` if the organization row could not be loaded.
</ResponseField>

<ResponseField name="role" type="string">
  The caller's role in the organization: `owner`, `admin`, `member` or `viewer`. `null` if the key's owner is not a member of the key's bound organization.
</ResponseField>

## Errors

| Code | Meaning                                                                                                      |
| ---- | ------------------------------------------------------------------------------------------------------------ |
| 401  | No credentials, or no profile exists for the caller                                                          |
| 404  | The selected organization does not exist or the caller is not a member, or no organization could be resolved |

## Example

<RequestExample>
  ```bash cURL theme={null}
  curl -X GET "https://api.danubeai.com/v1/claude-code/org-context" \
    -H "danube-api-key: YOUR_API_KEY"
  ```

  ```bash cURL (explicit org) theme={null}
  curl -X GET "https://api.danubeai.com/v1/claude-code/org-context?org_id=8f0c2c4e-6c1b-4f7e-9d2a-3b5e1a9c7d10" \
    -H "danube-api-key: YOUR_API_KEY"
  ```
</RequestExample>

<ResponseExample>
  ```json theme={null}
  {
    "user_id": "3f2b1c8e-9a7d-4e6f-b5c4-2d1e0f9a8b7c",
    "org_id": "8f0c2c4e-6c1b-4f7e-9d2a-3b5e1a9c7d10",
    "org_name": "Acme Robotics",
    "org_slug": "acme-robotics",
    "role": "admin"
  }
  ```
</ResponseExample>
