API

Programmatic access to your page layout. Pro users only.

Authentication

Use your API key via Authorization: Bearer <key> or x-api-key: <key>.

Get layout

GET /api/layout/:name

Default response is an items array (each item includes its own order). Legacy format available via ?format=legacy.

curl -H "Authorization: Bearer $API_KEY" https://a.coffee/api/layout/<your-name>

Update a static tile (hero/coffee)

PUT /api/static/:name/:tile tile ∈ { hero, coffee }

curl -X PUT -H "Authorization: Bearer $API_KEY" -H "content-type: application/json" \
  -d '{"data": {"ctaText": "Buy me a coffee", "ctaHref": "https://..."}}' \
  https://a.coffee/api/static/<your-name>/coffee

Replace entire layout

PUT /api/layout/:name

Recommended: send an items array. Legacy body with modules/order/static is also accepted.

curl -X PUT -H "Authorization: Bearer $API_KEY" -H "content-type: application/json" \
  -d '{"items":[{"kind":"static","id":"hero","tile":"hero","order":0,"size":"2x2","data":{}},{"kind":"static","id":"coffee","tile":"coffee","order":1,"size":"1x1","data":{}},{"kind":"module","id":"mod-xyz","type":"text","order":2,"size":"1x1","data":{"title":"Hello"}}]}' \
  https://a.coffee/api/layout/<your-name>

Update a single module

PUT /api/module/:name/:id

curl -X PUT -H "Authorization: Bearer $API_KEY" -H "content-type: application/json" \
  -d '{"id":"mod-xyz","type":"text","size":"1x1","data":{"title":"Hi"}}' \
  https://a.coffee/api/module/<your-name>/mod-xyz