Skip to content
Docs

    Create Organization

    client.Organizations.New(ctx, body) (*Organization, error)
    POST/v1/organizations

    Create a new organization

    ParametersExpand Collapse
    body OrganizationNewParams
    Name param.Field[string]

    Organization name.

    maxLength255
    minLength1
    BillingEmail param.Field[string]Optional

    Optional billing email. When omitted, the oldest owner’s email is used.

    ReturnsExpand Collapse
    type Organization struct{…}

    Organization response.

    ID string

    Organization ID.

    BillingEmail string

    Billing email. Null when no custom billing email is set (reverts to the oldest owner’s email).

    BillingState OrganizationBillingState

    Organization billing lifecycle state.

    One of the following:
    const OrganizationBillingStateUnfunded OrganizationBillingState = "unfunded"
    const OrganizationBillingStateActive OrganizationBillingState = "active"
    const OrganizationBillingStateRequiresAction OrganizationBillingState = "requires_action"
    const OrganizationBillingStateSuspended OrganizationBillingState = "suspended"
    const OrganizationBillingStateClosed OrganizationBillingState = "closed"
    BillingStateSince Time

    When the organization entered its current billing state.

    formatdate-time
    ChargingModel OrganizationChargingModel

    How the organization is charged for resource usage.

    One of the following:
    const OrganizationChargingModelManual OrganizationChargingModel = "manual"
    const OrganizationChargingModelPrepaid OrganizationChargingModel = "prepaid"
    CreatedAt Time

    When the Organization was created.

    formatdate-time

    Domains associated with the organization.

    ID string

    Domain ID.

    Domain string

    Domain name.

    Verified bool

    Whether the domain has been verified.

    Name string

    Organization name.

    Personal bool

    Whether the organization is a personal Organization.

    Services that the Organization has access to.

    Cloud bool

    Whether cloud services are enabled for the organization.

    JitProvisioning bool

    Whether just-in-time provisioning is enabled for the organization.

    SCIM bool

    Whether SCIM provisioning is enabled for the organization.

    SIEM bool

    Whether SIEM integration is enabled for the organization.

    SSO bool

    Whether single sign-on is enabled for the organization.

    StripeCustomerID string

    Stripe customer ID.

    Organization type.

    One of the following:
    const OrganizationTypePersonal OrganizationType = "personal"
    const OrganizationTypeCompany OrganizationType = "company"
    UpdatedAt Time

    When the Organization was updated.

    formatdate-time
    AuthID stringOptional

    Authentication provider organization ID.

    Create Organization

    package main
    
    import (
      "context"
      "fmt"
    
      "github.com/nirvana-labs/nirvana-go"
      "github.com/nirvana-labs/nirvana-go/option"
      "github.com/nirvana-labs/nirvana-go/organizations"
    )
    
    func main() {
      client := nirvana.NewClient(
        option.WithAPIKey("My API Key"),
      )
      organization, err := client.Organizations.New(context.TODO(), organizations.OrganizationNewParams{
        Name: "My Organization",
      })
      if err != nil {
        panic(err.Error())
      }
      fmt.Printf("%+v\n", organization.ID)
    }
    
    {
      "id": "123e4567-e89b-12d3-a456-426614174000",
      "billing_email": "billing@example.com",
      "billing_state": "active",
      "billing_state_since": "2025-01-01T00:00:00Z",
      "charging_model": "prepaid",
      "created_at": "2025-01-01T00:00:00Z",
      "domains": [
        {
          "id": "456e7890-e89b-12d3-a456-426614174000",
          "domain": "example.com",
          "verified": true
        }
      ],
      "name": "My Organization",
      "personal": false,
      "services": {
        "cloud": true,
        "jit_provisioning": true,
        "scim": false,
        "siem": false,
        "sso": false
      },
      "stripe_customer_id": "cus_1234567890",
      "type": "company",
      "updated_at": "2025-01-01T00:00:00Z",
      "auth_id": "org_01H8GQBX3Z"
    }
    Returns Examples
    {
      "id": "123e4567-e89b-12d3-a456-426614174000",
      "billing_email": "billing@example.com",
      "billing_state": "active",
      "billing_state_since": "2025-01-01T00:00:00Z",
      "charging_model": "prepaid",
      "created_at": "2025-01-01T00:00:00Z",
      "domains": [
        {
          "id": "456e7890-e89b-12d3-a456-426614174000",
          "domain": "example.com",
          "verified": true
        }
      ],
      "name": "My Organization",
      "personal": false,
      "services": {
        "cloud": true,
        "jit_provisioning": true,
        "scim": false,
        "siem": false,
        "sso": false
      },
      "stripe_customer_id": "cus_1234567890",
      "type": "company",
      "updated_at": "2025-01-01T00:00:00Z",
      "auth_id": "org_01H8GQBX3Z"
    }