{
  "openapi": "3.1.0",
  "info": {
    "title": "Eggtimer link API",
    "version": "1.0.0",
    "description": "Public stateless links, plus a scoped, authenticated server timer/workspace API."
  },
  "components": {
    "securitySchemes": {
      "recoveryKey": {
        "type": "http",
        "scheme": "bearer",
        "description": "Private recovery credential; never give it to Zapier or an AI client."
      },
      "serverBetaKey": {
        "type": "http",
        "scheme": "bearer",
        "description": "Scoped workspace API key; legacy owner key also supported. Not used by public link endpoints."
      }
    }
  },
  "servers": [
    {
      "url": "https://eggtimer.app"
    }
  ],
  "paths": {
    "/api/capabilities": {
      "get": {
        "operationId": "get_capabilities",
        "summary": "Get a short feature and limits summary. Request detail=full only for the complete reference. Does not start a timer.",
        "responses": {
          "200": {
            "description": "Validated data; link construction never starts a timer.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "Invalid input."
          },
          "403": {
            "description": "Browser Origin is not allowed."
          },
          "429": {
            "description": "Rate limited."
          },
          "503": {
            "description": "Temporarily unavailable."
          }
        }
      }
    },
    "/api/presets": {
      "get": {
        "operationId": "list_presets",
        "summary": "List preset names, schedules and links without recipe bodies. Use get_preset(id) only when full steps or customization are needed.",
        "responses": {
          "200": {
            "description": "Validated data; link construction never starts a timer.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "Invalid input."
          },
          "403": {
            "description": "Browser Origin is not allowed."
          },
          "429": {
            "description": "Rate limited."
          },
          "503": {
            "description": "Temporarily unavailable."
          }
        }
      }
    },
    "/api/integrations": {
      "get": {
        "operationId": "get_integrations",
        "summary": "Explain optional Zapier completion hooks, setup, authorization, and browser-lifetime limitations. Does not connect or send anything.",
        "responses": {
          "200": {
            "description": "Validated data; link construction never starts a timer.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "provider": {
                      "type": "string"
                    },
                    "events": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "setup_url": {
                      "type": "string"
                    },
                    "setup": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "limitations": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    }
                  },
                  "required": [
                    "provider",
                    "events",
                    "setup_url",
                    "setup",
                    "limitations"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid input."
          },
          "403": {
            "description": "Browser Origin is not allowed."
          },
          "429": {
            "description": "Rate limited."
          },
          "503": {
            "description": "Temporarily unavailable."
          }
        }
      }
    },
    "/api/clock-link": {
      "post": {
        "operationId": "create_clock_link",
        "summary": "Return a validated link to the next local clock time, e.g. 9pm or 17:30. Each opener uses their own timezone. This does not schedule a server timer.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "time": {
                    "type": "string",
                    "maxLength": 20
                  },
                  "label": {
                    "type": "string",
                    "maxLength": 80
                  }
                },
                "required": [
                  "time"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Validated data; link construction never starts a timer.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "url": {
                      "type": "string"
                    },
                    "time": {
                      "type": "string"
                    },
                    "timezone": {
                      "const": "opener_local"
                    },
                    "start_behavior": {
                      "type": "string"
                    },
                    "alarm_note": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "url",
                    "time",
                    "timezone",
                    "start_behavior",
                    "alarm_note"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid input."
          },
          "403": {
            "description": "Browser Origin is not allowed."
          },
          "429": {
            "description": "Rate limited."
          },
          "503": {
            "description": "Temporarily unavailable."
          }
        }
      }
    },
    "/api/timer-link": {
      "post": {
        "operationId": "create_timer",
        "summary": "Validate a duration and return a link. The countdown starts when the person opens it, not when this tool runs. No background alarm or automation is scheduled.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "duration": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 120,
                    "description": "Relative duration, e.g. 12m or 1h20m. Bare numbers mean minutes. Use recipes for sequences."
                  },
                  "label": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 80,
                    "description": "Omit unless requested."
                  },
                  "theme": {
                    "type": "string",
                    "enum": [
                      "plain",
                      "oat",
                      "midnight",
                      "clay",
                      "lilac"
                    ],
                    "description": "Omit to use defaults."
                  },
                  "display": {
                    "type": "string",
                    "enum": [
                      "digits",
                      "ring",
                      "bar"
                    ],
                    "description": "Omit to use defaults."
                  },
                  "muted": {
                    "type": "boolean",
                    "description": "Omit to use defaults."
                  }
                },
                "required": [
                  "duration"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Validated data; link construction never starts a timer.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "url": {
                      "type": "string"
                    },
                    "duration_seconds": {
                      "type": "integer"
                    },
                    "start_behavior": {
                      "type": "string"
                    },
                    "alarm_note": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "url",
                    "duration_seconds",
                    "start_behavior",
                    "alarm_note"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid input."
          },
          "403": {
            "description": "Browser Origin is not allowed."
          },
          "429": {
            "description": "Rate limited."
          },
          "503": {
            "description": "Temporarily unavailable."
          }
        }
      }
    },
    "/api/recipe-link": {
      "post": {
        "operationId": "create_recipe",
        "summary": "Validate a data-only recipe and return its portable preview link. The person opens it and presses Start. No code runs and no webhook is armed.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "recipe": {
                    "type": "object",
                    "properties": {
                      "version": {
                        "type": "integer",
                        "enum": [
                          1,
                          2
                        ]
                      },
                      "title": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 80
                      },
                      "author": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 60
                      },
                      "display": {
                        "enum": [
                          "digits",
                          "ring",
                          "bar"
                        ]
                      },
                      "theme": {
                        "type": "object",
                        "additionalProperties": false,
                        "properties": {
                          "paper": {
                            "type": "string",
                            "pattern": "^#[0-9a-fA-F]{6}$"
                          },
                          "panel": {
                            "type": "string",
                            "pattern": "^#[0-9a-fA-F]{6}$"
                          },
                          "ink": {
                            "type": "string",
                            "pattern": "^#[0-9a-fA-F]{6}$"
                          },
                          "muted": {
                            "type": "string",
                            "pattern": "^#[0-9a-fA-F]{6}$"
                          },
                          "line": {
                            "type": "string",
                            "pattern": "^#[0-9a-fA-F]{6}$"
                          },
                          "accent": {
                            "type": "string",
                            "pattern": "^#[0-9a-fA-F]{6}$"
                          },
                          "white": {
                            "type": "string",
                            "pattern": "^#[0-9a-fA-F]{6}$"
                          },
                          "highlight": {
                            "type": "string",
                            "pattern": "^#[0-9a-fA-F]{6}$"
                          }
                        }
                      },
                      "steps": {
                        "type": "array",
                        "minItems": 1,
                        "maxItems": 32,
                        "items": {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "seconds"
                          ],
                          "properties": {
                            "label": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 60
                            },
                            "seconds": {
                              "type": "number",
                              "minimum": 0.1,
                              "maximum": 315576000
                            },
                            "repeat": {
                              "type": "integer",
                              "minimum": 1,
                              "maximum": 32
                            }
                          }
                        }
                      },
                      "cycles": {
                        "type": "integer",
                        "minimum": 1,
                        "maximum": 12
                      },
                      "autoAdvance": {
                        "type": "boolean"
                      },
                      "completion": {
                        "type": "object",
                        "additionalProperties": false,
                        "properties": {
                          "message": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 160
                          },
                          "sound": {
                            "type": "boolean"
                          },
                          "webhook": {
                            "type": "boolean"
                          }
                        }
                      },
                      "stepSound": {
                        "type": "boolean"
                      },
                      "repeatLabel": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 20
                      },
                      "note": {
                        "type": "string",
                        "maxLength": 320
                      }
                    },
                    "required": [
                      "version",
                      "steps"
                    ],
                    "additionalProperties": false,
                    "description": "Recipe v1: 1–12 whole-second steps, no repeats. v2: 1–32 steps, fractional seconds and repeats. At most 512 expanded intervals and 10 years; defaults may be omitted."
                  }
                },
                "required": [
                  "recipe"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Validated data; link construction never starts a timer.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "url": {
                      "type": "string"
                    },
                    "recipe": {
                      "type": "object"
                    },
                    "duration_seconds": {
                      "type": "number"
                    },
                    "intervals": {
                      "type": "integer"
                    },
                    "start_behavior": {
                      "type": "string"
                    },
                    "integration_note": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "url",
                    "recipe",
                    "duration_seconds",
                    "intervals",
                    "start_behavior",
                    "integration_note"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid input."
          },
          "403": {
            "description": "Browser Origin is not allowed."
          },
          "429": {
            "description": "Rate limited."
          },
          "503": {
            "description": "Temporarily unavailable."
          }
        }
      }
    },
    "/api/presets/{id}": {
      "get": {
        "operationId": "get_preset",
        "summary": "Read one full preset recipe.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "egg",
                "pomodoro",
                "pomo",
                "tabata",
                "52-17",
                "beep-test",
                "stopwatch"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Full preset; no timer is started.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "preset": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "title": {
                          "type": "string"
                        },
                        "url": {
                          "type": "string"
                        },
                        "behavior": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "id",
                        "title",
                        "url",
                        "behavior"
                      ]
                    }
                  },
                  "required": [
                    "preset"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Unknown preset id."
          }
        }
      }
    },
    "/api/server-timers": {
      "get": {
        "operationId": "list_server_timers",
        "summary": "List active and recent timers in the authenticated workspace.",
        "security": [
          {
            "serverBetaKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "Workspace timer list, usage and limits."
          },
          "401": {
            "description": "Workspace API key required."
          }
        }
      },
      "post": {
        "operationId": "create_server_timer",
        "summary": "Schedule a workspace server countdown; optional webhook authorizes external delivery.",
        "security": [
          {
            "serverBetaKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "duration_seconds": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 2592000
                  },
                  "deadline_at": {
                    "type": "string",
                    "format": "date-time",
                    "description": "Alternative to duration_seconds: an ISO date-time with explicit UTC offset, one second to 30 days in the future."
                  },
                  "title": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 80
                  },
                  "webhook_url": {
                    "type": "string",
                    "maxLength": 400,
                    "description": "Optional private HTTPS Zapier Catch Hook URL; stored until delivery ends or is cancelled. Never put it in a share link."
                  },
                  "max_attempts": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 5,
                    "default": 3
                  },
                  "idempotency_key": {
                    "type": "string",
                    "minLength": 10,
                    "maxLength": 80,
                    "pattern": "^[a-zA-Z0-9_-]+$"
                  }
                },
                "required": [
                  "idempotency_key"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Idempotent retry, same timer."
          },
          "201": {
            "description": "New scheduled timer."
          },
          "400": {
            "description": "Invalid input."
          },
          "401": {
            "description": "Workspace API key required."
          },
          "409": {
            "description": "Idempotency key reused with different settings."
          }
        }
      }
    },
    "/api/server-timers/{timer_id}": {
      "get": {
        "operationId": "get_server_timer",
        "summary": "Read the authenticated timer and delivery status.",
        "security": [
          {
            "serverBetaKey": []
          }
        ],
        "parameters": [
          {
            "name": "timer_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{64}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Timer and delivery state."
          },
          "401": {
            "description": "Workspace API key required."
          },
          "404": {
            "description": "Not found or retention ended."
          },
          "409": {
            "description": "Delivery is in flight and cannot be recalled."
          }
        }
      }
    },
    "/api/server-timers/{timer_id}/cancel": {
      "post": {
        "operationId": "cancel_server_timer",
        "summary": "Cancel an outstanding timer or pending delivery retry.",
        "security": [
          {
            "serverBetaKey": []
          }
        ],
        "parameters": [
          {
            "name": "timer_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{64}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Timer and delivery state."
          },
          "401": {
            "description": "Workspace API key required."
          },
          "404": {
            "description": "Not found or retention ended."
          },
          "409": {
            "description": "Delivery is in flight and cannot be recalled."
          }
        }
      }
    },
    "/api/workspaces": {
      "post": {
        "operationId": "create_workspace",
        "summary": "Create a free isolated automation workspace; returns keys once.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "accept_limits": {
                    "const": true
                  }
                },
                "required": [
                  "accept_limits"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "New workspace and one-time API/recovery credentials."
          },
          "429": {
            "description": "Enrollment allowance reached."
          },
          "503": {
            "description": "Enrollment paused or unavailable."
          }
        }
      }
    },
    "/api/workspace": {
      "get": {
        "operationId": "get_workspace",
        "summary": "Read this workspace’s free-plan limits, usage and idle expiry. No secret is returned.",
        "security": [
          {
            "serverBetaKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "Workspace identity, usage and limits."
          },
          "401": {
            "description": "Invalid or revoked key."
          }
        }
      }
    },
    "/api/workspace/rotate": {
      "post": {
        "operationId": "rotate_workspace",
        "summary": "Replace the workspace API key; existing timers continue.",
        "security": [
          {
            "recoveryKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "confirm": {
                    "const": true
                  }
                },
                "required": [
                  "confirm"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "New API key returned once; old key revoked."
          },
          "401": {
            "description": "Recovery key required."
          }
        }
      }
    },
    "/api/workspace/close": {
      "post": {
        "operationId": "close_workspace",
        "summary": "Close the workspace and block future delivery attempts.",
        "security": [
          {
            "recoveryKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "confirm": {
                    "const": true
                  }
                },
                "required": [
                  "confirm"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Workspace closed; in-flight requests may still complete."
          },
          "401": {
            "description": "Recovery key required."
          }
        }
      }
    },
    "/api/server-routines": {
      "get": {
        "operationId": "list_server_routines",
        "summary": "List this workspace’s active and recent server routines.",
        "security": [
          {
            "serverBetaKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "Routine state or retained events."
          },
          "401": {
            "description": "Workspace API key required."
          },
          "404": {
            "description": "Not owned by this workspace or retention ended."
          },
          "429": {
            "description": "Rate or plan allowance reached."
          },
          "503": {
            "description": "Temporarily unavailable."
          }
        }
      },
      "post": {
        "operationId": "create_server_routine",
        "summary": "Start a finite server-side recipe with step/cycle events, independent of browsers. Creation schedules work immediately. A webhook authorizes selected event deliveries with bounded retries; events can arrive late, duplicated or out of order. Automatic whole-second phases only, at most 64 phases and 30 days.",
        "security": [
          {
            "serverBetaKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "Routine state or retained events."
          },
          "201": {
            "description": "New routine scheduled immediately."
          },
          "401": {
            "description": "Workspace API key required."
          },
          "404": {
            "description": "Not owned by this workspace or retention ended."
          },
          "409": {
            "description": "Idempotency conflict."
          },
          "429": {
            "description": "Rate or plan allowance reached."
          },
          "503": {
            "description": "Temporarily unavailable."
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "recipe": {
                    "type": "object",
                    "properties": {
                      "version": {
                        "type": "integer",
                        "enum": [
                          1,
                          2
                        ]
                      },
                      "title": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 80
                      },
                      "author": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 60
                      },
                      "display": {
                        "enum": [
                          "digits",
                          "ring",
                          "bar"
                        ]
                      },
                      "theme": {
                        "type": "object",
                        "additionalProperties": false,
                        "properties": {
                          "paper": {
                            "type": "string",
                            "pattern": "^#[0-9a-fA-F]{6}$"
                          },
                          "panel": {
                            "type": "string",
                            "pattern": "^#[0-9a-fA-F]{6}$"
                          },
                          "ink": {
                            "type": "string",
                            "pattern": "^#[0-9a-fA-F]{6}$"
                          },
                          "muted": {
                            "type": "string",
                            "pattern": "^#[0-9a-fA-F]{6}$"
                          },
                          "line": {
                            "type": "string",
                            "pattern": "^#[0-9a-fA-F]{6}$"
                          },
                          "accent": {
                            "type": "string",
                            "pattern": "^#[0-9a-fA-F]{6}$"
                          },
                          "white": {
                            "type": "string",
                            "pattern": "^#[0-9a-fA-F]{6}$"
                          },
                          "highlight": {
                            "type": "string",
                            "pattern": "^#[0-9a-fA-F]{6}$"
                          }
                        }
                      },
                      "steps": {
                        "type": "array",
                        "minItems": 1,
                        "maxItems": 32,
                        "items": {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "seconds"
                          ],
                          "properties": {
                            "label": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 60
                            },
                            "seconds": {
                              "type": "number",
                              "minimum": 0.1,
                              "maximum": 315576000
                            },
                            "repeat": {
                              "type": "integer",
                              "minimum": 1,
                              "maximum": 32
                            }
                          }
                        }
                      },
                      "cycles": {
                        "type": "integer",
                        "minimum": 1,
                        "maximum": 12
                      },
                      "autoAdvance": {
                        "type": "boolean"
                      },
                      "completion": {
                        "type": "object",
                        "additionalProperties": false,
                        "properties": {
                          "message": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 160
                          },
                          "sound": {
                            "type": "boolean"
                          },
                          "webhook": {
                            "type": "boolean"
                          }
                        }
                      },
                      "stepSound": {
                        "type": "boolean"
                      },
                      "repeatLabel": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 20
                      },
                      "note": {
                        "type": "string",
                        "maxLength": 320
                      }
                    },
                    "required": [
                      "version",
                      "steps"
                    ],
                    "additionalProperties": false,
                    "description": "Recipe v1: 1–12 whole-second steps, no repeats. v2: 1–32 steps, fractional seconds and repeats. At most 512 expanded intervals and 10 years; defaults may be omitted."
                  },
                  "idempotency_key": {
                    "type": "string",
                    "minLength": 10,
                    "maxLength": 80,
                    "pattern": "^[a-zA-Z0-9_-]+$"
                  },
                  "webhook_url": {
                    "type": "string",
                    "maxLength": 400
                  },
                  "events": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "enum": [
                        "routine.started",
                        "phase.started",
                        "phase.completed",
                        "cycle.completed",
                        "routine.completed",
                        "routine.cancelled"
                      ]
                    },
                    "minItems": 1,
                    "maxItems": 6,
                    "uniqueItems": true,
                    "default": [
                      "phase.completed"
                    ]
                  },
                  "max_attempts": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 5,
                    "default": 3
                  },
                  "max_lateness_seconds": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 86400,
                    "default": 300
                  }
                },
                "required": [
                  "recipe",
                  "idempotency_key"
                ],
                "additionalProperties": false
              }
            }
          }
        }
      }
    },
    "/api/server-routines/{routine_id}": {
      "get": {
        "operationId": "get_server_routine",
        "summary": "Read a routine timeline and current step.",
        "security": [
          {
            "serverBetaKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "Routine state or retained events."
          },
          "401": {
            "description": "Workspace API key required."
          },
          "404": {
            "description": "Not owned by this workspace or retention ended."
          },
          "429": {
            "description": "Rate or plan allowance reached."
          },
          "503": {
            "description": "Temporarily unavailable."
          }
        },
        "parameters": [
          {
            "name": "routine_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{64}$"
            }
          }
        ]
      }
    },
    "/api/server-routines/{routine_id}/events": {
      "get": {
        "operationId": "get_routine_events",
        "summary": "Read retained observed events and individual delivery outcomes.",
        "security": [
          {
            "serverBetaKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "Routine state or retained events."
          },
          "401": {
            "description": "Workspace API key required."
          },
          "404": {
            "description": "Not owned by this workspace or retention ended."
          },
          "429": {
            "description": "Rate or plan allowance reached."
          },
          "503": {
            "description": "Temporarily unavailable."
          }
        },
        "parameters": [
          {
            "name": "routine_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{64}$"
            }
          }
        ]
      }
    },
    "/api/server-routines/{routine_id}/cancel": {
      "post": {
        "operationId": "cancel_server_routine",
        "summary": "Cancel future steps and pending deliveries. A claimed or in-flight delivery may still complete.",
        "security": [
          {
            "serverBetaKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "Routine state or retained events."
          },
          "401": {
            "description": "Workspace API key required."
          },
          "404": {
            "description": "Not owned by this workspace or retention ended."
          },
          "429": {
            "description": "Rate or plan allowance reached."
          },
          "503": {
            "description": "Temporarily unavailable."
          }
        },
        "parameters": [
          {
            "name": "routine_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{64}$"
            }
          }
        ]
      }
    },
    "/api/server-events": {
      "get": {
        "operationId": "list_server_events",
        "summary": "Read the workspace’s retained routine event feed. Stable event IDs deduplicate records; before/after cursors paginate. Retains at most 1000 events and seven days. Delivery updates do not create a new event.",
        "security": [
          {
            "serverBetaKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "Routine state or retained events."
          },
          "401": {
            "description": "Workspace API key required."
          },
          "404": {
            "description": "Not owned by this workspace or retention ended."
          },
          "429": {
            "description": "Rate or plan allowance reached."
          },
          "503": {
            "description": "Temporarily unavailable."
          }
        },
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            }
          },
          {
            "name": "before",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 0
            }
          },
          {
            "name": "after",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 0
            }
          },
          {
            "name": "event",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "routine.started",
                "phase.started",
                "phase.completed",
                "cycle.completed",
                "routine.completed",
                "routine.cancelled"
              ]
            }
          }
        ]
      }
    }
  }
}
