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

# Bootstrap My Organization

> Lazily bootstrap the caller's own organization, healing a missing row.

Additive, idempotent companion to the Clerk ``organization.created``
webhook. Deliberately exempt from the bootstrap-ready gate so a caller
whose shared-namespace row was never created — local development with
no inbound tunnel, or a production webhook outage — can drive its own
provisioning by delegating to the same
:meth:`OrganizationBootstrapService.request_bootstrap` the webhook
uses. The row is created if absent and left untouched if present, so
a webhook and this endpoint racing converge on one row.

When this call is what created the row, emits the distinct
``organization_bootstrap_self_healed`` event: in production that is the
signal that the webhook pipeline is failing and sign-ups are being
rescued by the fallback rather than the primary path.

The display name and slug are seeded from the organization ID as
placeholders; a subsequent ``organization.updated`` webhook overwrites
them with the real Clerk values once delivery recovers.

Returns:
    Public status envelope, identical in shape to ``GET /me/status``,
    reporting the row's status after the bootstrap request is queued.



## OpenAPI

````yaml https://api.pragmatiks.io/openapi.json post /organizations/me/bootstrap
openapi: 3.1.0
info:
  title: Pragma API
  version: 0.1.0
servers: []
security: []
paths:
  /organizations/me/bootstrap:
    post:
      tags:
        - organizations
      summary: Bootstrap My Organization
      description: |-
        Lazily bootstrap the caller's own organization, healing a missing row.

        Additive, idempotent companion to the Clerk ``organization.created``
        webhook. Deliberately exempt from the bootstrap-ready gate so a caller
        whose shared-namespace row was never created — local development with
        no inbound tunnel, or a production webhook outage — can drive its own
        provisioning by delegating to the same
        :meth:`OrganizationBootstrapService.request_bootstrap` the webhook
        uses. The row is created if absent and left untouched if present, so
        a webhook and this endpoint racing converge on one row.

        When this call is what created the row, emits the distinct
        ``organization_bootstrap_self_healed`` event: in production that is the
        signal that the webhook pipeline is failing and sign-ups are being
        rescued by the fallback rather than the primary path.

        The display name and slug are seeded from the organization ID as
        placeholders; a subsequent ``organization.updated`` webhook overwrites
        them with the real Clerk values once delivery recovers.

        Returns:
            Public status envelope, identical in shape to ``GET /me/status``,
            reporting the row's status after the bootstrap request is queued.
      operationId: organizations-bootstrap_my_organization
      responses:
        '202':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OrganizationStatusResponse'
components:
  schemas:
    OrganizationStatusResponse:
      properties:
        status:
          type: string
          enum:
            - bootstrapping
            - ready
            - failed
          title: Status
      type: object
      required:
        - status
      title: OrganizationStatusResponse
      description: |-
        Public bootstrap status payload for the authenticated organization.

        Collapses the internal :class:`OrganizationStatus` lifecycle into
        three user-facing states the web and CLI clients can switch on
        without learning about intermediate internal states:

        * ``"bootstrapping"`` — the organization's platform stack is still
          being provisioned. Clients should keep polling and block access
          to tenant-scoped routes.
        * ``"ready"`` — every seeded platform resource has reached
          ``READY``. The client can stop polling and render the app.
        * ``"failed"`` — the organization is in a terminal non-ready state
          (``BOOTSTRAP_FAILED``, ``DEACTIVATING``, or ``DELETED``). The
          client should stop polling and display a support-contact screen.

        Deliberately minimal: no resource detail, no error text, no
        retry-after. The bootstrap gate already returns a structured 503
        envelope for the tenant-scoped routes — this endpoint exists purely
        to tell clients when to stop polling.

````