Skip to content
Preview. LawFive's code and server image aren't public yet, so some steps here won't work until they are.

API overview

Everything LawFive does goes through one versioned API, which the web app, the phones and the watches all use. Your scripts can use it too, on your own server or the hosted service.

  1. In your server’s website, make an API key with read access to matches.

  2. Ask for your matches:

    Terminal window
    curl https://lawfive.example.com/v1/matches \
    -H "Authorization: Bearer lf_your_key"

To see what a server offers without signing in:

Terminal window
curl https://lawfive.example.com/v1/meta
Address Everything is under /v1 on your server. The hosted service is https://api.lawfive.app.
Format JSON. Ids are UUIDs chosen by the client, times are ISO 8601 with a UTC offset, and durations are whole seconds.
Errors A JSON body with error, a sentence a person can read.
Too many tries 429, with Retry-After saying how many seconds to wait.
Request size At most 32 MB, and less for uploads.
Who How
Scripts and integrations An API key, sent as Authorization: Bearer lf_…. This is what you want.
Apps Sign in, take the token from the set-auth-token response header, and send it as Authorization: Bearer <token>.
Watches Link with a code (RFC 8628), then send the token the same way.
Browsers The session cookie, with an Origin header matching the server.

Sessions last 90 days, and renew each day they’re used.

Each kind of record has its own collection, with the same endpoints: matches, match-templates, match-records, venues, competitions, referees and settings. For example, for matches:

Endpoint What it does
GET /v1/matches List them
GET /v1/matches/{id} Get one
PUT /v1/matches/{id} Save one, with an id you choose
DELETE /v1/matches/{id} Delete one

To keep up with changes, use GET /v1/changes, or have them sent to you with webhooks.

A server may be older than your code, especially a self-hosted one. Check capabilities in GET /v1/meta before using address search or weather, which a server can switch off. Ignore fields and capabilities you don’t know.