MySecureDB API (v1)
This API is designed for Discord bots and external apps that need access to a user's virtual database
without storing SQL credentials. Access is controlled by API Keys that the user creates in the portal.
Authentication
Send your key in the header:
X-API-Key: YOUR_KEY_HERE
All API responses are JSON. Errors return
{ "error": "..." }.Base URL
https://mysecuredb.rosetech.me/api/v1
If you're testing connection or functions, we suggest not using a full scope API key to prevent accidental changes.
Quick Start (cURL)
List tables the key can access:
curl -s \
-H "X-API-Key: YOUR_KEY_HERE" \
"https://mysecuredb.rosetech.me/api/v1/tables"
Read rows from a table:
curl -s \
-H "X-API-Key: YOUR_KEY_HERE" \
"https://mysecuredb.rosetech.me/api/v1/rows?table_id=123&limit=25"
Insert a row (JSON body):
curl -s \
-X POST \
-H "X-API-Key: YOUR_KEY_HERE" \
-H "Content-Type: application/json" \
-d '{"table_id":123,"data":{"username":"RoseTech","points":10}}' \
"https://mysecuredb.rosetech.me/api/v1/rows"
Usage Examples (Discord.js)
Minimal fetch helper:
import fetch from "node-fetch";
const API = "https://mysecuredb.rosetech.me/api/v1";
const KEY = process.env.MYSECUREDB_KEY;
async function api(path, opts = {}){
const res = await fetch(API + path, {
...opts,
headers: {
"X-API-Key": KEY,
...(opts.headers || {}),
},
});
const data = await res.json().catch(() => ({}));
if (!res.ok) throw new Error(data.error || "API error");
return data;
}
Example: list tables
const tables = await api("/tables");
console.log(tables);
Example: insert a row
await api("/rows", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
table_id: 123,
data: { username: "Dunkelrot", coins: 500 }
}),
});
Endpoints
GET /databases
Lists databases attached to the key.
GET /tables
Lists tables in the database.
GET /columns?table_id=ID
Lists columns for a table.
GET /rows?table_id=ID&limit=25&offset=0
Returns rows for a table. Optional
limit and offset.POST /rows
Inserts a row.
Body:
Body:
{
"table_id": 123,
"data": {
"col_name": "value",
"another_col": 42
}
}
DELETE /rows
Deletes a row by its internal row id.
Body:
Body:
{
"row_id": 999
}
Notes:
- Keys are scoped to a virtual database, and your portal allow-lists control what is visible publicly.
- Rate limiting is enabled to prevent abuse.
- Never put your API key directly in a public repo. Use environment variables.