{
  "openapi": "3.0.0",
  "info": {
    "title": "CTCL — Common Temporal Coordinate Layer",
    "version": "0.1",
    "description": "Reference + transformation layer for agents. MVP."
  },
  "servers": [
    {
      "url": "https://commoninstant.org"
    }
  ],
  "paths": {
    "/v1/now": {
      "get": {
        "summary": "Verified reference instant",
        "responses": {
          "200": {
            "description": "instant envelope"
          }
        }
      }
    },
    "/v1/attest-now": {
      "post": {
        "summary": "Sign a T2 server-observed instant bound to a nonce and opaque context digest; no persistence",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "nonce",
                  "context_digest"
                ],
                "properties": {
                  "nonce": {
                    "type": "string",
                    "pattern": "^[0-9a-f]{32,128}$"
                  },
                  "context_digest": {
                    "type": "string",
                    "pattern": "^[0-9a-f]{64}$"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "signed challenge-bound attestation"
          },
          "400": {
            "description": "invalid challenge"
          },
          "413": {
            "description": "oversized request"
          },
          "503": {
            "description": "signing unavailable"
          }
        }
      }
    },
    "/v1/version": {
      "get": {
        "summary": "Versions, precision & trust tiers (§17/§35/§36)",
        "responses": {
          "200": {
            "description": "ok"
          }
        }
      }
    },
    "/v1/timescales": {
      "get": {
        "summary": "List timescales",
        "responses": {
          "200": {
            "description": "ok"
          }
        }
      }
    },
    "/v1/encodings": {
      "get": {
        "summary": "List encodings",
        "responses": {
          "200": {
            "description": "ok"
          }
        }
      }
    },
    "/v1/convert": {
      "post": {
        "summary": "Convert time value",
        "responses": {
          "200": {
            "description": "ok"
          },
          "400": {
            "description": "error"
          }
        }
      }
    },
    "/v1/transform": {
      "post": {
        "summary": "Map into a custom linear-rate system",
        "responses": {
          "200": {
            "description": "ok"
          }
        }
      }
    },
    "/v1/instants": {
      "post": {
        "summary": "Register a reference instant (multi-agent I*)",
        "responses": {
          "200": {
            "description": "ok"
          },
          "503": {
            "description": "registry unavailable"
          }
        }
      }
    },
    "/v1/instant/{id}": {
      "get": {
        "summary": "Retrieve a registered instant",
        "responses": {
          "200": {
            "description": "ok"
          },
          "404": {
            "description": "unknown instant"
          }
        }
      }
    },
    "/i/{id}": {
      "get": {
        "summary": "Human-readable Share Instant page (§4.4) — HTML, not JSON",
        "responses": {
          "200": {
            "description": "ok (html)"
          },
          "404": {
            "description": "unknown instant (html)"
          }
        }
      }
    },
    "/v1/systems": {
      "get": {
        "summary": "List custom systems",
        "responses": {
          "200": {
            "description": "ok"
          }
        }
      },
      "post": {
        "summary": "Create a persistent custom system",
        "responses": {
          "200": {
            "description": "ok"
          }
        }
      }
    },
    "/v1/systems/{id}": {
      "get": {
        "summary": "Get a system definition",
        "responses": {
          "200": {
            "description": "ok"
          },
          "404": {
            "description": "unknown system"
          }
        }
      }
    },
    "/v1/systems/{id}/now": {
      "get": {
        "summary": "Current time in a custom system",
        "responses": {
          "200": {
            "description": "ok"
          }
        }
      }
    },
    "/v1/path": {
      "get": {
        "summary": "Transform-graph route between two systems/timescales (§13-14)",
        "responses": {
          "200": {
            "description": "ok"
          },
          "404": {
            "description": "unknown node"
          }
        }
      }
    },
    "/v1/temporal-groups": {
      "get": {
        "summary": "List Temporal Groups",
        "responses": {
          "200": {
            "description": "ok"
          }
        }
      },
      "post": {
        "summary": "Create/update a Temporal Group",
        "responses": {
          "200": {
            "description": "ok"
          }
        }
      }
    },
    "/v1/temporal-groups/{id}": {
      "get": {
        "summary": "Get a Temporal Group definition",
        "responses": {
          "200": {
            "description": "ok"
          },
          "404": {
            "description": "unknown group"
          }
        }
      }
    },
    "/v1/temporal-groups/{id}/expand": {
      "post": {
        "summary": "One Instant, Many Systems: expand an instant across every group member",
        "responses": {
          "200": {
            "description": "ok"
          },
          "404": {
            "description": "unknown group/instant"
          }
        }
      }
    },
    "/v1/workspaces": {
      "get": {
        "summary": "List Shared Workspaces (Phase 5 Step 1, no accounts)",
        "responses": {
          "200": {
            "description": "ok"
          }
        }
      },
      "post": {
        "summary": "Create/update a Shared Workspace",
        "responses": {
          "200": {
            "description": "ok"
          }
        }
      }
    },
    "/v1/workspaces/{id}": {
      "get": {
        "summary": "Get a Shared Workspace definition",
        "responses": {
          "200": {
            "description": "ok"
          },
          "404": {
            "description": "unknown workspace"
          }
        }
      }
    },
    "/v1/workspaces/{id}/expand": {
      "post": {
        "summary": "Resolve every member system and group at one shared instant",
        "responses": {
          "200": {
            "description": "ok"
          },
          "404": {
            "description": "unknown workspace/instant"
          }
        }
      }
    },
    "/auth/{provider}/start": {
      "get": {
        "summary": "Browser-only: redirect into Google/GitHub OAuth (Phase 5 Step 2)",
        "responses": {
          "302": {
            "description": "redirect to provider"
          },
          "503": {
            "description": "provider not configured"
          }
        }
      }
    },
    "/auth/{provider}/callback": {
      "get": {
        "summary": "OAuth callback - exchanges code for a session cookie",
        "responses": {
          "302": {
            "description": "redirect back, Set-Cookie"
          },
          "400": {
            "description": "bad/expired state"
          }
        }
      }
    },
    "/auth/me": {
      "get": {
        "summary": "Current session's account, if any",
        "responses": {
          "200": {
            "description": "ok"
          },
          "401": {
            "description": "not signed in"
          }
        }
      }
    },
    "/auth/logout": {
      "post": {
        "summary": "Clear the current session",
        "responses": {
          "200": {
            "description": "ok"
          }
        }
      }
    },
    "/account": {
      "get": {
        "summary": "Human sign-in page (HTML, not JSON)",
        "responses": {
          "200": {
            "description": "ok (html)"
          }
        }
      }
    },
    "/v1/boundaries/inspect": {
      "post": {
        "summary": "Boundary Inspector (§5.6): proactive gap/fold/pause/rate_change status check",
        "responses": {
          "200": {
            "description": "ok"
          }
        }
      }
    },
    "/v1/resolve": {
      "post": {
        "summary": "resolve_temporal_context (§6): ambiguous input -> IANA candidates with confidence",
        "responses": {
          "200": {
            "description": "ok"
          }
        }
      }
    },
    "/v1/planner/shared-instant": {
      "post": {
        "summary": "plan_shared_instant (§7): constraint-solve for a best shared instant",
        "responses": {
          "200": {
            "description": "ok"
          },
          "400": {
            "description": "window/constraints invalid"
          }
        }
      }
    },
    "/v1/planner/constraint-types": {
      "get": {
        "summary": "Planner constraint-type catalog",
        "responses": {
          "200": {
            "description": "ok"
          }
        }
      }
    },
    "/v1/validate": {
      "post": {
        "summary": "Validate a time object (§41)",
        "responses": {
          "200": {
            "description": "ok"
          }
        }
      }
    },
    "/v1/transforms": {
      "get": {
        "summary": "Transform-type catalog (§12)",
        "responses": {
          "200": {
            "description": "ok"
          }
        }
      }
    },
    "/v1/transforms/{id}": {
      "get": {
        "summary": "A transform type's spec",
        "responses": {
          "200": {
            "description": "ok"
          },
          "404": {
            "description": "unknown"
          }
        }
      }
    }
  }
}
