Connect a front end#
Get the three values#
In Velora, open Publication, then Overview. The card Connect your front end shows:
| Value | What it is | Keep it |
|---|---|---|
| Delivery URL | https://delivery.velora.build/{site_id}. Every read starts here. |
In your front end's environment, for example VELORA_DELIVERY_URL |
| Read key | Reads the publication's published content. Nothing else. | On your server, for example VELORA_READ_KEY |
| Webhook secret | Signs the revalidate webhook and preview links. | On your server only, for example VELORA_WEBHOOK_SECRET |
The same card has Replace read key and a replace action for the webhook secret. Replacing either stops the old one working, so update your front end's environment when you do.
Two more settings tell Velora where your front end is. Set them once your front end is deployed (Deploy order). They are under Edit in CMS settings on the same card:
- Revalidate URL, for example
https://your-site.com/api/revalidate: where Velora sends the revalidate webhook. Velora also reads your block list from this URL's origin. - Preview URL, for example
https://your-site.com/api/preview: where the editor's Preview button sends a signed preview link.
Call the API#
Every read is a GET to the delivery URL plus the route:
curl -H "Authorization: Bearer $VELORA_READ_KEY" \
"https://delivery.velora.build/$SITE_ID/articles?limit=3"
- Send the read key as
Authorization: Bearer <key>, or as?key=<key>. If you send both,?key=wins. Both forms share cache entries at the edge. - Always call
https://delivery.velora.build. It is Velora's edge: it keeps answers close to your servers, serves the last good answer if Velora's API is down, and resizes images. The API behind it does not answer requests that do not come through the edge. - Only the query parameters a route reads reach the API. Anything else is dropped before the cache, so extra parameters cannot bypass it.
- Answers are JSON, except
/llms.txt, which is markdown. - Every answer allows any origin (
Access-Control-Allow-Origin: *), so a browser can call the API. Read on the server anyway: the key stays private, and your own cache does the work described in Caching.
Answers and errors#
| Status | Meaning |
|---|---|
200 |
The answer. |
404 |
Nothing here. A wrong Site id, a wrong read key and a missing article all answer 404, so the three cannot be told apart. Check the key first when everything is 404. |
405 |
A method other than GET, HEAD or OPTIONS. |
422 |
A parameter is out of range, for example limit=500 on a listing. |
503 |
Velora's API is unreachable and the edge holds no earlier copy of this answer. |
Errors have one shape:
{"error": "NOT_FOUND", "detail": "Not found"}
Every answer from the edge says how it was served in X-Velora-Cache: HIT, MISS, STALE (Velora's API is down and this is the last good copy) or BYPASS (never cached, such as a preview).
Types#
/openapi.json describes every route and answer. Generate your types from it rather than writing them by hand, for example with openapi-typescript:
bunx openapi-typescript https://developers.velora.build/openapi.json -o velora-api.d.ts
The API reference is the same document as a page.
This page as markdown: https://developers.velora.build/connect.md