Organizations enable you to implement multi-tenancy within your Auth0 tenant. Use this resource to create, retrieve, update, and delete organizations.
Methods
List Organizations
Retrieve detailed list of all Organizations available in your tenant.
func (c *Client) List(
ctx context.Context,
request *management.ListOrganizationsRequestParameters,
opts ...option.RequestOption,
) (*core.Page[*string, *management.Organization, *management.ListOrganizationsPaginatedResponseContent], error)
request
*management.ListOrganizationsRequestParameters
Query parameters for filtering and pagination
Optional ID from which to start selection (checkpoint pagination)
Number of entries to retrieve. Defaults to 50
The name of this organization
Friendly name of this organization
Branding settings for the organization
Custom metadata for the organization
Example
ctx := context.Background()
listRequest := &management.ListOrganizationsRequestParameters{
Take: management.Int(50),
}
orgsPage, err := mgmt.Organizations.List(ctx, listRequest)
if err != nil {
log.Fatalf("Error listing organizations: %v", err)
}
// Use iterator to traverse all pages
iterator := orgsPage.Iterator()
for iterator.Next(ctx) {
org := iterator.Current()
fmt.Printf("Organization: %s (%s)\n",
org.GetDisplayName(),
org.GetID(),
)
}
if iterator.Err() != nil {
log.Fatalf("Error iterating organizations: %v", iterator.Err())
}
This endpoint supports both offset and checkpoint pagination. Checkpoint pagination must be used if you need to retrieve more than 1000 organizations.
Create Organization
Create a new Organization within your tenant.
func (c *Client) Create(
ctx context.Context,
request *management.CreateOrganizationRequestContent,
opts ...option.RequestOption,
) (*management.CreateOrganizationResponseContent, error)
request
*management.CreateOrganizationRequestContent
required
The name of the organization
Friendly name of the organization
Branding settings for the organization
Custom metadata for the organization
EnabledConnections
[]*ConnectionForOrganization
Connections to enable for this organization
Example
createRequest := &management.CreateOrganizationRequestContent{
Name: "acme-corp",
DisplayName: management.String("Acme Corporation"),
Branding: &management.OrganizationBranding{
LogoURL: management.String("https://example.com/logo.png"),
Colors: &management.OrganizationBrandingColors{
Primary: management.String("#0066cc"),
PageBackground: management.String("#ffffff"),
},
},
Metadata: &management.OrganizationMetadata{
"industry": "technology",
"plan": "enterprise",
},
}
org, err := mgmt.Organizations.Create(ctx, createRequest)
if err != nil {
log.Fatalf("Error creating organization: %v", err)
}
fmt.Printf("Created organization: %s\n", org.GetID())
Get Organization
Retrieve details about a single Organization specified by ID.
func (c *Client) Get(
ctx context.Context,
id string,
opts ...option.RequestOption,
) (*management.GetOrganizationResponseContent, error)
Example
org, err := mgmt.Organizations.Get(ctx, "org_abc123")
if err != nil {
log.Fatalf("Error retrieving organization: %v", err)
}
fmt.Printf("Organization: %s\n", org.GetDisplayName())
Get Organization by Name
Retrieve details about a single Organization specified by name.
func (c *Client) GetByName(
ctx context.Context,
name string,
opts ...option.RequestOption,
) (*management.GetOrganizationByNameResponseContent, error)
Name of the organization to retrieve
Example
org, err := mgmt.Organizations.GetByName(ctx, "acme-corp")
if err != nil {
log.Fatalf("Error retrieving organization: %v", err)
}
fmt.Printf("Organization ID: %s\n", org.GetID())
Update Organization
Modify the details of a specific Organization specified by ID.
func (c *Client) Update(
ctx context.Context,
id string,
request *management.UpdateOrganizationRequestContent,
opts ...option.RequestOption,
) (*management.UpdateOrganizationResponseContent, error)
request
*management.UpdateOrganizationRequestContent
required
Friendly name of the organization
Updated branding settings
Example
updateRequest := &management.UpdateOrganizationRequestContent{
DisplayName: management.String("Acme Corporation Inc."),
Metadata: &management.OrganizationMetadata{
"industry": "technology",
"plan": "premium",
},
}
updatedOrg, err := mgmt.Organizations.Update(ctx, "org_abc123", updateRequest)
if err != nil {
log.Fatalf("Error updating organization: %v", err)
}
fmt.Printf("Updated: %s\n", updatedOrg.GetDisplayName())
Delete Organization
Remove an Organization from your tenant. This action cannot be undone.
func (c *Client) Delete(
ctx context.Context,
id string,
opts ...option.RequestOption,
) error
Example
err := mgmt.Organizations.Delete(ctx, "org_abc123")
if err != nil {
log.Fatalf("Error deleting organization: %v", err)
}
fmt.Println("Organization deleted successfully")
Members are automatically disassociated from an Organization when it is deleted. However, this action does not delete these users from your tenant.
Nested Resources
The Organizations client provides access to nested resources:
mgmt.Organizations.Members - Manage organization members
mgmt.Organizations.EnabledConnections - Manage enabled connections
mgmt.Organizations.Invitations - Manage organization invitations
mgmt.Organizations.ClientGrants - Manage client grants
mgmt.Organizations.DiscoveryDomains - Manage discovery domains