Webhook
Onttle data change events delivered to external systems in real time — event types, payload structure, and integration examples.
Webhooks deliver Onttle data change events to external systems in real time via HTTP POST requests sent to the registered URL.
Event Types
Onttle supports three events following the Contents lifecycle. Events fire when Contents are created, updated, or deleted through the REST API.
| Event Code | When It Fires |
|---|---|
CREATED |
When new Contents are created with POST /tables/{table} |
UPDATED |
When existing Contents are updated with PUT /tables/{table}/{id} |
DELETED |
When Contents are deleted with a DELETE request |
Subscription Model
Webhooks subscribe to events on a per-Table basis. When creating a Webhook, select which event codes to receive for each Table.
For example, you can subscribe to only CREATED and UPDATED events from the posts table, while subscribing to all events from the products table.
[IMAGE AREA] Webhook creation screen — table selection and event code selection UI
When Events Are Not Fired
Webhook events are not sent for the following operations.
- Creating, updating, or deleting Contents in the dashboard
- Adding, updating, or deleting Columns
- Creating, updating, or deleting Tables
- Changes to Translations, Variables, Categories, or Files
- Dashboard configuration changes (API Keys, Webhook settings, etc.)
Webhook events are triggered only for Contents changes made through the REST API. They are also not sent for a disabled Webhook, or when the Workspace does not have enough credits.
Delivery
| Item | Description |
|---|---|
| Attempts | Each event is sent once. A non-2xx response or a failed request is not retried automatically |
| Timeout | If no response is received within 10 seconds, the delivery is treated as failed |
| URL | Only https URLs are called. Addresses that resolve to internal or private IPs are blocked, and redirects are not followed |
| Billing | Each delivery the receiving server responded to counts as one Webhook Request. Deliveries are skipped when credits are insufficient |
Because there is no retry, for work that must not be missed, store the request on the receiving server before processing it, and also reconcile periodically by reading the REST API.
Payload Structure
When a Webhook event fires, an HTTP POST request is sent to the registered URL with a JSON body.
Payload Example
UPDATED event when Contents are updated with PUT /tables/posts/{id}
{
"event": "UPDATED",
"project_id": "{projectId}",
"table_id": "posts",
"contents_id": "0c8f6c1e-5d1b-4f0a-9a3e-2b7d4e6f8a10",
"data": {
"title": "Hello Onttle",
"view_count": 120
},
"occurred_at": "2026-08-30T09:00:00.000Z"
}
DELETED event when several items are deleted (DELETE /tables/posts)
{
"event": "DELETED",
"project_id": "{projectId}",
"table_id": "posts",
"contents_ids": [
"0c8f6c1e-5d1b-4f0a-9a3e-2b7d4e6f8a10",
"7a1d2c3b-4e5f-4a6b-8c7d-9e0f1a2b3c4d"
],
"occurred_at": "2026-08-30T09:00:00.000Z"
}
Field Reference
| Field | Type | Description |
|---|---|---|
event |
CREATED | UPDATED | DELETED |
Event type |
project_id |
string |
Project ID. The same value as {projectId} in the API path |
table_id |
string |
The Table where the event occurred. It carries the value used in the API request path (slug or ID) as is |
contents_id |
string |
The target Contents. For CREATED it is the new content's ID; for UPDATED and a single-item DELETED it is the value used in the request path (ID or slug) |
contents_ids |
string[] |
IDs of the deleted Contents when several are deleted at once. contents_id is absent in that case |
data |
object |
The Contents' Column values keyed by Column name. Included only for CREATED and UPDATED |
occurred_at |
string |
Time the event was sent (ISO 8601 UTC) |
- Fields without a value are omitted from the body. For example, a
DELETEDevent has nodata. datahas the same format asdatain REST API responses. Previous data and a before/after diff are not included.- The payload does not carry the publication status. Events also fire for Contents saved as a draft, so if you need to know whether the Contents are published, fetch them via the REST API after receiving the event. The read APIs return published Contents only.
async function handleWebhook(payload: WebhookPayload) {
const { project_id, table_id, contents_id } = payload
if (!contents_id) return // bulk delete event
const res = await fetch(
`https://api.onttle.com/v1/${project_id}/tables/${table_id}/${contents_id}`,
{ headers: { Authorization: `Bearer ${process.env.ONTTLE_API_KEY}` } },
)
if (!res.ok) return // 404 for deleted or unpublished Contents
const contents = await res.json()
// Update cache, trigger redeploy, etc.
}
TypeScript Type Definitions
type WebhookEventCode = 'CREATED' | 'UPDATED' | 'DELETED'
interface WebhookPayload {
event: WebhookEventCode
project_id: string
table_id: string
contents_id?: string
contents_ids?: string[]
data?: Record<string, unknown>
occurred_at: string
}
Request Headers
| Header | Value |
|---|---|
Content-Type |
application/json |
X-Onttle-Signature |
t={unix time in seconds},v1={HMAC-SHA256 signature (hex)} |
| Headers you added | The keys and values entered under Headers in the Webhook settings |
The v1 value of X-Onttle-Signature is the HMAC-SHA256 signature of the string {t}.{request body}, made with a signing key that is specific to the Webhook. See Verifying the Signature below.
Header names may contain only letters, digits, and hyphens. Transport headers such as Host and Content-Length, and names starting with X-Onttle-, cannot be added.
Verifying the Signature
Use the X-Onttle-Signature header to confirm that a request comes from Onttle and that its body was not changed.
Finding the signing key: Open a Webhook from the Webhooks list. The edit screen shows a Signing key field with the key hidden. Use the eye button to show it or the copy button to copy it. Each Webhook has its own signing key, and it is available once the Webhook is saved, to the Owner, Admin, and Editor roles only. Keep the copied key in an environment variable on the receiving server.
Steps
- Read
t(unix time in seconds) andv1(the signature) from the header. - Reject the request if
tis more than 5 minutes away from the current time. This stops an intercepted request from being sent again later. - Compute the HMAC-SHA256 (hex) of
{t}.{request body}with the signing key. Use the request body exactly as received, before parsing it as JSON. - Compare the result with
v1usingtimingSafeEqual.
import { createHmac, timingSafeEqual } from 'node:crypto'
const TOLERANCE_SECONDS = 5 * 60
export function verifyOnttleSignature(
rawBody: string,
signatureHeader: string | null,
signingKey: string,
) {
// Header format: t=<unix time in seconds>,v1=<hex signature>
const parts = Object.fromEntries(
(signatureHeader ?? '').split(',').map((part) => part.split('=')),
)
const timestamp = Number(parts.t)
if (!Number.isFinite(timestamp) || !parts.v1) return false
// Reject requests older (or newer) than 5 minutes
if (Math.abs(Date.now() / 1000 - timestamp) > TOLERANCE_SECONDS) return false
const expected = createHmac('sha256', signingKey)
.update(`${parts.t}.${rawBody}`)
.digest()
const received = Buffer.from(parts.v1, 'hex')
// timingSafeEqual keeps the comparison time from leaking the signature
return (
received.length === expected.length && timingSafeEqual(received, expected)
)
}
Integration Examples
Step 1: Register a Webhook
- Click Webhooks in the left menu of your Project.
- Click the New Webhook button.
- Enter a Name and the URL of the endpoint that will receive events. The URL must start with
https.- Example:
https://my-app.vercel.app/api/webhooks/onttle
- Example:
- If needed, add values under Headers to send along to the receiving server.
- Under Events, select the Table and event codes you want to subscribe to.
- Click Create.
- Open the Webhook you created again, copy its Signing key, and store it in an environment variable on the receiving server (for example
ONTTLE_WEBHOOK_SIGNING_KEY).
The Sample section at the bottom of the form shows an example payload for each event.
[IMAGE AREA] Webhook registration screen (URL input, table/event selection UI)
Step 2: Check That It Works
The dashboard has no feature for sending a test event. Trigger a real event by creating Contents through the REST API in a Table you subscribed to, and check that the request reaches your receiving server.
curl -X POST "https://api.onttle.com/v1/{projectId}/tables/posts" \
-H "Authorization: Bearer $ONTTLE_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "title": "Webhook test" }'
Step 3: Receive Events in a Next.js Route Handler
// app/api/webhooks/onttle/route.ts
import { NextRequest, NextResponse } from 'next/server'
import { verifyOnttleSignature } from '@/lib/onttleWebhook'
export async function POST(req: NextRequest) {
// 1. Verify the signature (verifyOnttleSignature from "Verifying the Signature")
// Read the body as raw text: the signature only matches the unparsed body
const rawBody = await req.text()
const isValid = verifyOnttleSignature(
rawBody,
req.headers.get('x-onttle-signature'),
process.env.ONTTLE_WEBHOOK_SIGNING_KEY!,
)
if (!isValid) {
return NextResponse.json({ ok: false }, { status: 401 })
}
const payload = JSON.parse(rawBody) as WebhookPayload
// 2. Respond with 200 immediately to avoid timeout
processEvent(payload).catch(console.error)
return NextResponse.json({ ok: true })
}
async function processEvent(payload: WebhookPayload) {
if (payload.event === 'CREATED' || payload.event === 'UPDATED') {
await revalidateContent(payload)
}
if (payload.event === 'DELETED') {
const ids = payload.contents_ids ?? [payload.contents_id]
await removeFromCache(ids)
}
}
Step 4: Trigger a Vercel Deployment
Prerequisite: Generate a Hook URL in your Vercel project settings → Git → Deploy Hooks.
async function triggerVercelDeploy() {
const deployHookUrl = process.env.VERCEL_DEPLOY_HOOK_URL
if (!deployHookUrl) return
await fetch(deployHookUrl, { method: 'POST' })
}
// Trigger only on events of the posts Table
async function processEvent(payload: WebhookPayload) {
if (payload.table_id === 'posts') {
await triggerVercelDeploy()
}
}
Step 5: Check Delivery Volume
Sent Webhooks are counted under Webhook Requests in Workspace → Usage. See Usage and Logs for details. Check the result of each delivery in the logs of your receiving server.
Best Practices
| Item | Recommendation |
|---|---|
| Response speed | Respond with 200 immediately and run follow-up work asynchronously |
| Deduplication | Write handlers so that processing the same request again gives the same result (e.g. cache refresh, overwrite) |
| Failure handling | There is no automatic retry, so log follow-up task failures on the receiving server and retry there |
| Security | Do not expose the Webhook URL publicly, and verify X-Onttle-Signature with the signing key |