Send your first request
This guide demonstrates a complete create → read → delete loop against the example API. Follow it end-to-end, then swap the URLs and resource for whatever your own product exposes.
-
Create a widget.
Terminal window curl https://api.example.com/v1/widgets \-H "Authorization: Bearer $API_KEY" \-H "Content-Type: application/json" \-d '{"name": "Demo widget"}'const widget = await fetch('https://api.example.com/v1/widgets', {method: 'POST',headers: {Authorization: `Bearer ${process.env.API_KEY}`,'Content-Type': 'application/json',},body: JSON.stringify({ name: 'Demo widget' }),}).then((r) => r.json());Save the returned
id— you’ll use it in the next step. -
Read it back.
Terminal window curl https://api.example.com/v1/widgets/$WIDGET_ID \-H "Authorization: Bearer $API_KEY"const widget = await fetch(`https://api.example.com/v1/widgets/${id}`,{ headers: { Authorization: `Bearer ${process.env.API_KEY}` } },).then((r) => r.json()); -
Clean up.
Terminal window curl -X DELETE https://api.example.com/v1/widgets/$WIDGET_ID \-H "Authorization: Bearer $API_KEY"
Further reading
Section titled “Further reading”- API reference — every endpoint and field.
- Errors — what each error code means.
- Read about how-to guides in the Diátaxis framework.
Maintained by EkLine