CreateOrganization
client.Organizations.New(ctx, body) (*OrganizationNewResponse, error)
POST/gitpod.v1.OrganizationService/CreateOrganization
Creates a new organization with the specified name and settings.
Use this method to:
- Create a new organization for team collaboration
- Set up automatic domain-based invites for team members
- Join the organization immediately upon creation
Examples
-
Create a basic organization:
Creates an organization with just a name.
name: "Acme Corp Engineering" joinOrganization: true -
Create with domain-based invites:
Creates an organization that automatically invites users with matching email domains.
name: "Acme Corp" joinOrganization: true inviteAccountsWithMatchingDomain: true
CreateOrganization
package main
import (
"context"
"fmt"
"github.com/gitpod-io/gitpod-sdk-go"
"github.com/gitpod-io/gitpod-sdk-go/option"
)
func main() {
client := gitpod.NewClient(
option.WithBearerToken("My Bearer Token"),
)
organization, err := client.Organizations.New(context.TODO(), gitpod.OrganizationNewParams{
Name: gitpod.F("Acme Corp Engineering"),
JoinOrganization: gitpod.F(true),
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", organization.Organization)
}
{
"organization": {
"id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"createdAt": "2019-12-27T18:11:19.117Z",
"name": "name",
"tier": "ORGANIZATION_TIER_UNSPECIFIED",
"updatedAt": "2019-12-27T18:11:19.117Z",
"inviteDomains": {
"domains": [
"sfN2.l.iJR-BU.u9JV9.a.m.o2D-4b-Jd.0Z-kX.L.n.S.f.UKbxB"
]
}
},
"member": {
"email": "email",
"fullName": "fullName",
"loginProvider": "loginProvider",
"memberSince": "2019-12-27T18:11:19.117Z",
"role": "ORGANIZATION_ROLE_UNSPECIFIED",
"status": "USER_STATUS_UNSPECIFIED",
"userId": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"avatarUrl": "avatarUrl"
}
}Returns Examples
{
"organization": {
"id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"createdAt": "2019-12-27T18:11:19.117Z",
"name": "name",
"tier": "ORGANIZATION_TIER_UNSPECIFIED",
"updatedAt": "2019-12-27T18:11:19.117Z",
"inviteDomains": {
"domains": [
"sfN2.l.iJR-BU.u9JV9.a.m.o2D-4b-Jd.0Z-kX.L.n.S.f.UKbxB"
]
}
},
"member": {
"email": "email",
"fullName": "fullName",
"loginProvider": "loginProvider",
"memberSince": "2019-12-27T18:11:19.117Z",
"role": "ORGANIZATION_ROLE_UNSPECIFIED",
"status": "USER_STATUS_UNSPECIFIED",
"userId": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"avatarUrl": "avatarUrl"
}
}