{
  "openapi": "3.1.0",
  "info": {
    "title": "TokenReset API",
    "version": "1.0.0",
    "description": "Static, keyless JSON describing AI quota resets, limit changes and the AI Power Map. Data CC BY 4.0.",
    "license": {
      "name": "CC BY 4.0",
      "url": "https://creativecommons.org/licenses/by/4.0/"
    }
  },
  "servers": [
    {
      "url": "https://tokenreset.dev"
    }
  ],
  "paths": {
    "/api/v1/status.json": {
      "get": {
        "summary": "Current reset outlook per provider",
        "responses": {
          "200": {
            "description": "Status",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Status"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/live.json": {
      "get": {
        "summary": "Recent posts from official accounts that no published event cites, with where each review stands. Hints, not events.",
        "responses": {
          "200": {
            "description": "Live posts",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Live"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/events.json": {
      "get": {
        "summary": "All quota events, newest first",
        "responses": {
          "200": {
            "description": "Events",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "events": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Event"
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/providers.json": {
      "get": {
        "summary": "Fixed windows and rules per provider",
        "responses": {
          "200": {
            "description": "Providers"
          }
        }
      }
    },
    "/api/v1/wars.json": {
      "get": {
        "summary": "AI Power Map: entities, people, relations, metrics",
        "responses": {
          "200": {
            "description": "Power Map"
          }
        }
      }
    },
    "/api/v1/news.json": {
      "get": {
        "summary": "Power Map news: hard events about AI companies and their supply chain, newest first",
        "responses": {
          "200": {
            "description": "News",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "news": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/NewsItem"
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/feed.json": {
      "get": {
        "summary": "JSON Feed 1.1 of events (WebSub hub advertised)",
        "responses": {
          "200": {
            "description": "Feed"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "NewsItem": {
        "type": "object",
        "required": [
          "id",
          "date",
          "entities",
          "category",
          "tier",
          "title_en",
          "title_zh",
          "summary_en",
          "summary_zh",
          "sources",
          "verified_at"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "date": {
            "type": "string",
            "format": "date"
          },
          "entities": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Power Map entity ids (see wars.json), the main company first."
          },
          "category": {
            "type": "string",
            "enum": [
              "funding_valuation",
              "earnings_capex",
              "compute_supply_deal",
              "chip_capacity_shipments",
              "export_control_regulation",
              "leadership_change"
            ]
          },
          "tier": {
            "type": "string",
            "enum": [
              "official",
              "company_stated",
              "reported",
              "speculation"
            ]
          },
          "title_en": {
            "type": "string"
          },
          "title_zh": {
            "type": "string"
          },
          "summary_en": {
            "type": "string"
          },
          "summary_zh": {
            "type": "string"
          },
          "sources": {
            "type": "array",
            "items": {
              "type": "object",
              "description": "No source carries a quote here, and an X post carries only url, title, kind and verification: X's developer policy lets us pass on posts, not their text, and other pages often relay a post's words. Open the link to read the source.",
              "required": [
                "url"
              ],
              "properties": {
                "url": {
                  "type": "string",
                  "format": "uri"
                },
                "title": {
                  "type": "string"
                },
                "kind": {
                  "type": "string"
                },
                "verification": {
                  "type": "string",
                  "enum": [
                    "opened",
                    "search_snippet",
                    "secondary"
                  ]
                }
              }
            }
          },
          "verified_at": {
            "type": "string",
            "format": "date"
          }
        }
      },
      "Event": {
        "type": "object",
        "required": [
          "id",
          "provider",
          "type",
          "tier",
          "announced_at",
          "title_en",
          "sources"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "provider": {
            "type": "string"
          },
          "type": {
            "type": "string",
            "enum": [
              "global_reset",
              "banked_grant",
              "limit_change",
              "policy_change",
              "promo_start",
              "promo_end",
              "reset_hint",
              "rumor",
              "incident"
            ]
          },
          "tier": {
            "type": "string",
            "enum": [
              "official",
              "company_stated",
              "reported",
              "speculation"
            ]
          },
          "announced_at": {
            "type": "string",
            "format": "date-time"
          },
          "effective_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "ends_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "ends_note": {
            "type": "string",
            "description": "Why a promotion has no ends_at: its sources state no end date, or the end differs by plan."
          },
          "direction": {
            "type": "string",
            "enum": [
              "up",
              "down",
              "neutral"
            ]
          },
          "title_en": {
            "type": "string"
          },
          "title_zh": {
            "type": "string"
          },
          "summary_en": {
            "type": "string"
          },
          "summary_zh": {
            "type": "string"
          },
          "sources": {
            "type": "array",
            "items": {
              "type": "object",
              "description": "No source carries a quote here, and an X post carries only url, title, kind and verification: X's developer policy lets us pass on posts, not their text, and other pages often relay a post's words. Open the link to read the source.",
              "required": [
                "url"
              ],
              "properties": {
                "url": {
                  "type": "string",
                  "format": "uri"
                },
                "title": {
                  "type": "string"
                },
                "kind": {
                  "type": "string"
                },
                "verification": {
                  "type": "string",
                  "enum": [
                    "opened",
                    "search_snippet",
                    "secondary"
                  ]
                }
              }
            }
          }
        }
      },
      "Outlook": {
        "type": "object",
        "properties": {
          "level": {
            "type": "string",
            "enum": [
              "scheduled",
              "hinted",
              "rumored",
              "rhythm",
              "quiet"
            ]
          },
          "justReset": {
            "type": "boolean"
          },
          "scheduledAt": {
            "type": [
              "string",
              "null"
            ]
          },
          "scheduledPlans": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "type": "string"
            },
            "description": "Plans the scheduled reset covers, when the announcement names them. A global reset covers only the accounts and limits the offer selects."
          },
          "rhythmNextAt": {
            "type": [
              "string",
              "null"
            ],
            "description": "Last reset + median gap. A habit, not a forecast. Can be in the past: then rhythmOverdue is true and it is not a next time."
          },
          "rhythmOverdue": {
            "type": "boolean",
            "description": "rhythmNextAt had already passed at computedAt. Only as of computedAt: compare rhythmNextAt with the current time yourself; once it has passed it is not a next reset, only how far past the typical gap the provider is."
          },
          "signalIds": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "signalAt": {
            "type": [
              "string",
              "null"
            ],
            "description": "When the newest signal was announced; hints older than 72h no longer count."
          },
          "baseRates": {
            "type": "object",
            "properties": {
              "count7": {
                "type": "integer"
              },
              "count30": {
                "type": "integer"
              },
              "count90": {
                "type": "integer"
              },
              "medianIntervalHours": {
                "type": [
                  "number",
                  "null"
                ]
              },
              "maxIntervalHours": {
                "type": [
                  "number",
                  "null"
                ]
              },
              "lastResetAt": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "hoursSinceLast": {
                "type": [
                  "number",
                  "null"
                ]
              }
            }
          }
        }
      },
      "Live": {
        "type": "object",
        "required": [
          "status",
          "checked_at",
          "note",
          "posts"
        ],
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "ok",
              "stale",
              "unavailable"
            ],
            "description": "stale: the watcher has not reported for an hour, so newer posts may be missing. Listed posts are still real."
          },
          "checked_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When the watcher last reported."
          },
          "note": {
            "type": "string"
          },
          "posts": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "url",
                "account",
                "provider",
                "posted_at",
                "matched",
                "seen_at",
                "review",
                "review_started_at"
              ],
              "properties": {
                "url": {
                  "type": "string",
                  "format": "uri"
                },
                "account": {
                  "type": "string"
                },
                "provider": {
                  "type": "string"
                },
                "posted_at": {
                  "type": "string",
                  "format": "date-time"
                },
                "seen_at": {
                  "type": "string",
                  "format": "date-time",
                  "description": "When the watcher first found the post."
                },
                "review_started_at": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "format": "date-time",
                  "description": "When the watcher started, or tried to start, a review of the post. Null when it has not."
                },
                "matched": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  },
                  "description": "Keywords the post matched."
                },
                "review": {
                  "type": "string",
                  "enum": [
                    "not_requested",
                    "requested",
                    "unknown",
                    "event",
                    "not_event"
                  ],
                  "description": "Where the review stands. \"not_requested\": none started yet. \"requested\": started, no result reported yet. \"unknown\": the start timed out or failed on the server, so a review may or may not have started. \"event\": the review wrote the post up as an event that a person has not published yet. \"not_event\": the review found it is not an event."
                }
              }
            }
          }
        }
      },
      "Status": {
        "type": "object",
        "properties": {
          "generated_at": {
            "type": "string",
            "format": "date-time"
          },
          "skill": {
            "type": "object",
            "description": "The current agent skill. Download it again when your copy states a different version.",
            "properties": {
              "version": {
                "type": "string"
              },
              "url": {
                "type": "string",
                "format": "uri"
              }
            }
          },
          "providers": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "name": {
                  "type": "string"
                },
                "outlook": {
                  "$ref": "#/components/schemas/Outlook"
                }
              }
            }
          }
        }
      }
    }
  }
}