nano-api / config

Flip the switch
without a deploy

A small JSON document, read often and written rarely. Kill switches, feature flags, limits: the handful of values you should not have to redeploy to change.

Take a key Curl walkthrough

Free. Signup is one curl and the key comes back in the response. No form, no card, nobody to ask.

/v1/configs/checkout v7v8
{
  "maintenance": falsetrue,
  "max_items": 50
}
  1. 12:00:00 GET 304 unchanged
  2. 12:00:30 GET 304 unchanged
  3. 12:01:00 PATCH 200 → v8
  4. 12:01:30 GET 200 v8

Write it, read it

curl -X PUT https://configmaps.nano-api.com/v1/configs/checkout \
  -H "Authorization: Bearer $NANO_API_KEY" -H 'content-type: application/json' \
  -d '{"maintenance": false, "max_items": 50}'

PATCH merges keys and null removes one. Read the whole document, or a single value when that is all you need.

curl -s https://configmaps.nano-api.com/v1/configs/checkout/keys/maintenance \
  -H "Authorization: Bearer $NANO_API_KEY"
# {"name":"checkout","key":"maintenance","value":true,"version":8}

Three ways I got this wrong by hand

  1. 1

    Polling it hurts, so you poll it rarely

    Then the kill switch takes ten minutes to reach anything. Here every read carries an ETag: send If-None-Match and an unchanged document answers 304 with no body. Check every few seconds and nobody notices.

  2. 2

    Two people edit, one edit disappears

    Mid-incident that is exactly what happens: you and a colleague both fix it. Send If-Match: "7" and the write only lands if nothing moved since. The loser gets 412 and both version numbers, rather than silence.

  3. 3

    Rolling back makes v1 mean two things

    Restore the old content and anything holding "version 1" is now wrong. So restoring writes that content as a new version instead. The number only ever goes up, and one version number never describes two documents.

The kill switch, mid-incident

curl -X PATCH "https://configmaps.nano-api.com/v1/configs/checkout?note=incident-4711" \
  -H "Authorization: Bearer $NANO_API_KEY" -H 'content-type: application/json' \
  -H 'if-match: "7"' -d '{"maintenance": true}'

The last 20 versions are kept with the note you pass. That is what you read afterwards to see who flipped what, and when.

Using it with the others

Keep the schedule Relay calls, the window Pulse watches, and the switch that pauses both, in one document you can change from anywhere.

How to, in curl What this is