# Organizations and the active Mind

Select the organization and instance that dashboard requests operate on.

Source: https://docs.minds.sh/docs/api/platform/organizations



The active organization sets the account context. The active service chooses the dedicated Mind used for memory and engine requests. Set both before starting an operation that depends on them.

## 1. Load accessible organizations [#1-load-accessible-organizations]

`GET /api/organizations` returns `organizations`, `activeOrganizationId`, and `tenants`. The server combines the validated session with the saved active-tenant cookie and the organizations accessible to that user.

```typescript
const response = await fetch('/api/organizations', { cache: 'no-store' });
if (!response.ok) throw new Error(`HTTP ${response.status}`);
const context = await response.json();
```

## 2. Select an organization [#2-select-an-organization]

Send an ID from that accessible list to `POST /api/organizations/active`:

```json
{ "organizationId": "<accessible-organization-id>" }
```

The server reloads available organizations before setting its active-tenant cookie. An inaccessible ID returns `ORG_NOT_AVAILABLE` with 404. Success returns `{success:true, organizationId}`. Selection affects later dashboard requests; it does not move an existing Mind between organizations.

## 3. Select a Mind [#3-select-a-mind]

Use `GET /api/instance-context/services` to load available services. Set the chosen ID with `POST /api/instance-context/active`:

```json
{ "serviceId": "<service-id>" }
```

The active-service route stores `akasha.activeService`; `GET` reads it back as `serviceId` or `null`. The Akasha proxy independently resolves that choice against services belonging to the active organization before it forwards an instance request. The cookie alone does not authorize access.

`GET /api/chat/context` returns the operator context used by Helm. Reload it after an organization or Mind change so the conversation acts in the intended context.

## Create an organization [#create-an-organization]

`POST /api/organizations` accepts:

```json
{ "name": "Research team", "slug": "research-team" }
```

Names must be 2–80 characters. Slugs are normalized to lowercase, must be 2–64 characters, and use letters, numbers, and internal hyphens. The first and last characters must be alphanumeric. Success is 201 and returns `organization` and `activeOrganizationId`; it also sets the active-tenant cookie.

## Handle missing context [#handle-missing-context]

| Result                                              | Next step                                                                                                   |
| --------------------------------------------------- | ----------------------------------------------------------------------------------------------------------- |
| 401 `UNAUTHENTICATED`                               | Complete sign-in                                                                                            |
| 409 `NO_ORGANIZATION`                               | Create or select an accessible organization                                                                 |
| 409 `NO_AKASHA_SERVICE`                             | Provision or select a Mind for the active organization                                                      |
| An optional dashboard panel returns an empty result | Check [proxy fallback behavior](/docs/api/platform/proxies) before interpreting it as a real empty database |

Source: the dashboard `organizations`, `instance-context`, `chat/context`, and `akasha/proxy` route modules. Exact payloads and response branches are in the [endpoint catalog](/docs/api/platform/endpoints).
