Skip to main content

1. Get an API key

Grab a key from your dashboard. Keys start with hk- and are scoped to a single workspace.
export HAWKINGS_API_KEY="hk-..."
Test keys are unmetered for the first 10,000 requests. You won’t be billed for anything you build in this guide.

2. Install the SDK

npm install @hawkings/sdk
pnpm add @hawkings/sdk
yarn add @hawkings/sdk
bun add @hawkings/sdk
composer require hawkings/sdk
Officially supported: Node 18+, Deno, Bun, Cloudflare Workers, Vercel Edge, PHP 8.1+. Python and Go SDKs are in private beta — join the list.

3. Make your first call

import Hawkings from "@hawkings/sdk";

const hk = new Hawkings();

const course = await hk.courses.create({
  name: "Intro to Special Relativity",
  language: "en",
  hours: 12,
});

console.log(course.id);
$hk = new \Hawkings\Client();

$course = $hk->courses->create([
    'name' => 'Intro to Special Relativity',
    'language' => 'en',
    'hours' => 12,
]);

echo $course->id;
from hawkings import Hawkings

hk = Hawkings()

course = hk.courses.create(
    name="Intro to Special Relativity",
    language="en",
    hours=12,
)

print(course.id)
curl https://api.hawkings.education/v1/courses \
  -H "x-api-key: $HAWKINGS_API_KEY" \
  -H "X-Learning-Platform-Code: $HAWKINGS_PLATFORM_CODE" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Intro to Special Relativity",
    "language": "en",
    "hours": 12
  }'
You should see something like:
{
  "id": "crs_01HX9N5AB3...",
  "name": "Intro to Special Relativity",
  "language": "en",
  "hours": 12,
  "status": "draft",
  "created_at": "2026-05-10T12:00:00Z"
}

4. Let the AI write the syllabus

await hk.courses.generateSyllabus(course.id, {
  brief: "An introductory undergraduate course on special relativity, " +
         "ending with the equivalence of mass and energy.",
});

// Poll until ready (≈ 30s)
const ready = await hk.poll(() => hk.courses.retrieve(course.id), {
  until: c => c.status === "ready",
});
$hk->courses->generateSyllabus($course->id, [
    'brief' => 'An introductory undergraduate course on special relativity, '
             . 'ending with the equivalence of mass and energy.',
]);

// Poll until ready (≈ 30s)
$ready = $hk->poll(
    fn () => $hk->courses->retrieve($course->id),
    ['until' => fn ($c) => $c->status === 'ready'],
);
When that resolves, your course has units, lessons, and learning objectives. You’re ready to generate activities or export to SCORM.

5. Read it back

const full = await hk.courses.retrieve(course.id, {
  expand: ["cohorts", "cohorts.lessons", "cohorts.lessons.activities"],
});
$full = $hk->courses->retrieve($course->id, [
    'expand' => ['cohorts', 'cohorts.lessons', 'cohorts.lessons.activities'],
]);
The expand option works on every retrieval. See Pagination & expanding.

What’s next

Authentication

API keys, scopes, and the difference between user keys and platform keys.

Data model

The full graph: workspaces → courses → cohorts → lessons → activities.

AI generation

How async generation works, polling vs. webhooks, and grounded research.

Errors & retries

Error taxonomy, automatic retries, and idempotency keys.