API reference
Check the key
GET /api/pub/v1/me, confirm a key works and see which projects and operations it can reach.
GET
https://api.dhanu.ai/api/pub/v1/meThe quickest way to confirm a key works. It is free: no model runs, no credits are spent, and it is not metered against a project.
Request
No body and no parameters, only the bearer key.
curl https://api.dhanu.ai/api/pub/v1/me \
-H "Authorization: Bearer $DHANU_API_KEY"import { Dhanu } from "dhanu";
const dhanu = new Dhanu(process.env.DHANU_API_KEY!);
const me = await dhanu.me();
console.log(me.projects.map((project) => project.name));import os
from dhanu import Dhanu
dhanu = Dhanu(os.environ["DHANU_API_KEY"])
me = dhanu.me()
print([project.name for project in me.projects]) Response
200 OK
{
"app": { "id": "…", "name": "Website" },
"projects": [{ "id": "…", "name": "Website" }],
"key": { "name": "production" },
"scope": {
"level": "package",
"packages": ["images"],
"operations": ["images.generate"]
}
}
projects lists every project the key can reach. app is that single project
when there is exactly one, and null when the key spans several, in which case
generation calls need a projectId.
Errors
| Code | Status | Meaning |
|---|---|---|
invalid_api_key | 401 | The bearer key is missing or unknown. |
api_key_revoked | 401 | The key was revoked. |
api_key_expired | 401 | The key passed its expiry date. |
api_key_ip_not_allowed | 403 | The caller's IP is outside the key's allowlist. |
developer_access_revoked | 403 | The key's creator lost developer access in the workspace. |
api_key_project_scope | 403 | The key covers no active projects, or projectId is outside its scope. |
The full list is on Errors.