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

# Join Organization

> Allows users to join an organization through direct ID, invite link, or domain-based auto-join.

`Unary` · [`Organizations`](https://ona.com/docs/api-reference/generated/organization/overview)

Allows users to join an organization through direct ID, invite link, or domain-based auto-join.

Use this method to:

* Join an organization via direct ID or invite
* Join automatically based on email domain
* Accept organization invitations

### Examples

* Join via organization ID:

  Joins an organization directly when you have the ID.

  ```yaml theme={null}
  organizationId: "b0e12f6c-4c67-429d-a4a6-d9838b5da047"
  ```

* Join via invite:

  Accepts an organization invitation link.

  ```yaml theme={null}
  inviteId: "d2c94c27-3b76-4a42-b88c-95a85e392c68"
  ```

## Endpoint

```text theme={null}
POST /api/gitpod.v1.OrganizationService/JoinOrganization
```

Send a Bearer token as described in [Authentication](https://ona.com/docs/api-reference.md#authenticate-requests). If your organization uses a custom management-plane domain, replace `https://app.ona.com` with that domain.

## Request example

```bash cURL theme={null}
export ONA_HOST=https://app.ona.com
export ONA_API_KEY=<your-token>

curl --request POST \
  --url "$ONA_HOST/api/gitpod.v1.OrganizationService/JoinOrganization" \
  --header "Authorization: Bearer $ONA_API_KEY" \
  --header "Content-Type: application/json" \
  --data '{
  "organizationId": "<organization-id>"
}'
```

```python Python theme={null}
import gitpod.v1.organization_pb2 as organization_pb2
from ona_sdk import create_client_from_env

ona = create_client_from_env()
request = organization_pb2.JoinOrganizationRequest(
    organization_id="<organization-id>",
)
response = ona.services.organization.join_organization(request)
print(response)
```

```typescript TypeScript theme={null}
import { create } from "@bufbuild/protobuf";
import { createClientFromEnv } from "@gitpod/sdk";
import { JoinOrganizationRequestSchema } from "@gitpod/sdk/gitpod/v1/organization_pb";

async function main() {
  const ona = createClientFromEnv();
  const request = create(JoinOrganizationRequestSchema, {
    joinId: {
      case: "organizationId",
      value: "<organization-id>",
    },
  });
  const response = await ona.services.organization.joinOrganization(request);
  console.log(response);
}

main().catch(console.error);
```

```go Go theme={null}
package main

import (
	"context"
	"fmt"
	"log"

	"connectrpc.com/connect"
	"github.com/gitpod-io/gitpod-sdk-go/sdk"
	gitpodpb "github.com/gitpod-io/gitpod-sdk-go/v1"
)

func main() {
	ona, err := sdk.NewFromEnv()
	if err != nil {
		log.Fatal(err)
	}

	request := connect.NewRequest(&gitpodpb.JoinOrganizationRequest{
		JoinId: &gitpodpb.JoinOrganizationRequest_OrganizationId{
			OrganizationId: "<organization-id>",
		},
	})
	response, err := ona.Services.Organization.JoinOrganization(context.Background(), request)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Println(response.Msg)
}
```

```json Request body theme={null}
{
  "organizationId": "<organization-id>"
}
```

## Request

`gitpod.v1.JoinOrganizationRequest`

| Field | Type | Required | Description |
| - | - | - | - |
| `organizationId` | string | No | organization\_id is the unique identifier of the Organization to join. Constraints: `string.uuid=true`. |
| `inviteId` | string | No | invite\_id is the unique identifier of the invite to join the organization. Constraints: `string.uuid=true`. |

## Response

`gitpod.v1.JoinOrganizationResponse`

| Field | Type | Required | Description |
| - | - | - | - |
| `member` | [OrganizationMember](#type-gitpod-v1-organization-member) | Yes | member is the member that was created by joining the organization. Constraints: `required=true`. |

## Related types

> [accordion] OrganizationMember
>
> `gitpod.v1.OrganizationMember`
>
> | Field | Type | Required | Description |
> | - | - | - | - |
> | `userId` | string | Yes | Constraints: `required=true, string.uuid=true`. |
> | `role` | [OrganizationRole](#enum-gitpod-v1-organization-role) | Yes | Constraints: `required=true`. |
> | `memberSince` | RFC 3339 timestamp | Yes | Constraints: `required=true`. |
> | `avatarUrl` | string | No | |
> | `fullName` | string | Yes | Constraints: `required=true`. |
> | `email` | string | Yes | Constraints: `required=true`. |
> | `status` | [UserStatus](#enum-gitpod-v1-user-status) | Yes | Constraints: `required=true`. |
> | `loginProvider` | string | Yes | login\_provider is the login provider the user uses to sign in Constraints: `required=true`. |

> [accordion] OrganizationRole
>
> | Value | Number | Description |
> | - | -: | - |
> | `ORGANIZATION_ROLE_UNSPECIFIED` | 0 | |
> | `ORGANIZATION_ROLE_ADMIN` | 1 | |
> | `ORGANIZATION_ROLE_MEMBER` | 2 | |

> [accordion] UserStatus
>
> | Value | Number | Description |
> | - | -: | - |
> | `USER_STATUS_UNSPECIFIED` | 0 | |
> | `USER_STATUS_ACTIVE` | 1 | |
> | `USER_STATUS_SUSPENDED` | 2 | |
> | `USER_STATUS_LEFT` | 3 | |


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