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

# orgs

> Organizations and their members — client.orgs.

Nine methods. API detail: [Organizations](https://vetta.sh/docs/api/organizations.md).

## list

```ts theme={"system"}
client.orgs.list(query?: ListQuery): Promise<Page<Organization>>
```

`GET /v1/organizations` — the organizations this credential reaches. Orgless: it answers on a person session, which is what makes org switching possible.

## create

```ts theme={"system"}
client.orgs.create(body: { name: string }): Promise<CreatedOrganization>
```

`POST /v1/organizations`. The reply carries **two** objects: the organization and the first `admin` API key that opens it — `api_key.secret` is returned here and never again. A caller signed in as a person also becomes the founding `owner`.

## setup

```ts theme={"system"}
client.orgs.setup(body?: { template?: string; referral_code?: string }): Promise<{ organization: Organization }>
```

`POST /v1/organizations/setup` — the company a **signed-in person** is setting up, found or made, with
them as its `owner`. One per person: asking again answers the same company until it is activated by a
paid plan. `template` (`blueprint/template`) is recorded as `start_template` when it is made. It mints
no API key, and an API key is refused (`forbidden`). See [Set up a company](https://vetta.sh/docs/api/organizations.md#set-up-a-company).

## get

```ts theme={"system"}
client.orgs.get(id: string): Promise<Organization>
```

`GET /v1/organizations/{id}` — including `balance_micro_usd`, integer micro-USD.

## update

```ts theme={"system"}
client.orgs.update(id: string, body: { name?: string; timezone?: string; logo_svg?: string | null; brand?: BrandKit | null }): Promise<Organization>
```

`PATCH /v1/organizations/{id}`. Send a new `name`, a new `timezone` (an IANA name such as
`America/Los_Angeles`), a new `logo_svg` (SVG text; `null` removes it), a new `brand` (a
[brand kit](https://vetta.sh/docs/api/organizations.md#the-brand-kit) — `{ palette, typeface, tagline }`; `null` removes it), or
any of them together. A logo the [check](https://vetta.sh/docs/api/organizations.md#the-logo) refuses, or a kit that does not
match, throws `validation_failed` with the reason.

## members

```ts theme={"system"}
client.orgs.members(id: string, query?: ListQuery): Promise<Page<Member>>
```

`GET /v1/organizations/{id}/members`, cursor-paginated. Readable before the organization has a plan, so you can find its owner before paying; `addMember`, `setRole` and `removeMember` need one.

## addMember

```ts theme={"system"}
client.orgs.addMember(id: string, body: { email: string; role: Role }): Promise<Member>
```

`POST /v1/organizations/{id}/members`. `Role` is `"owner" | "admin" | "member"`.

## setRole

```ts theme={"system"}
client.orgs.setRole(id: string, userId: string, role: Role): Promise<Member>
```

`PATCH /v1/organizations/{id}/members/{user_id}`, body `{ role }`. Recorded in the [audit log](https://vetta.sh/docs/sdk/audit-logs.md) as `member.role_changed`.

## removeMember

```ts theme={"system"}
client.orgs.removeMember(id: string, userId: string): Promise<Deleted>
```

`DELETE /v1/organizations/{id}/members/{user_id}`. **Removal does not cascade**: keys that member created keep working and their sessions keep running — revoke each one with [`keys.revoke`](https://vetta.sh/docs/sdk/keys#revoke), reading [`keys.list`](https://vetta.sh/docs/sdk/keys#list) first, since a key's `created_by` is the only record of who minted it.


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