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

# Make a member the owner of your organisation

> Hand your organisation to another member. Only the owner can, and becomes an admin. Takes a signed-in console session, never an API key.

Makes one of your organisation's members its owner. An organisation always has exactly one owner, so in the same step **you become an admin**. You keep your seat, your sign-in and everything an admin can do; you can no longer transfer ownership, and only the new owner can give it back.

Only the current owner can do this. The person must already be a member of your organisation, and their account must be active. To hand the organisation to someone who is not a member yet, [invite them](https://docs.mithunai.com/api-reference/invitations/create-invitation.md) first.

Two other things happen:

* **Any API key you created with the owner role is revoked**, because an admin cannot create one. Keys you created with other roles keep working. The response says how many were revoked.
* **Both of you are sent an email** saying the owner has changed, if your deployment can send email. `notified` in the response says whether both messages went. The change stands either way.

This endpoint takes a **signed-in console session**, not an API key. Send the session cookies your browser received when you signed in, plus the `X-CSRF-Token` header set to the value of the `csrf_token` cookie. A request authenticated with an `mithunai_sk_` key is refused with `403`. There is no request body.

If you are not the owner you get `403`. Naming yourself, or a member whose account is not active, returns `409`. A member who does not exist, a member of another organisation and a malformed ID all return the same `404`. See [Members](https://docs.mithunai.com/administration/members.md).

**account\_id** `string` *required*

The account ID (UUID) of the member who will become the owner, as returned in `account_id` by
[List members](https://docs.mithunai.com/api-reference/members/list-members.md).

**X-CSRF-Token** `string` *required*

The value of your session's `csrf_token` cookie (named `__Host-csrf_token` when the console is
served over HTTPS without a shared cookie domain). A missing or mismatched token returns `401`.

## Response

**owner** `object` *required*

The new owner, as a [member](https://docs.mithunai.com/api-reference/members/list-members.md) with `role` `owner`.

**previous\_owner** `object` *required*

You, as a member with `role` `admin`.

**revoked\_api\_keys** `integer` *required*

How many owner-role API keys you had created were revoked.

**notified** `boolean` *required*

`true` when both of you were sent an email about the change.

```bash cURL theme={"theme":{"light":"github-light","dark":"github-dark"}}
# cookies.txt holds the cookies from your signed-in console session.
curl --request POST "$MITHUNAI_URL/mithunai/api/v1/members/7c9e6679-7425-40de-944b-e07fc1f90ae7/make-owner" \
  --cookie cookies.txt \
  --header "X-CSRF-Token: $MITHUNAI_CSRF_TOKEN"
```

```python Python theme={"theme":{"light":"github-light","dark":"github-dark"}}
import os
from http.cookiejar import MozillaCookieJar

import requests

jar = MozillaCookieJar("cookies.txt")
jar.load()

account_id = "7c9e6679-7425-40de-944b-e07fc1f90ae7"
response = requests.post(
    f"{os.environ['MITHUNAI_URL']}/mithunai/api/v1/members/{account_id}/make-owner",
    cookies=jar,
    headers={"X-CSRF-Token": os.environ["MITHUNAI_CSRF_TOKEN"]},
    timeout=30,
)
response.raise_for_status()
print(response.json())
```

```javascript JavaScript theme={"theme":{"light":"github-light","dark":"github-dark"}}
// Runs in a page on the MITHUNAI console's own origin, while signed in.
// csrfToken is the value of the csrf_token cookie.
const accountId = '7c9e6679-7425-40de-944b-e07fc1f90ae7'
const response = await fetch(`/mithunai/api/v1/members/${accountId}/make-owner`, {
  method: 'POST',
  credentials: 'include',
  headers: { 'X-CSRF-Token': csrfToken },
})
console.log(await response.json())
```

```json 200 theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
  "owner": {
    "account_id": "7c9e6679-7425-40de-944b-e07fc1f90ae7",
    "email": "sam@example.com",
    "name": "Sam",
    "role": "owner",
    "status": "active"
  },
  "previous_owner": {
    "account_id": "3f1b2c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d",
    "email": "you@example.com",
    "name": "You",
    "role": "admin",
    "status": "active"
  },
  "revoked_api_keys": 0,
  "notified": true
}
```

```json 403 theme={"theme":{"light":"github-light","dark":"github-dark"}}
{ "code": "authorization_error", "message": "You do not have permission to perform this action." }
```

```json 404 theme={"theme":{"light":"github-light","dark":"github-dark"}}
{ "code": "not_found", "message": "The requested resource was not found." }
```

```json 409 theme={"theme":{"light":"github-light","dark":"github-dark"}}
{ "code": "conflict", "message": "You already own this organisation." }
```


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