SpydDB HTTP & REST API Reference

OpenAPI 3.1

Authenticated HTTP/1.1 surface across SpydQL execution, prepared statements, BM25 search, OpenTelemetry ingestion, alerting/SLOs, Multi-Raft clustering, WAL streaming replication, and online backups. All routes require Bearer auth except GET /v1/health and auth discovery.

Base URL
https://localhost:8080
Authentication & Database Routing
Authorization: Bearer <token>

HTTP Endpoints (78)

Component Schemas (10)

Health
{
  "type": "object",
  "required": [
    "status",
    "draining",
    "storage",
    "version"
  ],
  "properties": {
    "status": {
      "type": "string",
      "enum": [
        "ok",
        "draining",
        "failed"
      ]
    },
    "draining": {
      "type": "boolean"
    },
    "storage": {
      "type": "string",
      "enum": [
        "ok",
        "failed"
      ]
    },
    "version": {
      "type": "string"
    }
  }
}
QueryRequest
{
  "type": "object",
  "additionalProperties": false,
  "required": [
    "sql"
  ],
  "properties": {
    "sql": {
      "type": "string",
      "description": "One SpydQL statement.",
      "maxLength": 1048576
    },
    "parameters": {
      "type": "array",
      "description": "Positional values for `$1`, `$2`, and so on.",
      "items": {
        "$ref": "#/components/schemas/Value"
      }
    },
    "query_id": {
      "type": "integer",
      "format": "uint64",
      "minimum": 1,
      "description": "A client-chosen identifier, usable with the cancel route while the\nstatement runs. The server assigns one when it is absent.\n"
    }
  }
}
PrepareRequest
{
  "type": "object",
  "additionalProperties": false,
  "required": [
    "sql"
  ],
  "properties": {
    "sql": {
      "type": "string",
      "description": "One SpydQL statement.",
      "maxLength": 1048576
    }
  }
}
PrepareResponse
{
  "type": "object",
  "required": [
    "statement_id",
    "read_only",
    "parameters",
    "columns"
  ],
  "properties": {
    "statement_id": {
      "type": "integer",
      "format": "int64",
      "minimum": 1,
      "description": "Positive 63-bit identifier for the execute and close routes."
    },
    "read_only": {
      "type": "boolean",
      "description": "Whether the analyzed plan is cached and reused."
    },
    "parameters": {
      "type": "object",
      "required": [
        "positional",
        "named",
        "types"
      ],
      "properties": {
        "positional": {
          "type": "integer",
          "minimum": 0
        },
        "named": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "types": {
          "type": "array",
          "items": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      }
    },
    "columns": {
      "type": "array",
      "items": {
        "$ref": "#/components/schemas/Column"
      }
    }
  }
}
ExecuteRequest
{
  "type": "object",
  "additionalProperties": false,
  "required": [
    "statement_id"
  ],
  "properties": {
    "statement_id": {
      "type": "integer",
      "format": "int64",
      "minimum": 1
    },
    "parameters": {
      "type": "array",
      "description": "Positional values for `$1`, `$2`, and so on.",
      "items": {
        "$ref": "#/components/schemas/Value"
      }
    },
    "query_id": {
      "type": "integer",
      "format": "uint64",
      "minimum": 1,
      "description": "A client-chosen identifier, usable with the cancel route while the\nstatement runs.\n"
    }
  }
}
QueryResponse
{
  "type": "object",
  "required": [
    "query_id",
    "columns",
    "rows",
    "affected",
    "message",
    "elapsed_ms"
  ],
  "properties": {
    "query_id": {
      "type": "integer",
      "format": "uint64"
    },
    "columns": {
      "type": "array",
      "items": {
        "$ref": "#/components/schemas/Column"
      }
    },
    "rows": {
      "type": "array",
      "items": {
        "type": "array",
        "items": {
          "$ref": "#/components/schemas/Value"
        }
      }
    },
    "affected": {
      "type": "integer",
      "format": "uint64"
    },
    "message": {
      "type": [
        "string",
        "null"
      ]
    },
    "elapsed_ms": {
      "type": "integer",
      "format": "uint64"
    }
  }
}
Column
{
  "type": "object",
  "required": [
    "name",
    "data_type"
  ],
  "properties": {
    "name": {
      "type": "string"
    },
    "data_type": {
      "type": "string",
      "description": "Rust `Debug` rendering of the column type.",
      "examples": [
        "U64",
        "String { max_len: Some(40) }"
      ]
    }
  }
}
CancelResponse
{
  "type": "object",
  "required": [
    "query_id",
    "cancelled"
  ],
  "properties": {
    "query_id": {
      "type": "integer",
      "format": "uint64"
    },
    "cancelled": {
      "type": "boolean"
    }
  }
}
ErrorEnvelope
{
  "type": "object",
  "required": [
    "error"
  ],
  "properties": {
    "error": {
      "type": "object",
      "required": [
        "code",
        "message"
      ],
      "properties": {
        "code": {
          "type": "string",
          "examples": [
            "permission_denied",
            "invalid_json",
            "resource_limited"
          ]
        },
        "message": {
          "type": "string"
        }
      }
    },
    "request_id": {
      "type": "string"
    },
    "query_id": {
      "type": "integer",
      "format": "uint64"
    }
  }
}
Value
{
  "description": "A tagged value. The tag is the variant name; a null is the string\n\"Null\" and every other variant is an object with one member.\n",
  "oneOf": [
    {
      "const": "Null"
    },
    {
      "type": "object",
      "required": [
        "Bool"
      ],
      "properties": {
        "Bool": {
          "type": "boolean"
        }
      }
    },
    {
      "type": "object",
      "required": [
        "U8"
      ],
      "properties": {
        "U8": {
          "type": "integer",
          "minimum": 0,
          "maximum": 255
        }
      }
    },
    {
      "type": "object",
      "required": [
        "U16"
      ],
      "properties": {
        "U16": {
          "type": "integer",
          "minimum": 0,
          "maximum": 65535
        }
      }
    },
    {
      "type": "object",
      "required": [
        "U32"
      ],
      "properties": {
        "U32": {
          "type": "integer",
          "minimum": 0,
          "maximum": 4294967295
        }
      }
    },
    {
      "type": "object",
      "required": [
        "U64"
      ],
      "properties": {
        "U64": {
          "type": "integer",
          "minimum": 0
        }
      }
    },
    {
      "type": "object",
      "required": [
        "I8"
      ],
      "properties": {
        "I8": {
          "type": "integer",
          "minimum": -128,
          "maximum": 127
        }
      }
    },
    {
      "type": "object",
      "required": [
        "I16"
      ],
      "properties": {
        "I16": {
          "type": "integer",
          "minimum": -32768,
          "maximum": 32767
        }
      }
    },
    {
      "type": "object",
      "required": [
        "I32"
      ],
      "properties": {
        "I32": {
          "type": "integer"
        }
      }
    },
    {
      "type": "object",
      "required": [
        "I64"
      ],
      "properties": {
        "I64": {
          "type": "integer"
        }
      }
    },
    {
      "type": "object",
      "required": [
        "F32"
      ],
      "properties": {
        "F32": {
          "type": "number"
        }
      }
    },
    {
      "type": "object",
      "required": [
        "F64"
      ],
      "properties": {
        "F64": {
          "type": "number"
        }
      }
    },
    {
      "type": "object",
      "required": [
        "Decimal"
      ],
      "properties": {
        "Decimal": {
          "type": "object",
          "required": [
            "mantissa",
            "scale"
          ],
          "properties": {
            "mantissa": {
              "type": "integer"
            },
            "scale": {
              "type": "integer",
              "minimum": 0,
              "maximum": 255
            }
          }
        }
      }
    },
    {
      "type": "object",
      "required": [
        "String"
      ],
      "properties": {
        "String": {
          "type": "string"
        }
      }
    },
    {
      "type": "object",
      "required": [
        "Text"
      ],
      "properties": {
        "Text": {
          "type": "string"
        }
      }
    },
    {
      "type": "object",
      "required": [
        "Bytes"
      ],
      "properties": {
        "Bytes": {
          "type": "array",
          "items": {
            "type": "integer",
            "minimum": 0,
            "maximum": 255
          }
        }
      }
    },
    {
      "type": "object",
      "required": [
        "Timestamp"
      ],
      "properties": {
        "Timestamp": {
          "type": "integer",
          "description": "Microseconds since the Unix epoch."
        }
      }
    },
    {
      "type": "object",
      "required": [
        "Date"
      ],
      "properties": {
        "Date": {
          "type": "integer",
          "description": "Days since the Unix epoch."
        }
      }
    },
    {
      "type": "object",
      "required": [
        "Json"
      ],
      "properties": {
        "Json": {}
      }
    },
    {
      "type": "object",
      "required": [
        "Vector"
      ],
      "properties": {
        "Vector": {
          "type": "array",
          "items": {
            "type": "number"
          }
        }
      }
    },
    {
      "type": "object",
      "required": [
        "GeoPoint"
      ],
      "properties": {
        "GeoPoint": {
          "type": "object",
          "required": [
            "lat",
            "lng"
          ],
          "properties": {
            "lat": {
              "type": "number"
            },
            "lng": {
              "type": "number"
            }
          }
        }
      }
    },
    {
      "type": "object",
      "required": [
        "Enum"
      ],
      "properties": {
        "Enum": {
          "type": "integer",
          "minimum": 0
        }
      }
    }
  ]
}