{
  "openapi": "3.1.0",
  "info": {
    "title": "Aurios Public API",
    "version": "1.0.0",
    "description": "Anonymous workspace registration for Aurios.\n\n## Authentication\n\n`GET /api/v1/public/signup/config` does not require a session. `POST /api/v1/public/signup` and `POST /api/v1/public/signup/verify` use the same anonymous registration flow. They do not accept a staff session, a portal session, or a machine credential. OAuth2 is not used.\n\nCreate requests require an `Idempotency-Key` header of at most 128 characters. Passwords are at least 12 characters and must be confirmed. `confirm` and `authority_to_bind` must be true. The offer, legal fingerprint, and accepted document versions come from the current signup configuration. The server does not accept a client-chosen price.\n\n## Version\n\nPublic contract `1.0.0` on `/api/v1`.\n\n## Included\n\n- `GET /api/v1/public/signup/config` — published introductory trial and the legal documents that must be accepted\n- `POST /api/v1/public/signup` — create the workspace, initial administrator, and trial\n- `POST /api/v1/public/signup/verify` — verify the administrator email with the token from the verification message\n\n## Excluded\n\nThe following were left off this public contract because their audience is not an external developer programme:\n\n- Health and version probes are operational checks.\n- Tokenised CRM intake is a capability URL for one form, not a developer API.\n- Platform branding and bootstrap assets serve the first-party storefront.\n- Staff, portal, machine, tenant-administration, and operator operations stay on the authenticated internal reference at `/docs`.\n\n## Errors\n\nFailures use `application/problem+json` with `type`, `title`, `status`, `detail`, `code`, and `correlation_id`. Field failures include `errors`. Signup codes include `signup.registration_invalid`, `signup.plan_unavailable`, `signup.legal_changed`, `signup.registration_unavailable`, `signup.idempotency_required`, `signup.provisioning_failed`, and `signup.verification_invalid`."
  },
  "servers": [
    {
      "url": "/api",
      "description": "Aurios API origin."
    }
  ],
  "tags": [
    {
      "name": "Public Signup",
      "description": "Anonymous workspace registration."
    }
  ],
  "paths": {
    "/v1/public/signup/config": {
      "get": {
        "operationId": "getPublicSignupConfig",
        "tags": ["Public Signup"],
        "summary": "Published trial and applicable legal terms for public registration",
        "security": [],
        "responses": {
          "200": {
            "description": "Signup configuration.",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/SignupConfig" }
              }
            }
          },
          "409": { "$ref": "#/components/responses/Problem" },
          "429": { "$ref": "#/components/responses/Problem" }
        }
      }
    },
    "/v1/public/signup": {
      "post": {
        "operationId": "postPublicSignup",
        "tags": ["Public Signup"],
        "summary": "Create a tenant, initial administrator, trial, and legal acceptance",
        "security": [],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": { "type": "string", "maxLength": 128 }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": { "$ref": "#/components/schemas/SignupRequest" },
              "examples": {
                "placeholder": {
                  "summary": "Placeholder registration. Use ids from the current config.",
                  "value": {
                    "organisation_name": "Example Organisation",
                    "admin_name": "Example Administrator",
                    "admin_email": "admin@example.test",
                    "password": "example-password-not-real",
                    "password_confirmation": "example-password-not-real",
                    "offer_id": "00000000-0000-4000-8000-000000000001",
                    "offer_version_id": "00000000-0000-4000-8000-000000000002",
                    "legal_fingerprint": "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef",
                    "accepted_document_version_ids": ["00000000-0000-4000-8000-000000000003"],
                    "confirm": true,
                    "authority_to_bind": true
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Workspace created. A verification message is sent. The response does not include the verification token.",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/SignupCreated" }
              }
            }
          },
          "409": { "$ref": "#/components/responses/Problem" },
          "422": { "$ref": "#/components/responses/Problem" },
          "429": { "$ref": "#/components/responses/Problem" }
        }
      }
    },
    "/v1/public/signup/verify": {
      "post": {
        "operationId": "postPublicSignupVerify",
        "tags": ["Public Signup"],
        "summary": "Verify the initial administrator email",
        "security": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": { "$ref": "#/components/schemas/SignupVerifyRequest" }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Email verified.",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/SignupVerified" }
              }
            }
          },
          "422": { "$ref": "#/components/responses/Problem" },
          "429": { "$ref": "#/components/responses/Problem" }
        }
      }
    }
  },
  "components": {
    "responses": {
      "Problem": {
        "description": "Problem Details.",
        "content": {
          "application/problem+json": {
            "schema": { "$ref": "#/components/schemas/ProblemDetails" }
          }
        }
      }
    },
    "schemas": {
      "ProblemDetails": {
        "type": "object",
        "description": "Canonical error envelope (application/problem+json).",
        "required": ["type", "title", "status", "detail", "code", "correlation_id"],
        "properties": {
          "type": { "type": "string" },
          "title": { "type": "string" },
          "status": { "type": "integer" },
          "detail": { "type": "string" },
          "code": { "type": "string" },
          "correlation_id": { "type": "string" },
          "errors": {
            "type": "array",
            "items": {
              "type": "object",
              "required": ["message"],
              "properties": {
                "field": { "type": "string" },
                "message": { "type": "string" },
                "code": { "type": "string" }
              }
            }
          },
          "reasons": {
            "type": "array",
            "items": { "type": "string" }
          }
        },
        "example": {
          "type": "about:blank",
          "title": "Idempotency required",
          "status": 422,
          "detail": "An Idempotency-Key header is required.",
          "code": "signup.idempotency_required",
          "correlation_id": "00000000-0000-4000-8000-000000000001"
        }
      },
      "SignupConfig": {
        "type": "object",
        "required": ["payment_required", "addons_selectable", "package_choice", "trial", "legal"],
        "properties": {
          "payment_required": { "type": "boolean", "example": false },
          "addons_selectable": { "type": "boolean", "example": false },
          "package_choice": { "type": "boolean", "example": false },
          "trial": {
            "type": "object",
            "required": ["offer_id", "offer_version_id", "code", "title", "duration_unit", "duration_count"],
            "properties": {
              "offer_id": { "type": "string" },
              "offer_version_id": { "type": "string" },
              "code": { "type": "string" },
              "title": { "type": "string" },
              "description": { "type": ["string", "null"] },
              "duration_unit": { "type": "string" },
              "duration_count": { "type": "integer" },
              "is_placeholder": { "type": "boolean" },
              "requires_legal_review": { "type": "boolean" },
              "package": { "type": ["object", "null"] },
              "included_modules": { "type": "array", "items": { "type": "object" } }
            }
          },
          "legal": {
            "type": "object",
            "required": ["fingerprint", "documents"],
            "properties": {
              "fingerprint": { "type": "string" },
              "resolver_version": { "type": "string" },
              "transaction_type": { "type": "string" },
              "documents": {
                "type": "array",
                "items": { "$ref": "#/components/schemas/LegalDocument" }
              }
            }
          }
        }
      },
      "LegalDocument": {
        "type": "object",
        "required": ["document_id", "document_version_id", "title", "body", "content_sha256"],
        "properties": {
          "position": { "type": "integer" },
          "document_id": { "type": "string" },
          "document_code": { "type": "string" },
          "document_version_id": { "type": "string" },
          "title": { "type": "string" },
          "body": { "type": "string" },
          "content_format": { "type": "string" },
          "content_sha256": { "type": "string" },
          "change_classification": { "type": "string" },
          "change_summary": { "type": ["string", "null"] },
          "effective_from": { "type": ["string", "null"] },
          "is_placeholder": { "type": "boolean" },
          "sources": { "type": "array", "items": { "type": "string" } }
        }
      },
      "SignupRequest": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "organisation_name",
          "admin_name",
          "admin_email",
          "password",
          "password_confirmation",
          "offer_id",
          "offer_version_id",
          "legal_fingerprint",
          "accepted_document_version_ids",
          "confirm",
          "authority_to_bind"
        ],
        "properties": {
          "organisation_name": { "type": "string", "minLength": 2, "maxLength": 120 },
          "admin_name": { "type": "string", "minLength": 2, "maxLength": 120 },
          "admin_email": { "type": "string", "format": "email", "maxLength": 255 },
          "password": { "type": "string", "format": "password", "minLength": 12, "maxLength": 1024, "writeOnly": true },
          "password_confirmation": { "type": "string", "format": "password", "writeOnly": true },
          "timezone": { "type": "string", "maxLength": 64 },
          "locale": { "type": "string", "maxLength": 32 },
          "default_currency_code": { "type": "string", "minLength": 3, "maxLength": 3 },
          "offer_id": { "type": "string", "format": "uuid" },
          "offer_version_id": { "type": "string", "format": "uuid" },
          "legal_fingerprint": { "type": "string", "minLength": 64, "maxLength": 64 },
          "accepted_document_version_ids": {
            "type": "array",
            "minItems": 1,
            "items": { "type": "string", "format": "uuid" }
          },
          "confirm": { "type": "boolean", "const": true },
          "authority_to_bind": { "type": "boolean", "const": true }
        }
      },
      "SignupCreated": {
        "type": "object",
        "required": ["identity", "tenant", "trial", "verification_required", "correlation_id"],
        "properties": {
          "identity": {
            "type": "object",
            "required": ["id", "name", "email", "status", "mfa_enabled"],
            "properties": {
              "id": { "type": "string" },
              "name": { "type": "string" },
              "email": { "type": "string" },
              "status": { "type": "string" },
              "mfa_enabled": { "type": "boolean" },
              "email_verified_at": { "type": ["string", "null"] }
            }
          },
          "tenant": {
            "type": "object",
            "required": ["id", "name", "slug"],
            "properties": {
              "id": { "type": "string" },
              "name": { "type": "string" },
              "slug": { "type": "string" }
            }
          },
          "trial": { "type": "object" },
          "verification_required": { "type": "boolean" },
          "correlation_id": { "type": "string" }
        }
      },
      "SignupVerifyRequest": {
        "type": "object",
        "required": ["token"],
        "properties": {
          "token": { "type": "string", "description": "Token from the verification message. Not a session credential." }
        }
      },
      "SignupVerified": {
        "type": "object",
        "required": ["status", "email"],
        "properties": {
          "status": { "type": "string", "const": "verified" },
          "email": { "type": "string", "format": "email" }
        }
      }
    }
  }
}
