## Create Organization

`client.Organizations.New(ctx, body) (*Organization, error)`

**post** `/v1/organizations`

Create a new organization

### Parameters

- `body OrganizationNewParams`

  - `Name param.Field[string]`

    Organization name.

  - `BillingEmail param.Field[string]`

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

### Returns

- `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).

  - `CreatedAt Time`

    When the Organization was created.

  - `Domains []OrganizationDomain`

    Domains associated with the organization.

    - `ID string`

      Domain ID.

    - `Domain string`

      Domain name.

    - `Verified bool`

      Whether the domain has been verified.

  - `MetronomeCustomerID string`

    Metronome customer ID.

  - `Name string`

    Organization name.

  - `Personal bool`

    Whether the organization is a personal Organization.

  - `Services OrganizationServices`

    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.

  - `Type OrganizationType`

    Organization type.

    - `const OrganizationTypePersonal OrganizationType = "personal"`

    - `const OrganizationTypeCompany OrganizationType = "company"`

  - `UpdatedAt Time`

    When the Organization was updated.

  - `AuthID string`

    Authentication provider organization ID.

### Example

```go
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)
}
```

#### Response

```json
{
  "id": "123e4567-e89b-12d3-a456-426614174000",
  "billing_email": "billing@example.com",
  "created_at": "2025-01-01T00:00:00Z",
  "domains": [
    {
      "id": "456e7890-e89b-12d3-a456-426614174000",
      "domain": "example.com",
      "verified": true
    }
  ],
  "metronome_customer_id": "123e4567-e89b-12d3-a456-426614174000",
  "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"
}
```
