Skip to content
dhanu docs
Browse pages

API reference

Check the key

GET /api/pub/v1/me, confirm a key works and see which projects and operations it can reach.

GEThttps://api.dhanu.ai/api/pub/v1/me

The 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

CodeStatusMeaning
invalid_api_key401The bearer key is missing or unknown.
api_key_revoked401The key was revoked.
api_key_expired401The key passed its expiry date.
api_key_ip_not_allowed403The caller's IP is outside the key's allowlist.
developer_access_revoked403The key's creator lost developer access in the workspace.
api_key_project_scope403The key covers no active projects, or projectId is outside its scope.

The full list is on Errors.