# Create organizations

An Organization enables shared data access and enforces consistent authentication methods, session policies, and access control policies for all its members.
Scalekit supports two main approaches to organization creation:
1. **Sign up creates organizations automatically**: When users successfully authenticate with your app, Scalekit automatically creates an organization for them.
2. **User creates organizations themselves**: When your application provides users with the option to create new organizations themselves. For instance, Jira enables users to create their own workspaces.

## Sign up creates organizations automatically

Existing [Scalekit integration](/authenticate/fsa/quickstart/) to authenticate users and handle the login flow automatically generates an organization for each user. The organization ID associated with the user will be included in both the ID token and access token.

```json title="ID token decoded" collapse={3-14} {17}
        {
          "at_hash": "ec_jU2ZKpFelCKLTRWiRsg", // Access token hash for validation
          "aud": [
            "skc_58327482062864390" // Audience (your client ID)
          ],
          "azp": "skc_58327482062864390", // Authorized party (your client ID)
          "c_hash": "6wMreK9kWQQY6O5R0CiiYg", // Authorization code hash
          "client_id": "skc_58327482062864390", // Your application's client ID
          "email": "john.doe@example.com", // User's email address
          "email_verified": true, // Whether the user's email is verified
          "exp": 1742975822, // Expiration time (Unix timestamp)
          "family_name": "Doe", // User's last name
          "given_name": "John", // User's first name
          "iat": 1742974022, // Issued at time (Unix timestamp)
          "iss": "https://scalekit-z44iroqaaada-dev.scalekit.cloud", // Issuer (Scalekit environment URL)
          "name": "John Doe", // User's full name
          "oid": "org_59615193906282635", // Organization ID
          "sid": "ses_65274187031249433", // Session ID
          "sub": "usr_63261014140912135" // Subject (user's unique ID)
        }
        ```
        ```json title="Decoded access token" collapse={9-18} {6}
            {
                "aud": [
                  "prd_skc_7848964512134X699" // Audience (API or resource server)
                ],
                "client_id": "prd_skc_7848964512134X699", // Your application's client ID
                "oid": "org_89678001X21929734", // Organization ID
                "exp": 1758265247, // Expiration time (Unix timestamp)
                "iat": 1758264947, // Issued at time (Unix timestamp)
                "iss": "https://login.devramp.ai", // Issuer (Scalekit environment URL)
                "jti": "tkn_90928731115292X63", // JWT ID (unique token identifier)
                "nbf": 1758264947, // Not before time (Unix timestamp)
                "permissions": [ // Scopes or permissions granted
                  "workspace_data:write",
                  "workspace_data:read"
                ],
                "roles": [ // User roles within the organization
                  "admin"
                ],
                "sid": "ses_90928729571723X24", // Session ID
                "sub": "usr_8967800122X995270", // Subject (user's unique ID)
            }
          ```
        ## Allow users to create organizations  API

Applications often provide options for users to create their own organizations.

For example, show an option for users such "Create new workspace" within their app. Use the Scalekit SDK to power such options:

```javascript title="Create and manage organizations" wrap

const { organization } = await scalekit.organization.createOrganization(
  'Orion Analytics'
);

// Use case: Sync organization profile to downstream systems
const { organization: fetched } = await scalekit.organization.getOrganization(organization.id);
```

  ```python title="Create and manage organizations" wrap
from scalekit.v1.organizations.organizations_pb2 import CreateOrganization

response = scalekit_client.organization.create_organization(
    CreateOrganization(
        display_name="Orion Analytics",
    )
)

# Use case: Sync organization profile to downstream systems
fetched = scalekit_client.organization.get_organization(response[0].organization.id)
```

  ```go title="Create and manage organizations" wrap
created, err := scalekitClient.Organization().CreateOrganization(
    ctx,
    "Orion Analytics",
    scalekit.CreateOrganizationOptions{},
)
if err != nil {
    log.Fatalf("create organization: %v", err)
}

// Use case: Sync organization profile to downstream systems
fetched, err := scalekitClient.Organization().GetOrganization(ctx, created.Organization.Id)
if err != nil {
    log.Fatalf("get organization: %v", err)
}
```

  ```java title="Create and manage organizations" wrap
// Use case: Provision a workspace after a sales-assisted onboarding
CreateOrganization createOrganization = CreateOrganization.newBuilder()
    .setDisplayName("Orion Analytics")
    .build();

Organization organization = scalekitClient.organizations().create(createOrganization);

// Use case: Sync organization profile to downstream systems
Organization fetched = scalekitClient.organizations().getById(organization.getId());
```

  Next, let's look at how users can be added to organizations.