Calling APIs from Code

Move from one-off requests to code you would ship: JavaScript and Python clients, retries, timeouts, secrets, caching and credit budgets.

Calling APIs from Code badgeComplete all 5 lessons to earn it. About 2.4 hours.
0 of 5 lessonsStart course
What you'll be able to do
  • Call an API with fetch in Node and the browser, and with requests in Python
  • Add timeouts and retry with exponential backoff only when it is safe
  • Keep API keys on the server with environment variables and a small proxy
  • Cache responses so repeat lookups cost nothing
  • Budget credits and stay under rate limits

This course is one of three skill areas on exam APV-100, APIVerve Certified Developer: API Fundamentals: 10 of its 30 questions. See the full path

Syllabus
  1. Call an API with Python requestsPython requests with an API key header - params vs json, raise_for_status, a reusable helper and a Session, plus where httpx fits in.25 mindictionarynumbertowordsemailvalidator
  2. Timeouts, retries and backoffRetry with exponential backoff in JavaScript and Python - timeouts with AbortController, which errors to retry, jitter, and stopping on a 429 for credits.30 minworldtimedictionary
  3. Keep API keys secretHow to hide an API key in frontend code - env vars, .env and .gitignore, rotating a leaked key, and a small proxy in Express or a Cloudflare Worker.35 minnumbertowordsdictionaryiplookup
  4. Caching and credit budgetsCache API responses in JavaScript and Python with a TTL, decide what never to cache, read remaining credits from headers, and batch lookups.30 mincountrylookupexchangerateemailvalidatornumbertowords

Every lesson runs live. Sign in and the requests use your own key.

Scaling up?

Volume pricing, custom SLAs, and dedicated support for high-traffic teams.

Contact sales