BlueForge Docs

client.orgs.create

Create a new organisation via the SDK.

Signature

class Client {
  orgs: {
    create(input: CreateOrgInput): Promise<Org>
  }
}

interface CreateOrgInput {
  name: string
  slug?: string
  region?: 'eu' | 'sea' | 'us'
}

interface Org {
  id: string
  name: string
  slug: string
  region: string
  created_at: string
}

Throws

ErrorCondition
ValidationError
name
missing or empty
AuthError
Invalid or expired API key
ConflictError
Organisation slug already exists

Examples

Basic:

import { Client } from "@blueforge/client"
const client = new Client({ apiKey: process.env.BF_API_KEY! })
const org = await client.orgs.create({ name: "My Company" })
console.log(org.id) // "org_xxxxx"

With custom slug:

const org = await client.orgs.create({
  name: "My Company",
  slug: "my-company",
  region: "us",
})

Pitfalls

  • Slug must be globally unique — unlike project names which are scoped to a tenant, org slugs are global.
  • Org limit — Free plan allows 1 org. Attempts to create more will throw a
    PlanLimitError
    .

See also

{auto-injected}

Tested against

{auto-injected}