On this page
Kit · Block 1 · Week 2 · The second interface: APIs
Kit
Every link, command and word you need this week, with one line on what each is for.
How to use this
Nothing to install this week: the Request Builder runs in your browser. Section 1 is the path through the Request Builder. Section 2 is the links. Section 4 is for when you want the same requests in a terminal. Section 5 is the bridge to the next lesson, Building APIs and the backend: the Groq call in Python.
1Everything Here Can Be Done in the Browser
You can do the whole week in the Request Builder, with nothing to download. The only other site you visit is console.groq.com, to create a free key in step 8. Ten steps, in order:
| Step | What you do |
|---|---|
| Step 1 · The parts | Your Round Three message, translated into a real HTTP request. |
| Step 2 · Read: your first GET | Read from an echo machine, and watch a space become %20. |
| Step 3 · Create: POST a package | Send Aarav's workflow as JSON and find it in the reply. |
| Step 4 · Replay Round Three for real | Create a key on Aarav's service, then Create a diagnosis: 201. |
| Step 5 · Break it on purpose | Cause 404, 405, 401 and 400 one at a time, and read the hint each time. |
| Step 6 · Whose fault: every code | Eight real requests, eight codes. Predict whose fault before you send. |
| Step 7 · Read real traffic | Open DevTools on the page and find all six parts of your own request. |
| Step 8 · Put a model behind it | Create a free Groq key and send Aarav's workflow to a model. Send it twice. |
| Step 9 · Find your key, and where it should live | Spot your key in plain text, then decide which box should hold it. |
| Step 10 · Design your API | List every request your own app needs. This goes into the practice set. |
The terminal commands in section 4 and the bridge in section 5 are the same requests again, for when you want them outside the browser. They are optional this week.
2Links
| Link | What it is for |
|---|---|
| Request Builder | Send real requests from your browser: the echo, GET, POST, Groq, Aarav, and every status code. Keeps your key in memory only. |
| The Wire | Optional deep dive: Morse, ASCII, TCP/IP, HTTP, REST, JSON. Why each part of a request exists. |
| console.groq.com/keys | Create your free Groq key, and revoke it if it leaks. Sign in with Google. Groq shows a key once. |
| Groq models | Which models exist today. Use openai/gpt-oss-120b. |
| Groq rate limits | How many requests your account gets: 30 a minute and 1,000 a day for gpt-oss-120b on the free tier. |
| Groq deprecations | Retired models and their shutdown dates. Why llama-3.3-70b-versatile returns 404 since 16 Aug 2026. |
| __SITE__/aarav | Aarav's Diagnosis Service. The machine from Round Three, as a real API. Its doors are in section 3. |
| httpbin.org | A public echo machine: sends back whatever it receives. /get, /post, and /status/404 for any code. It does not reject broken JSON. |
| postman-echo.com | A second echo machine, for when httpbin is slow or down. |
| hoppscotch.io | A free API client in the browser, with no install. The same four boxes as the Builder, with more options. |
| Chrome DevTools: Network panel | The official guide to the Network tab. |
| Reading the Network tab · Keys · Troubleshooting | The three guides for this lesson: find the parts, keep the key safe, fix the errors. |
3Aarav's Doors
Base address: __SITE__/aarav. Every reply echoes back the parts the machine read, under you_sent. Every error names the part to fix.
| CRUD | Method | Address | Key | Package in | Reply |
|---|---|---|---|---|---|
| Read | GET | /aarav | no | none | 200 the list of doors |
| Create | POST | /aarav/keys | no | {"name": "Riya"} | 201 your key |
| Create | POST | /aarav/diagnoses | yes | {"workflow": "..."} | 201 a diagnosis |
| Read | GET | /aarav/diagnoses | yes | none | 200 an empty list: no memory yet |
| Read, Update, Delete | GET PUT PATCH DELETE | /aarav/diagnoses/{id} | yes | any | 404 nothing is stored |
| Create | POST | /aarav/workflows | yes | {"workflow": "..."} | 201 an id, and a pointer to /diagnoses |
| Read | GET | /aarav/workflows | yes | none | 200 an empty list |
| (practice) | any | /aarav/broken | no | none | 500 their machine broke |
The key goes in a header: Authorization: Bearer aarav_…. The machine checks the parts in the order of the list: address, then action, then key, then package. The first part that fails is the only error you get.
4The Same Requests in a Terminal
Optional. curl sends a request from the terminal and prints the reply. It is already installed on Mac and on Windows 10 and 11.
Windows: two things first
In PowerShell, type curl.exe, not curl; plain curl can run a different PowerShell command. PowerShell also mangles JSON typed inside a command, so save each package in a small file and send the file with --data "@file.json". Or install Git for Windows and use Git Bash, where the Mac commands work as written.
Read: GET from the echo
Add -i after curl to see the status code and the reply headers as well as the package.
Create: POST to the echo
curl -X POST https://httpbin.org/post \-H "Content-Type: application/json" \-d '{"text": "I open Jira, read the tickets, write a report, post it on Slack."}'
Save this as text.json in the folder your terminal is in:
{"text": "I open Jira, read the tickets, write a report, post it on Slack."}
Your text comes back at json.text in the reply.
Create a key at Aarav's
curl -X POST __SITE__/aarav/keys \-H "Content-Type: application/json" \-d '{"name": "Riya"}'
{"name": "Riya"}
The reply is 201 with your key. Put it in an environment variable for this terminal session, so it never appears inside a command:
Create a diagnosis
curl -X POST __SITE__/aarav/diagnoses \-H "Authorization: Bearer $AARAV_KEY" \-H "Content-Type: application/json" \-d '{"workflow": "I open Jira, read the week'"'"'s tickets, write a status report and post it on Slack. About 90 minutes."}'
{"workflow": "I open Jira, read the week's tickets, write a status report and post it on Slack. About 90 minutes."}
Run it twice. The same diagnosis comes back both times: this machine follows rules.
Create a reply from Groq
curl https://api.groq.com/openai/v1/chat/completions \-H "Authorization: Bearer $GROQ_API_KEY" \-H "Content-Type: application/json" \-d '{"model": "openai/gpt-oss-120b", "messages": [{"role": "user", "content": "I open Jira, read the week'"'"'s tickets, write a status report and post it on Slack. About 90 minutes. Diagnose this workflow: repeated pattern, bottleneck, first AI step."}]}'
{"model": "openai/gpt-oss-120b", "messages": [{"role": "user", "content": "I open Jira, read the week's tickets, write a status report and post it on Slack. About 90 minutes. Diagnose this workflow: repeated pattern, bottleneck, first AI step."}]}
Run it twice. Different words come back each time. The door is deterministic; what comes through it is probabilistic. The text is at choices[0].message.content.
An environment variable set this way lasts until you close the terminal. Do not paste keys into commands you share, and do not post your terminal history.
Every code on demand
| Command (Mac; on Windows use curl.exe) | You get |
|---|---|
| curl -i https://httpbin.org/status/404 | 404 nothing at that address |
| curl -i https://httpbin.org/status/429 | 429 too many requests |
| curl -i https://api.groq.com/openai/v1/models | 401 no key: a real 401 from Groq |
| curl -i -X DELETE __SITE__/aarav/diagnoses | 405 this door does not take Delete |
| curl -i __SITE__/aarav/broken | 500 their machine broke |
5Bridge to Building APIs and the Backend
The Groq call in Python
The same request as the curl command, in Python. In the next lesson this moves inside a FastAPI backend, which is where the key belongs. Install the library once with pip install requests (Mac: pip3), and set GROQ_API_KEY as above before you run it.
import osimport requestsresponse = requests.post("https://api.groq.com/openai/v1/chat/completions",addressheaders={"Authorization": "Bearer " + os.environ["GROQ_API_KEY"]},keyjson={package"model": "openai/gpt-oss-120b",package"messages": [{"role": "user", "content": "I open Jira, read the week's tickets, write a status report and post it on Slack. Diagnose this workflow."}],package},package)print(response.status_code)codeprint(response.json()["choices"][0]["message"]["content"])reply package
The action is in the function name: requests.post. Passing json= turns the dictionary into JSON and adds Content-Type: application/json for you. os.environ reads the key from the environment, so it never sits in the file.
6Words You Will Meet
/aarav/diagnoses is one.https://), the machine, the path, and any query./diagnoses.?, such as ?text=hello. Spaces become %20.Address, action, key, package. Code, package.Companion pages: reading the Network tab · keys · troubleshooting