{
  "openapi": "3.1.1",
  "info": {
    "title": "Verylot API",
    "description": "Every past digit with its proof. Proofs and commitments are open to everyone; the stream endpoints are for members and every request is signed with the member's Ed25519 key (all four X-Verylot-* headers). Times are UTC; one digit per 10-second slot (slot = unix_seconds / 10). Errors are RFC 7807 problem details with a stable `code`.",
    "version": "v1"
  },
  "servers": [
    {
      "url": "http://api.verylot.online/"
    }
  ],
  "paths": {
    "/v1/stream": {
      "get": {
        "tags": [
          "Stream (members)"
        ],
        "summary": "N digits starting at a UTC time. The time is rounded up to the next 10-second slot.",
        "parameters": [
          {
            "name": "at",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "digits",
            "in": "query",
            "schema": {
              "pattern": "^-?(?:0|[1-9]\\d*)$",
              "type": [
                "integer",
                "string"
              ],
              "format": "int32",
              "default": 6
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StreamSearchResult"
                }
              }
            }
          }
        },
        "security": [
          {
            "X-Verylot-Key": [ ],
            "X-Verylot-Timestamp": [ ],
            "X-Verylot-Nonce": [ ],
            "X-Verylot-Signature": [ ]
          }
        ]
      }
    },
    "/v1/stream/block": {
      "get": {
        "tags": [
          "Stream (members)"
        ],
        "summary": "Up to 9000 consecutive slots as a compact digit array (-1 = not produced) — a whole day in one call.",
        "parameters": [
          {
            "name": "from",
            "in": "query",
            "required": true,
            "schema": {
              "pattern": "^-?(?:0|[1-9]\\d*)$",
              "type": [
                "integer",
                "string"
              ],
              "format": "int64"
            }
          },
          {
            "name": "count",
            "in": "query",
            "required": true,
            "schema": {
              "pattern": "^-?(?:0|[1-9]\\d*)$",
              "type": [
                "integer",
                "string"
              ],
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "security": [
          {
            "X-Verylot-Key": [ ],
            "X-Verylot-Timestamp": [ ],
            "X-Verylot-Nonce": [ ],
            "X-Verylot-Signature": [ ]
          }
        ]
      }
    },
    "/v1/stream/proof": {
      "get": {
        "tags": [
          "Stream (members)"
        ],
        "summary": "Proof material per slot (revealed seed, drand beacon, day commitment) for independent verification.",
        "parameters": [
          {
            "name": "from",
            "in": "query",
            "required": true,
            "schema": {
              "pattern": "^-?(?:0|[1-9]\\d*)$",
              "type": [
                "integer",
                "string"
              ],
              "format": "int64"
            }
          },
          {
            "name": "count",
            "in": "query",
            "schema": {
              "pattern": "^-?(?:0|[1-9]\\d*)$",
              "type": [
                "integer",
                "string"
              ],
              "format": "int32",
              "default": 6
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/DigitProofDto"
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "X-Verylot-Key": [ ],
            "X-Verylot-Timestamp": [ ],
            "X-Verylot-Nonce": [ ],
            "X-Verylot-Signature": [ ]
          }
        ]
      }
    },
    "/v1/commitments": {
      "get": {
        "tags": [
          "Stream (members)"
        ],
        "summary": "Daily seed-chain commitments. Defaults to 7 days back and 7 days ahead.",
        "parameters": [
          {
            "name": "from",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "to",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/CommitmentDto"
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "X-Verylot-Key": [ ],
            "X-Verylot-Timestamp": [ ],
            "X-Verylot-Nonce": [ ],
            "X-Verylot-Signature": [ ]
          }
        ]
      }
    }
  },
  "components": {
    "schemas": {
      "CommitmentDto": {
        "required": [
          "day",
          "commitment",
          "committedAt"
        ],
        "type": "object",
        "properties": {
          "day": {
            "type": "string"
          },
          "commitment": {
            "type": "string"
          },
          "committedAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "DigitDto": {
        "required": [
          "slot",
          "time",
          "digit"
        ],
        "type": "object",
        "properties": {
          "slot": {
            "pattern": "^-?(?:0|[1-9]\\d*)$",
            "type": [
              "integer",
              "string"
            ],
            "format": "int64"
          },
          "time": {
            "type": "string"
          },
          "digit": {
            "pattern": "^-?(?:0|[1-9]\\d*)$",
            "type": [
              "null",
              "integer",
              "string"
            ],
            "format": "int32"
          }
        }
      },
      "DigitProofDto": {
        "required": [
          "slot",
          "time",
          "digit",
          "seed",
          "drandRound",
          "drandRandomness",
          "drandSignature",
          "day",
          "commitment"
        ],
        "type": "object",
        "properties": {
          "slot": {
            "pattern": "^-?(?:0|[1-9]\\d*)$",
            "type": [
              "integer",
              "string"
            ],
            "format": "int64"
          },
          "time": {
            "type": "string"
          },
          "digit": {
            "pattern": "^-?(?:0|[1-9]\\d*)$",
            "type": [
              "integer",
              "string"
            ],
            "format": "int32"
          },
          "seed": {
            "type": "string"
          },
          "drandRound": {
            "pattern": "^-?(?:0|[1-9]\\d*)$",
            "type": [
              "integer",
              "string"
            ],
            "format": "int64"
          },
          "drandRandomness": {
            "type": "string"
          },
          "drandSignature": {
            "type": "string"
          },
          "day": {
            "type": "string"
          },
          "commitment": {
            "type": "string"
          }
        }
      },
      "StreamSearchResult": {
        "required": [
          "requestedAt",
          "startSlot",
          "startTime",
          "rounded",
          "digitCount",
          "complete",
          "value",
          "digits"
        ],
        "type": "object",
        "properties": {
          "requestedAt": {
            "type": "string",
            "format": "date-time"
          },
          "startSlot": {
            "pattern": "^-?(?:0|[1-9]\\d*)$",
            "type": [
              "integer",
              "string"
            ],
            "format": "int64"
          },
          "startTime": {
            "type": "string",
            "format": "date-time"
          },
          "rounded": {
            "type": "boolean"
          },
          "digitCount": {
            "pattern": "^-?(?:0|[1-9]\\d*)$",
            "type": [
              "integer",
              "string"
            ],
            "format": "int32"
          },
          "complete": {
            "type": "boolean"
          },
          "value": {
            "type": [
              "null",
              "string"
            ]
          },
          "digits": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DigitDto"
            }
          }
        }
      }
    },
    "securitySchemes": {
      "X-Verylot-Key": {
        "type": "apiKey",
        "description": "The key id from the member panel, e.g. vk_7Qm2xR9a.",
        "name": "X-Verylot-Key",
        "in": "header"
      },
      "X-Verylot-Timestamp": {
        "type": "apiKey",
        "description": "The current UTC time (ISO 8601, e.g. 2026-10-07T10:15:00Z); accepted within ±5 minutes.",
        "name": "X-Verylot-Timestamp",
        "in": "header"
      },
      "X-Verylot-Nonce": {
        "type": "apiKey",
        "description": "16 random bytes, base64url; never reused within 10 minutes.",
        "name": "X-Verylot-Nonce",
        "in": "header"
      },
      "X-Verylot-Signature": {
        "type": "apiKey",
        "description": "Base64 Ed25519 signature of METHOD \\n path?query \\n timestamp \\n nonce \\n hex SHA-256 of the body.",
        "name": "X-Verylot-Signature",
        "in": "header"
      }
    }
  },
  "tags": [
    {
      "name": "Stream (members)"
    }
  ]
}