DoAide Code API
Everything the free tools on this site do is available over one small REST API — the same endpoints the pages call. No API key, no sign-up: just fair-use rate limits. Use it from scripts, git hooks, CI, or your own editor plugins.
Base URL: https://code.doaide.com · All requests and responses are JSON.
POST /api/public/code-tool
Runs one tool on one snippet and returns the answer as Markdown.
curl -s https://code.doaide.com/api/public/code-tool \
-H 'Content-Type: application/json' \
-d '{
"action": "review",
"code": "def avg(nums):\n return sum(nums) / len(nums)",
"language": "Python"
}'
Request body
| Field | Type | Required | Meaning |
|---|---|---|---|
action | string | yes | One of explain, review, bugs, comments, convert, optimize, tests |
code | string | yes | The snippet to analyze, up to 12,000 characters |
language | string | no | Hint like "Python"; omit for auto-detect |
target | string | convert only | The language to convert to, e.g. "Go" |
Response
{ "answer": "### Review\n1. **Division by zero** — `avg([])` raises `ZeroDivisionError` …" }
The answer is Markdown: render it, or pipe it to a terminal viewer like glow.
Errors
| Status | Meaning |
|---|---|
400 | Bad input — unknown action, empty code, over the 12,000-character limit, or convert without a target. The detail field says which. |
429 | Rate limited — more than 8 requests in 10 minutes from your address, or the shared hourly cap. Back off and retry later. |
502 / 503 | The AI service is busy or the tools are off on this server. Retry with backoff. |
GET /api/public/tool-stats
How many snippets the tools have analyzed, ever. Handy for status pages and badges.
curl -s https://code.doaide.com/api/public/tool-stats
{ "snippets": 1234 }
Recipes
Review staged changes in a git pre-commit hook
#!/bin/sh
# .git/hooks/pre-commit — AI-review each staged file (advisory, never blocks)
git diff --cached --name-only --diff-filter=ACM | while read -r f; do
jq -n --arg code "$(git show ":$f")" '{action:"review", code:$code}' \
| curl -s https://code.doaide.com/api/public/code-tool \
-H 'Content-Type: application/json' -d @- \
| jq -r '.answer' | sed "s|^|[$f] |"
done
exit 0
Python
import requests
r = requests.post(
"https://code.doaide.com/api/public/code-tool",
json={"action": "tests", "code": open("utils.py").read(), "language": "Python"},
timeout=90,
)
r.raise_for_status()
print(r.json()["answer"])
JavaScript / Node
const res = await fetch("https://code.doaide.com/api/public/code-tool", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ action: "explain", code: "const f = (n) => (n <= 1 ? 1 : n * f(n - 1))" }),
})
const { answer } = await res.json()
Fair use
- 8 requests per 10 minutes per client address, plus a shared hourly cap — designed for interactive and hook-style use, not batch processing.
- Send one focused snippet per request (a function or file, not a whole repo).
- Don't send secrets: strip API keys and passwords before submitting, as with any online tool.
- The API may evolve; this page documents the current contract.
Frequently asked questions
Do I need an API key?
No. The public endpoints are open with fair-use rate limits. If you need higher limits for a real integration, reach out via doaide.com.
Is my code stored?
Snippets are processed to produce the answer and counted in aggregate (the total on the tools page). Don't send secrets or code you cannot share.
Can I use this in CI?
Yes, within the rate limits — review the changed files of a commit rather than the whole repository, and treat failures as advisory so a busy API never blocks your pipeline.