For developers

The Boliq API

Read bollard status and history, raise and lower bollards, and manage their schedules from your own system. The machine readable description is the OpenAPI spec.

Ask to connect your product

Companies that want their product to work with Boliq bollards can ask to connect. We look at every request. If we go ahead, you get a test key straight away and can build against practice bollards. Access to real bollards is agreed with us separately.

The page on your server that our sign in sends the owner back to. Leave it blank if you are not sure yet.

We use these details to reply to your request. See our privacy policy.

Thanks, we have your request and will reply by email.

Who can use it

How you reach a customer's bollards

Either way your live server key reaches every bollard you have been given. Each bollard in GET /devices shows a connection with how it was set up (owner or boliq) and your partner_reference, so you can match it to your customer. If you use sign in with Boliq you can also act with that customer's own access token.

Base address and keys

Everything is under https://boliq.co.uk/api/v1, over HTTPS, with JSON in and out. Send your key in the Authorization header.

curl https://boliq.co.uk/api/v1/devices \
  -H "Authorization: Bearer blq_test_YOUR_KEY"
KeyStarts withReaches
Test keyblq_test_Three sandbox bollards that move instantly. Use these to build and test.
Live keyblq_live_Real bollards: the ones an owner has approved for a partner, or a business customer's own.
Owner access tokenblq_at_The bollards and permissions one owner approved for your app. Lasts an hour.

Once we approve you, you get a partner account at boliq.co.uk where your team makes, rotates and removes keys (signing in always needs an authenticator app). Live keys are switched on by Boliq once your agreement is in place. Any key Boliq sends you comes as a one time link: open it, press Reveal, and copy the key. Keep keys secret and on your server. Boliq stores only a hash, so a lost key cannot be shown again, only replaced.

What you can do

PermissionAllows
Read (always)Status, position, battery, last seen, faults, firmware, groups, schedules and event history.
devices:controlLower a bollard.
devices:raiseRaise a bollard. Needs devices:control. The owner has to tick Allow raising, and Boliq has to enable raising for your app.
schedules:writeCreate, change and delete schedules. The owner gets a notification each time.

The API never renames, shares, bills, orders, updates firmware on, unlinks or deletes anything, and cannot correct a bollard's position.

Raising and lowering

A bollard is a physical machine behind a mobile connection, so commands are asynchronous. The API answers 202 Accepted with a command id straight away, and the bollard acts when it next checks in: seconds on mains power, up to a few minutes in low power mode. A command is never confirmed in the same call.

curl -X POST https://boliq.co.uk/api/v1/devices/DEVICE_ID/commands \
  -H "Authorization: Bearer blq_test_YOUR_KEY" \
  -H "Idempotency-Key: 6f1c2b7e-0001" \
  -H "Content-Type: application/json" \
  -d '{"position": "lowered"}'

{ "id": "…", "state": "queued", "position": "lowered", "expires_at": "…" }

Then read GET /commands/{id} until it finishes.

StateMeaning
queuedAccepted, waiting for the bollard to check in.
deliveredThe bollard has been told.
completedThe bollard reported the position you asked for.
failedIt did not happen. failure_reason says why, for example a fault, or a newer request or schedule took over.
expiredNot acted on within 15 minutes, so the request was withdrawn and the bollard will not move late.

Always send an Idempotency-Key. If a request times out, repeat it with the same key and you get the first command back instead of a second movement.

Raising is refused with 409 if the bollard is offline, has a fault or has not checked in recently. To protect batteries and the connection, each bollard allows a limited number of remote movements in 24 hours (429 movement_limit_reached).

Reading status comes from our database and never wakes a bollard, so position and battery are as of its last check in (last_seen_at). The bollards are access control and are not crash rated.

Sign in with Boliq (OAuth)

For partner apps acting for a bollard owner. It is the standard OAuth 2.0 authorization code flow, so it also works for Alexa and Google Home account linking. PKCE is supported and recommended (S256 only), and your client secret is always needed at the token step.

  1. Send the owner to https://boliq.co.uk/connect.html with response_type=code, your client_id, a registered redirect_uri, a scope (space separated, for example devices:control schedules:write), a state and, if you use PKCE, a code_challenge with code_challenge_method=S256.
  2. The owner signs in, chooses which bollards and permissions to allow, and is sent back to your redirect address with code and your state. If they say no you get error=access_denied.
  3. From your server, POST https://boliq.co.uk/api/oauth/token with grant_type=authorization_code, code, redirect_uri, client_id and client_secret (in the body or as HTTP Basic), plus code_verifier if you used PKCE. You get an access token (1 hour) and a refresh token (90 days).
  4. Refresh with grant_type=refresh_token. Each refresh gives a new pair. The old refresh token keeps working for 10 minutes, in case a reply is lost, then stops.

A code works once and expires after 10 minutes. The owner can disconnect your app at any time, which stops its tokens straight away, so handle 401 by asking them to connect again.

Limits and errors

Endpoints

Method and pathDoes
GET /meWho the key belongs to, its permissions and limit.
GET /devicesThe bollards you can reach.
GET /devices/{id}One bollard, with its groups.
POST /devices/{id}/commandsRaise or lower.
GET /devices/{id}/commandsRecent commands.
GET /commands/{id}A command and its state.
GET /devices/{id}/eventsHistory. Changes through the API show as "Partner: Name".
GET, POST /devices/{id}/schedulesList and create schedules (UK local time).
PATCH, DELETE /schedules/{id}Change and delete a schedule.
GET /groupsNamed groups of bollards, read only.