achocodes free REST API

A free, no-signup, no-auth JSON API built for the coding practice courses on this site - and for anyone who needs clean JSON data for teaching, prototyping or demos. Every dataset is plain CSV in this folder, every response is valid JSON with proper HTTP status codes, and every endpoint on this page has a Run button that fires a real request for you.

Base URL https://achocodes.com/api/
Format JSON only, always
Authentication None - it is completely free
Rate limit 1 request per second per visitor
CORS Enabled - browsers can call it directly
Compact mode ?pretty=0

How the API works

Endpoints are lowercase words and digits separated by forward slashes - no punctuation anywhere in the endpoint names. Numbers inside the URL are parameters: /api/worldcities/mostpopulated/8 returns the eight most populated cities, and /api/random/int/5/1/100 returns five random integers between 1 and 100.

Every successful response

Success responses share one envelope: a meta object describing the request, and a data payload with the actual content.

JSON
{
  "meta": {
    "api": "achocodes free API",
    "version": "1.0",
    "endpoint": "/api/premiershipteams/3",
    "requested_at": "2026-10-24T12:00:00+00:00",
    "status": 200,
    "count": 3,
    "total_in_dataset": 20
  },
  "data": [
    { "team": "Arsenal", "stadium": "Emirates Stadium", "capacity": 60704, "manager": "Mikel Arteta" }
  ]
}

Every error response

Errors are JSON too - never a bare HTML error page. Each error carries the correct HTTP status code, a short message, and a hint that tells you how to fix the request. In JavaScript, read response.status and then body.error.message.

JSON
{
  "error": {
    "status": 404,
    "message": "No Premier League club matches \"lisbon\".",
    "hint": "Try /api/premiershipteams/ to see every club and its exact name.",
    "documentation": "/api/"
  }
}

Status codes the API uses

200 OK the request worked 400 Bad Request a parameter is invalid or out of range 404 Not Found unknown endpoint or unknown dataset item 405 Method Not Allowed only GET is served 429 Too Many Requests rate limit hit - wait one second and retry (see the Retry-After header) 500 Internal Server Error something broke on the server side

A note on the data: the CSV files behind these endpoints are a curated sample dataset for coding practice. Figures like earnings and stock prices are illustrative snapshots, not live data. Managers, coaches and rosters change constantly - treat the sports data as realistic practice material, not a live feed.

Premier League clubs 9 endpoints

Twenty clubs with stadium, capacity, city, manager, squad size, earnings and founding year.

GETpremiershipteams/

Every Premier League club in the dataset, with all fields.

GETpremiershipteams/{n}

The first n clubs. Any number from 1 to 100.

GETpremiershipteams/random

One random club, as a single object.

GETpremiershipteams/random/{n}

n random clubs - never the same club twice in one response.

GETpremiershipteams/team/{slug}

One club by name: lowercase, no spaces. Unknown names return a 404.

GETpremiershipteams/managers

A light list of every club with its manager - perfect for practicing array methods.

GETpremiershipteams/stadiums

Team, stadium, city and capacity - sorted biggest stadium first.

GETpremiershipteams/earnings

Club earnings in millions of US dollars, highest first.

GETpremiershipteams/sortedby/{field}

Sort all clubs by one field: team, stadium, capacity, city, manager, players, earnings or founded. An unknown field returns a 400 that lists the valid ones.

NBA teams 10 endpoints

All thirty teams with city, conference, division, arena, coach, squad size, earnings, championships and founding year.

GETnbateams/

Every NBA team with all fields.

GETnbateams/{n}

The first n teams.

GETnbateams/random

One random NBA team.

GETnbateams/random/{n}

n random teams.

GETnbateams/team/{slug}

One team by name slug, e.g. celtics or lakers - the nickname alone works too.

GETnbateams/conference/{which}

All teams in one conference: east or west.

GETnbateams/division/{slug}

All teams in one division: atlantic, central, southeast, northwest, pacific or southwest.

GETnbateams/champions/{n}

The n most decorated franchises, by championship count.

GETnbateams/coaches

Every team with its head coach.

GETnbateams/earnings

Team earnings this year in millions of US dollars, highest first.

US states 10 endpoints

All fifty states with population, GDP, average income, average temperature and main products (as a JSON array).

GETusstates/

Every state with all fields - the richest single dataset here.

GETusstates/{n}

The first n states, in alphabetical order.

GETusstates/random

One random state.

GETusstates/random/{n}

n random states.

