FreightCake

Webhooks

Receive real-time event notifications from FreightCake.

Overview

Register an HTTPS endpoint to receive signed JSON notifications for FreightCake account events.

Setting Up Webhooks

1. Create an endpoint

curl -X POST https://api.freightcake.com/api/v1/webhooks \
  -H "Authorization: Bearer fk_live_REPLACE_WITH_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://your-app.com/webhooks/freightcake",
    "events": ["shipment.delivered", "invoice.created"],
    "description": "Production webhook"
  }'

The create response includes secret once. Store it in your secret manager. List, retrieve, and update responses never include it.

2. Handle events

Your endpoint must return a 2xx status code within 10 seconds. Process slow work asynchronously. The webhook payload is:

{
  "id": "evt_abc123",
  "type": "shipment.delivered",
  "created": "2026-07-01T12:00:00.000Z",
  "data": {
    "shipment": {
      "id": 42,
      "proNumber": "123456789",
      "status": "DELIVERED",
      "location": "Atlanta, GA",
      "carrier": "Sandbox Freight Co"
    }
  },
  "webhook": {
    "id": "whk_1",
    "url": "https://your-app.com/webhooks/freightcake"
  }
}

3. Verify signatures

Each request includes X-FreightCake-Signature: t={timestamp},v1={hex}. Verify the unmodified request body before parsing JSON. The SDK rejects signatures more than 5 minutes from the current time by default.

import { verifyWebhookSignature } from '@freightcake/sdk'

export async function POST(request: Request) {
  const rawBody = await request.text()
  const signature = request.headers.get('x-freightcake-signature')
  if (!signature) return new Response('Missing signature', { status: 401 })

  try {
    verifyWebhookSignature(
      rawBody,
      signature,
      process.env.FREIGHTCAKE_WEBHOOK_SECRET!,
    )
  } catch {
    return new Response('Invalid signature', { status: 401 })
  }

  const event = JSON.parse(rawBody)
  await enqueueEvent(event)
  return new Response('ok')
}

Pass { tolerance: 600 } as the fourth argument only when your receiver needs a wider replay window.

Event Types

Shipment Events

EventDescription
shipment.bookedShipment has been booked with carrier
shipment.picked_upCarrier picked up the freight
shipment.in_transitShipment is in transit
shipment.out_for_deliveryShipment is out for delivery
shipment.deliveredShipment has been delivered
shipment.exceptionDelivery exception occurred
shipment.cancelledShipment was cancelled or voided

Quote Events

EventDescription
quote.createdNew rate quotes generated
quote.expiredQuote has expired

Invoice Events

EventDescription
invoice.createdNew invoice generated
invoice.updatedInvoice fields changed
invoice.paidInvoice payment received
invoice.voidedInvoice was voided
invoice.overdueInvoice is past due

Customer Events

EventDescription
customer.createdCustomer was created
customer.updatedCustomer fields changed

Carrier Bill Events

EventDescription
bill.createdCarrier bill was created
bill.updatedCarrier bill fields changed

BOL Events

EventDescription
bol.generatedBill of lading PDF generated

Retry Policy

Failed deliveries are retried with exponential backoff:

AttemptDelay
1Immediate
21 minute
35 minutes
430 minutes
52 hours
612 hours
724 hours

After 7 attempts, the delivery is marked as failed. After 10 consecutive failed attempts across deliveries, FreightCake disables the endpoint and emails its owner. Rotate the secret only when the endpoint reports Signing secret rotation required; fix receiver availability before re-enabling other disabled endpoints.

Managing Endpoints

List endpoints

curl https://api.freightcake.com/api/v1/webhooks \
  -H "Authorization: Bearer fk_live_REPLACE_WITH_YOUR_KEY"

Update an endpoint

curl -X PATCH https://api.freightcake.com/api/v1/webhooks/1 \
  -H "Authorization: Bearer fk_live_REPLACE_WITH_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "events": ["shipment.delivered", "shipment.exception", "invoice.created"] }'

Test an endpoint

Send a test event to verify your endpoint is working:

curl -X POST https://api.freightcake.com/api/v1/webhooks/1/test \
  -H "Authorization: Bearer fk_live_REPLACE_WITH_YOUR_KEY"

This queues a signed webhook.test event for that endpoint only.

Rotate a signing secret

curl -X POST https://api.freightcake.com/api/v1/webhooks/1/rotate-secret \
  -H "Authorization: Bearer fk_live_REPLACE_WITH_YOUR_KEY" \
  -H "Idempotency-Key: rotate-webhook-1-2026-07-10"

Save the returned secret before discarding the response. See Webhook Endpoints for the response shape and SDK method.

View deliveries

Check recent delivery attempts for an endpoint:

curl https://api.freightcake.com/api/v1/webhooks/1/deliveries \
  -H "Authorization: Bearer fk_live_REPLACE_WITH_YOUR_KEY"

Delete an endpoint

curl -X DELETE https://api.freightcake.com/api/v1/webhooks/1 \
  -H "Authorization: Bearer fk_live_REPLACE_WITH_YOUR_KEY"

On this page