Your first API request
From nothing to a verified key and a real response, in about five minutes.
Issue a key
In the developer console, against the workspace you want to read. Choose the scopes you need and an expiry; ninety days is the default and the right answer for most integrations.
Copy the secret now
It is shown once. Afterwards you get a hint, which is enough to tell two keys apart and useless for anything else.
Confirm it works before writing any code
One request to
/authtells you the key is valid, which workspace it is bound to, and what it may do.
export HAWI_KEY="hawi_sk_…"
curl -s https://hawiagents.com/api/v1/auth \
-H "Authorization: Bearer $HAWI_KEY" | jqWS=$(curl -s https://hawiagents.com/api/v1/auth \
-H "Authorization: Bearer $HAWI_KEY" | jq -r .workspaceId)
curl -s "https://hawiagents.com/api/v1/workspaces/$WS" \
-H "Authorization: Bearer $HAWI_KEY" | jqconst KEY = process.env.HAWI_KEY;
const base = "https://hawiagents.com/api/v1";
async function get(path) {
const res = await fetch(base + path, {
headers: { Authorization: `Bearer ${KEY}` },
});
if (!res.ok) {
const body = await res.json().catch(() => ({}));
throw new Error(`${res.status} ${body.code ?? ""} ${body.error ?? ""}`.trim());
}
return res.json();
}
const { workspaceId } = await get("/auth");
const { files } = await get(`/workspaces/${workspaceId}/files?limit=25`);
console.log(files.map((f) => f.name));