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

# Organizations

> Understand how organizations work and how resources are scoped in Bitfab

## Overview

Organizations are the top-level container for all your Bitfab resources. Everything in Bitfab is scoped to an organization:

* Functions
* Traces
* API Keys
* Tags
* Integrations
* Team members

## How Organizations Work

When you sign up for Bitfab, a personal organization is automatically created for you. You can also create additional organizations or be invited to join existing ones.

### Personal vs Team Organizations

| Type         | Description                                                          |
| ------------ | -------------------------------------------------------------------- |
| **Personal** | Created automatically for each user. Ideal for individual projects.  |
| **Team**     | Created manually for collaboration. Multiple members can be invited. |

## Resource Scoping

All resources in Bitfab are scoped to the currently selected organization:

### Functions

Functions belong to a single organization. When you create a function, it's created in your currently selected organization.

```typescript theme={null}
// This call uses the API key's organization
const result = await client.call("ExtractName", { text: "John Doe" })
```

### API Keys

API keys are scoped to an organization. When you use an API key:

* You can only call functions in that organization
* Traces are recorded to that organization
* The key only has access to that organization's resources

### Traces

Traces are automatically associated with the organization of the API key used to make the call.

### Tags

Tags are organization-specific. Each organization has its own set of tags for organizing traces.

## Switching Organizations

If you belong to multiple organizations, you can switch between them:

1. Click the organization switcher in the header (next to your profile)
2. Select the organization you want to work in
3. The page will refresh with that organization's resources

<Note>
  Your current organization is shown in the header. Make sure you're in the correct organization before creating resources.
</Note>

## Creating an Organization

To create a new organization:

1. Click the organization switcher in the header
2. Click **Create Organization**
3. Enter a name for your organization
4. Click **Create**

## Inviting Team Members

To invite members to your organization:

1. Click your profile avatar and select **Manage Organization**
2. Go to the **Members** tab
3. Click **Invite Member**
4. Enter their email address
5. Select a role
6. Click **Send Invite**

### Roles

| Role       | Permissions                                      |
| ---------- | ------------------------------------------------ |
| **Admin**  | Full access to all resources, can manage members |
| **Member** | Can create and edit functions, view traces       |

## Best Practices

* **Separate environments**: Create separate organizations for development, staging, and production
* **Use descriptive names**: Name organizations clearly (e.g., "Acme Corp - Production")
* **Manage access carefully**: Only invite members who need access
* **Check your organization**: Always verify you're in the correct organization before creating resources

## SDK Usage

When using the SDK, the organization is determined by the API key:

```typescript theme={null}
// This API key determines which organization is used
const client = new Bitfab({
  apiKey: process.env.BITFAB_API_KEY, // Scoped to a specific organization
})

// All calls use that organization
const result = await client.call("MyFunction", { input: "value" })
```

To work with multiple organizations, use different API keys:

```typescript theme={null}
const prodClient = new Bitfab({
  apiKey: process.env.BITFAB_PROD_API_KEY,
})

const devClient = new Bitfab({
  apiKey: process.env.BITFAB_DEV_API_KEY,
})
```