GETusstates/state/{code}

One state by its two-letter code, e.g. ca, tx or ny.

GETusstates/capitals

State, code and capital - a clean three-field list.

GETusstates/population/{n}

The n most populous states.

GETusstates/richest/{n}

The n states with the highest average income.

GETusstates/warmest/{n}

The n warmest states by average yearly temperature, in Fahrenheit.

GETusstates/products

Each state with its main products as a JSON array - great for practicing array flattening and counting.

Top 100 world cities 9 endpoints

The hundred biggest cities with country, continent, population, average temperature in Celsius, time zone and one memorable fact each.

GETworldcities/

All 100 cities with every field.

GETworldcities/{n}

The first n cities, in rank order.

GETworldcities/mostpopulated/{n}

The n most populated cities on Earth, biggest first.

GETworldcities/random

One random city.

GETworldcities/random/{n}

n random cities.

GETworldcities/city/{slug}

One city by name slug, e.g. tokyo or newyork.

GETworldcities/continent/{slug}

Every city in one continent: africa, asia, europe, northamerica, oceania or southamerica.

GETworldcities/country/{slug}

Every city in one country, e.g. japan or brazil.

GETworldcities/continents

Every continent with a count of its cities in the dataset.

Fortune 500 companies 7 endpoints

The top 100 companies by revenue rank, with stock symbol, stock price, last year's earnings in millions of US dollars, employee count and business sector.

GETfortune500/

Every company in the dataset with all fields.

GETfortune500/{n}

The top n companies by Fortune rank.

GETfortune500/random

One random company.

GETfortune500/random/{n}

n random companies.

GETfortune500/company/{slug}

One company by name slug, e.g. walmart or apple.

GETfortune500/biggestemployers/{n}

The n companies with the most employees.

GETfortune500/sectors

Every business sector with its company count - perfect for building group-by exercises.

Shakespeare sentences 7 endpoints

150 of the most famous sentences from the plays, each with its play, act and scene. Both text columns are public domain.

GETshakespeare/quotes/

All 150 sentences with play, act and scene.

GETshakespeare/quotes/{n}

The first n sentences.

GETshakespeare/quotes/random

One random sentence, with its play, act and scene.

GETshakespeare/quotes/random/{n}

n random sentences.

GETshakespeare/plays/

Every play in the dataset, with its slug and sentence count.

GETshakespeare/plays/{slug}/quotes

Every sentence from one play, e.g. hamlet or macbeth.

GETshakespeare/plays/{slug}/quotes/random

One random sentence from one play.

Oliver Twist sentences 6 endpoints

150 curated sentences and memorable moments from Charles Dickens' Oliver Twist (public domain), each with its chapter number.

GETolivertwist/

All 150 sentences with their chapters.

GETolivertwist/{n}

The first n sentences.

GETolivertwist/random

One random sentence with its chapter.

GETolivertwist/random/{n}

n random sentences.

GETolivertwist/chapters

Every chapter represented in the dataset, with its sentence count.

GETolivertwist/chapter/{n}

All sentences from one chapter, e.g. chapter 2 - where Oliver asks for more.

Random generators 14 endpoints

Integers, floats, coin flips, dice, passwords, colors and UUIDs - the building blocks for practice exercises.

GETrandom/int

One random integer between 0 and 100.

GETrandom/int/{max}

One random integer between 0 and the maximum.

GETrandom/int/{min}/{max}

One random integer between min and max. Negatives are allowed.

GETrandom/int/{count}/{min}/{max}

Count random integers between min and max, in a values array.

GETrandom/float

One random float between 0 and 1, rounded to 2 decimals.

GETrandom/float/{min}/{max}

One random float between min and max, rounded to 2 decimals.

GETrandom/float/{count}/{min}/{max}

Count random floats between min and max.

GETrandom/coinflip

Heads or tails.

GETrandom/dice

Roll one six-sided die: rolls, total and average.

GETrandom/dice/{count}

Roll up to 10 dice at once: rolls, total and average.

GETrandom/password

A random 12-character password (ambiguous characters excluded).

GETrandom/password/{length}

A random password of 8 to 64 characters.

GETrandom/color

A random color with hex, rgb and hsl representations.

GETrandom/uuid

A random version 4 UUID.

API meta 2 endpoints

GETstatus

API health, version, dataset sizes and the rate-limit setting. Status checks are never rate limited.

GETendpoints

A machine-readable list of every endpoint - handy for building tools on top of this API.