REST API
Every dashboard action on a deployment, over plain HTTP and JSON.
Updated Dec 1, 2026The REST API gives you the same operations as the dashboard. It speaks JSON over HTTPS and authenticates with an API key or an OAuth access token.
The complete reference, with a request and response example for every operation, is generated from the code at bot-hosting.net/api.
Basics
- Base URL
https://bot-hosting.net/api/v1. It is also shown on the Developer page. - Authentication Send
Authorization: Bearer <key>on every request. A missing or invalid key gets a401. - Inputs Path parameters go in the URL. For
GET, the other inputs go in the query string. ForPOST,PATCHandDELETE, they go in a JSON body. - CORS The API answers browser requests from any origin, since it never relies on cookies.
Rate limits
- 120 requests per minute for each key or token.
- 300 requests per minute for each account, across all its keys and tokens, so more keys do not mean more requests.
- Every response carries
X-RateLimit-Remaining. - Past the limit, you get a
429with aRetry-Afterheader in seconds. - Shell commands have their own budget of 30 per minute, shared with the console in the dashboard.
Errors
Every error uses the same shape.
{ "error": { "code": "insufficient_scope", "message": "This credential lacks the \"files:write\" scope" } }
| Status | Common codes | Meaning |
|---|---|---|
| 400 | invalid_input, bad_request, node_rejected |
The input is wrong. The message names the field. |
| 401 | unauthorized |
No key, or the key is invalid, revoked or expired |
| 403 | insufficient_scope, forbidden |
The key lacks the scope, or the account has no access to that resource |
| 404 | not_found |
No such deployment, project, file or operation |
| 409 | conflict, rebuilding |
The resource is busy, for example a deployment still being reinstalled. Retry in a minute. |
| 429 | rate_limited |
Too many requests. Wait for Retry-After seconds. |
| 502, 503 | node_error, server_unavailable, node_outdated |
The server hosting the deployment did not answer, or is offline. Retry shortly. |
Examples
Set your key once in the shell.
export BH_KEY=bhk_your_key
export BH=https://bot-hosting.net/api/v1
List your deployments
curl "$BH/deployments" -H "Authorization: Bearer $BH_KEY"
The list includes the deployments you own and the ones shared with you. The owned flag tells them apart. Each one carries its live state, one of running, starting, stopping, offline, installing or unknown.
Restart a deployment
curl -X POST "$BH/deployments/DEPLOYMENT_ID/power" \
-H "Authorization: Bearer $BH_KEY" -H "Content-Type: application/json" \
-d '{"action":"restart"}'
action is start, stop, restart or kill. A start or a restart waits for the process to settle and returns the state it reached, the console output it produced and a hint when something is wrong.
Read the last console lines
curl "$BH/deployments/DEPLOYMENT_ID/logs?size=50" -H "Authorization: Bearer $BH_KEY"
size goes up to 500 lines (100 by default). Pass waitSeconds to wait on the server for a build or an install to settle before reading, instead of polling.
Set an environment variable
curl -X POST "$BH/deployments/DEPLOYMENT_ID/env" \
-H "Authorization: Bearer $BH_KEY" -H "Content-Type: application/json" \
-d '{"key":"DISCORD_TOKEN","value":"your-token","secret":true}'
The change applies on the next restart.
Read and write a file
curl "$BH/deployments/DEPLOYMENT_ID/files/content?path=/index.js" \
-H "Authorization: Bearer $BH_KEY"
curl -X POST "$BH/deployments/DEPLOYMENT_ID/files/content" \
-H "Authorization: Bearer $BH_KEY" -H "Content-Type: application/json" \
-d '{"path":"/config.json","content":"{\"prefix\":\"!\"}"}'
Paths are relative to the root of the deployment. Then apply the change with POST /deployments/DEPLOYMENT_ID/apply, which restarts the app and confirms it works.
Create a deployment from GitHub
curl -X POST "$BH/deployments" \
-H "Authorization: Bearer $BH_KEY" -H "Content-Type: application/json" \
-d '{"name":"my-bot","source":"github","githubRepo":"owner/repo","runtime":"nodejs"}'
source is blank, github or template. Without ramMB, cpuPct and storageMB, the deployment gets an equal share of your plan's free resources, and the result tells you what it got. GET /runtimes lists the runtimes, services and database engines you can use.
Endpoints
All paths are relative to https://bot-hosting.net/api/v1.
Deployments
| Method | Path | Scope | What it does |
|---|---|---|---|
| GET | /deployments |
deployments:read |
List every deployment you can access |
| POST | /deployments |
deployments:write |
Create a deployment (blank, from GitHub or from a template) or a database |
| GET | /deployments/:id |
deployments:read |
Fetch one deployment |
| PATCH | /deployments/:id |
deployments:write |
Rename a deployment |
| DELETE | /deployments/:id |
deployments:write |
Delete a deployment |
| POST | /deployments/:id/power |
deployments:power |
Start, stop, restart or kill |
| POST | /deployments/:id/command |
deployments:power |
Send a line to the running process (not a shell) |
| GET | /deployments/:id/logs |
deployments:read |
Last lines of the console |
| GET | /deployments/:id/logs/search |
deployments:read |
Search older console lines |
| GET | /deployments/:id/resources |
deployments:read |
Live CPU, memory, disk, network and uptime |
| GET | /deployments/:id/diagnose |
deployments:read |
State, recent errors and hints in one call |
| POST | /deployments/:id/apply |
deployments:write |
Make edited files live and confirm they work |
| PATCH | /deployments/:id/resize |
deployments:write |
Change RAM, CPU or storage from your plan |
| POST | /deployments/:id/move |
deployments:write |
Move to another of your projects |
| GET | /deployments/:id/startup |
deployments:read |
Runtime, version, entry file and start command |
| PATCH | /deployments/:id/startup |
deployments:write |
Change the startup settings |
| GET | /runtimes |
deployments:read |
Available runtimes, services and databases |
| GET | /deployments/:id/git |
deployments:read |
Linked GitHub repository, branch and auto-pull |
| PATCH | /deployments/:id/git |
deployments:write |
Turn auto-pull on or off |
| POST | /deployments/:id/sync |
deployments:write |
Pull the latest code from GitHub |
| GET | /deployments/:id/sftp |
deployments:read and deployments:write |
SFTP host, port, username and password |
| POST | /deployments/:id/shell |
deployments:shell |
Run a shell command in the container |
| POST | /deployments/:id/database/password |
deployments:write and deployments:read |
New password for a database deployment |
Domains
| Method | Path | Scope | What it does |
|---|---|---|---|
| POST | /deployments/:id/domains |
deployments:write |
Turn on the deployment's web address |
| PATCH | /deployments/:id/domains/slug |
deployments:write |
Set the subdomain alias |
| DELETE | /deployments/:id/domains/slug |
deployments:write |
Remove the subdomain alias |
| PATCH | /deployments/:id/domains/custom |
deployments:write |
Attach a custom domain (returns the DNS token) |
| POST | /deployments/:id/domains/custom/verify |
deployments:write |
Check the DNS of the custom domain |
| DELETE | /deployments/:id/domains/custom |
deployments:write |
Detach the custom domain |
| GET | /deployments/:id/check |
deployments:read |
Request the public address and report what came back |
Files
| Method | Path | Scope | What it does |
|---|---|---|---|
| GET | /deployments/:id/files |
files:read |
List a directory |
| GET | /deployments/:id/files/tree |
files:read |
Whole project layout in one call |
| POST | /deployments/:id/files/index |
files:read |
Every file with size, date and content hash |
| GET | /deployments/:id/files/content |
files:read |
Read a file, or a slice of it |
| POST | /deployments/:id/files/read-many |
files:read |
Read several files at once |
| GET | /deployments/:id/files/search |
files:read |
Search the text of the project |
| GET | /deployments/:id/files/outline |
files:read |
Functions, classes and routes with their line numbers |
| GET | /deployments/:id/files/history |
files:read |
Saved previous versions of a file |
| GET | /deployments/:id/files/download-url |
files:read |
One-time signed download link |
| POST | /deployments/:id/files/content |
files:write |
Create, overwrite or append to a text file |
| POST | /deployments/:id/files/writeMany |
files:write |
Write several files at once |
| POST | /deployments/:id/files/edit |
files:write |
Replace an exact snippet in a file |
| POST | /deployments/:id/files/editMany |
files:write |
Several replacements in one file |
| POST | /deployments/:id/files/rename |
files:write |
Rename or move a file or folder |
| POST | /deployments/:id/files/move |
files:write |
Move files into a folder |
| POST | /deployments/:id/files/copy |
files:write |
Duplicate a file |
| POST | /deployments/:id/files/delete |
files:write |
Delete files or folders |
| POST | /deployments/:id/files/folder |
files:write |
Create an empty folder |
| POST | /deployments/:id/files/compress |
files:write |
Compress files into an archive |
| POST | /deployments/:id/files/decompress |
files:write |
Unpack an archive |
| POST | /deployments/:id/files/chmod |
files:write |
Change a file mode |
| POST | /deployments/:id/files/restore |
files:write |
Put a file back to a saved version |
| POST | /deployments/:id/files/upload-url |
files:write |
One-time signed upload link, straight to the server |
Environment, packages and backups
| Method | Path | Scope | What it does |
|---|---|---|---|
| GET | /deployments/:id/env |
env:read |
List variables (secret values masked) |
| GET | /deployments/:id/env/audit |
env:read |
Compare the variables set with the ones the code reads |
| POST | /deployments/:id/env |
env:write |
Create or update a variable |
| PATCH | /deployments/:id/env/:key |
env:write |
Rename a variable, change its value or its secret flag |
| DELETE | /deployments/:id/env/:key |
env:write |
Delete a variable |
| GET | /deployments/:id/packages |
packages:read |
List packages (npm or pip) |
| POST | /deployments/:id/packages |
packages:write |
Add or update a package |
| POST | /deployments/:id/packages/remove |
packages:write |
Remove a package |
| GET | /deployments/:id/backups |
backups:read |
List restore points |
| GET | /deployments/:id/backups/:backupId |
backups:read |
One restore point |
| POST | /deployments/:id/backups/:backupId/restore |
backups:write |
Restore over the files, or into a subfolder |
Projects, account, templates and docs
| Method | Path | Scope | What it does |
|---|---|---|---|
| GET | /projects |
projects:read |
Projects you own or collaborate on |
| POST | /projects |
projects:write |
Create a project |
| DELETE | /projects/:id |
projects:write |
Delete a project and all its deployments (owner only) |
| GET | /account |
account:read |
Profile, credit balance, plan and quota |
| GET | /templates |
templates:read |
Browse the public template catalogue |
| GET | /templates/:slug |
templates:read |
One template with its public stats |
| GET | /docs/search |
docs:read |
Search this documentation |
| GET | /docs/:slug |
docs:read |
Read one documentation page |
Irreversible operations
Deleting a deployment, a project, files or a variable, restoring a backup or a file version, rotating a database password and running shell commands cannot be undone. API keys and OAuth apps you approved can run them, within their scopes, without any confirmation. Give a key deployments:write, files:write or deployments:shell only when it really needs them.
Every call is recorded
Actions made through the API are recorded in the activity log, with the kind of credential that made them, just like actions made in the dashboard.