> ## Documentation Index
> Fetch the complete documentation index at: https://docs.erdo.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# CreateOrganizationAPI creates a new top-level organization owned by the


> caller, for \`erdo org create\`. Until now org creation lived only on the internal session surface (POST /organization), which the external-surface gate keeps off-limits to API keys — so a CLI/API user had no way to create an org at all. This wrapper exposes the exact same self-serve capability the web UI already grants every authenticated non-guest user, so it widens nothing: the caller becomes the owner, guests are denied (in-handler like the managed-org mutations, plus the deny-guest tag at the edge), and scoped API keys are denied both here and by the scoped-key middleware's hard denylist. Name/slug validation errors pass through from the organization service.




## OpenAPI

````yaml /api/openapi.json post /v1/organizations
openapi: 3.0.0
info:
  title: Erdo API
  description: >-
    Erdo's REST API: query and write datasets, run agents, manage threads,
    integrations, pages, evals, workstreams, and experiments. Authenticate with
    a Bearer API key (erdo_api_...) or scoped token (erdo_token_...).
  version: '2026-07-31'
servers:
  - url: https://api.erdo.ai
    description: Production
security:
  - bearerAuth: []
paths:
  /v1/organizations:
    post:
      summary: |
        CreateOrganizationAPI creates a new top-level organization owned by the
      description: >
        caller, for \`erdo org create\`. Until now org creation lived only on
        the internal session surface (POST /organization), which the
        external-surface gate keeps off-limits to API keys — so a CLI/API user
        had no way to create an org at all. This wrapper exposes the exact same
        self-serve capability the web UI already grants every authenticated
        non-guest user, so it widens nothing: the caller becomes the owner,
        guests are denied (in-handler like the managed-org mutations, plus the
        deny-guest tag at the edge), and scoped API keys are denied both here
        and by the scoped-key middleware's hard denylist. Name/slug validation
        errors pass through from the organization service.
      operationId: POST:mcp.CreateOrganizationAPI
      requestBody:
        content:
          application/json:
            schema:
              properties:
                name:
                  type: string
                slug:
                  description: >
                    (the generator appends a numeric suffix on collision). A
                    provided slug that is already taken is rejected rather than
                    suffixed.
                  title: >
                    Slug is the desired org slug; omit to auto-generate one from
                    the name
                  type: string
                timezone:
                  description: >
                    schedule the org's default heartbeats at a sensible local
                    time. Empty is fine: provisioning falls back to UTC, and web
                    onboarding backfills the timezone later if the owner
                    completes it there.
                  title: >
                    Timezone is an optional IANA timezone (e.g. "Europe/London")
                    used to
                  type: string
              type: object
      responses:
        '200':
          content:
            application/json:
              schema:
                properties:
                  id:
                    type: string
                  name:
                    type: string
                  slug:
                    type: string
                type: object
          description: Success response
        default:
          $ref: '#/components/responses/APIError'
components:
  responses:
    APIError:
      content:
        application/json:
          schema:
            externalDocs:
              url: https://pkg.go.dev/encore.dev/beta/errs#Error
            properties:
              code:
                description: Error code
                example: not_found
                externalDocs:
                  url: https://pkg.go.dev/encore.dev/beta/errs#ErrCode
                type: string
              details:
                description: Error details
                type: object
              message:
                description: Error message
                type: string
            title: APIError
            type: object
      description: Error response
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: An Erdo API key (erdo_api_...) or scoped token (erdo_token_...).

````