Skip to main content
Skip to content

Your first API request

From nothing to a verified key and a real response, in about five minutes.

  1. 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.

  2. 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.

  3. Confirm it works before writing any code

    One request to /auth tells you the key is valid, which workspace it is bound to, and what it may do.

Confirm the key
export HAWI_KEY="hawi_sk_…"

curl -s https://hawiagents.com/api/v1/auth \
  -H "Authorization: Bearer $HAWI_KEY" | jq
Read the workspace it is bound to
WS=$(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" | jq
The same thing, from Node
const 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));