Stencel AcademyHow Infrastructure Works →
Part 1 · Lesson 5 · Beginner

APIs, JSON & Tokens

Call a real API: token in, JSON out.

In this interactive Infrastructure lesson from Stencel Academy you don't just read — you type real commands like curl -s https://api.stencel.ai/v1/messages -H "Authorization: Bearer sk-demo-123" -d '{"prompt":"hi"}', curl -s https://api.stencel.ai/v1/messages -d '{"prompt":"hi"}', curl -s https://api.stencel.ai/v1/messages -H "Authorization: Bearer sk-demo-123" -d '{"prompt":"hi"}' | jq .usage and watch the machine respond on a live, animated map. It is part of the free How Infrastructure Works course.

Key takeaway: APIs speak JSON both ways; the bearer token is your key, and usage tokens are the bill.

Before this lesson

Builds on: Anatomy of HTTP.

What you'll practise

Terms you'll learn

JSONbearer token401 Unauthorizedendpointpayloadjq

Check your understanding

What does the Bearer token in the header do?
Open the interactive lesson →