Tag Archives: Oyster API

Unofficial TFL Oyster API

lib Bump to Express 4 2 months ago
.gitignore Initial Commit 7 months ago
Procfile Added Procfile 2 months ago
README.md Update README.md 3 days ago
app.js Bump to Express 4 2 months ago
app.json Add app.js for Heroku Deploy 22 days ago
package.json Specify Engines & Test Script 2 months ago
test.js Tests 7 months ago

Unofficial API to check Oyster balance (hopefully more including travel history soon).

API Docs

Root Endpoint

I (@bencevans) run a version of this at https://oyster-scrape-api.herokuapp.com orhttp://oyster.bensbit.co.uk. You’re welcome to use this but I provide no warranty as to uptime or security.


Oyster API uses HTTP Basic authentication using you oyster username and password.

$ curl http://oyster-api.bensbit.co.uk/balance -u username:password

Invalid Authentication Response

HTTP/1.1 401

  "error": "Authentication Invalid"

Missing Credentials

HTTP/1.1 401

  "error": "Authentication Not Provided"


Validate Authentication (Requires Authentication)

GET /valid_auth

If authentication is valid:

HTTP/1.1 200

  "valid_auth": true

Else if authentication fails a JSON object with an error key is returned describing the issue.

Checking Balance (Requires Authentication)

GET /balance
HTTP/1.1 200

  "balance": 17.7

Running Locally

git clone https://github.com/bencevans/oyster-api.git
cd oyster-api
npm install
npm start