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

# Create an organization

> Self-hosted only. Creates an organization with a default team and returns an organization-scoped admin API key, so provisioning can continue through the management APIs without a browser step: the instance key creates the organization, the returned key does everything else. The slug is the natural key; a taken slug answers 409 organization_slug_taken.



## OpenAPI

````yaml POST /api/organizations
openapi: 3.1.0
info:
  title: LangWatch API
  version: 1.0.0
  description: LangWatch openapi spec
servers:
  - url: https://app.langwatch.ai
security:
  - project_api_key: []
paths:
  /api/organizations:
    post:
      tags:
        - Organizations (Self-Hosted)
      summary: Create an organization
      description: >-
        Self-hosted only. Creates an organization with a default team and
        returns an organization-scoped admin API key, so provisioning can
        continue through the management APIs without a browser step: the
        instance key creates the organization, the returned key does everything
        else. The slug is the natural key; a taken slug answers 409
        organization_slug_taken.
      operationId: provisionOrganization
      parameters: []
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                name:
                  type: string
                  minLength: 1
                  maxLength: 255
                slug:
                  type: string
                  pattern: ^[a-z0-9]+(?:-[a-z0-9]+)*$
                  minLength: 1
                  maxLength: 255
                adminApiKeyName:
                  type: string
                  minLength: 1
                  maxLength: 100
              required:
                - name
      responses:
        '201':
          description: >-
            Organization created. adminApiKey.token is the bootstrap credential
            and is only shown once.
          content:
            application/json:
              schema:
                type: object
                properties:
                  organization:
                    type: object
                    properties:
                      id:
                        type: string
                      name:
                        type: string
                      slug:
                        type: string
                  team:
                    type: object
                    properties:
                      id:
                        type: string
                      name:
                        type: string
                      slug:
                        type: string
                  adminApiKey:
                    type: object
                    properties:
                      id:
                        type: string
                      token:
                        type: string
                        description: >-
                          Plaintext organization admin API key (sk-lw-...).
                          Store securely: shown only once.
        '401':
          description: Invalid instance administrator credential
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    description: Stable machine-readable code, e.g. organization_slug_taken
                  message:
                    type: string
        '404':
          description: >-
            Organization provisioning is not available: the instance
            administrator key is not configured, this is a cloud deployment, or
            (on GET /{id}) the organization does not exist
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    description: Stable machine-readable code, e.g. organization_slug_taken
                  message:
                    type: string
        '409':
          description: >-
            An organization with this slug already exists
            (organization_slug_taken)
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    description: Stable machine-readable code, e.g. organization_slug_taken
                  message:
                    type: string
        '422':
          description: >-
            The request body did not match the schema, for example a slug that
            is not lowercase letters, numbers and single hyphens
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    description: Stable machine-readable code, e.g. organization_slug_taken
                  message:
                    type: string
      security:
        - instance_admin_key: []
components:
  securitySchemes:
    project_api_key:
      type: apiKey
      in: header
      name: X-Auth-Token
      description: >-
        Project API key for sending traces and accessing project-scoped
        resources. Format: sk-lw-... (no underscore). Obtain one by creating a
        project via the Admin API or the LangWatch UI.
    instance_admin_key:
      type: http
      scheme: bearer
      description: >-
        Instance administrator key, set as LANGWATCH_INSTANCE_ADMIN_API_KEY on a
        self-hosted deployment. It exists to create the first organization,
        before any organization key does; every other management API takes an
        organization key instead.

````