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
| Error | Condition |
|---|---|
| missing or empty |
| Invalid or expired API key |
| 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}