REST API v1

Developer API

Integrate Twyft parcel delivery directly into your application. Create shipments, track parcels in real time, and receive push notifications via webhooks.

Bearer token auth
Real-time webhooks
HTTPS only
HMAC-SHA256 signatures

Authentication

All API requests must include a Bearer token in the Authorization header. API keys are prefixed with twft_ and can be generated from your account settings. API access must be enabled on your account by Twyft — contact us if you need it activated.

HTTP Header
Authorization: Bearer twft_your_api_key_here

Keep your API key secret. Never expose it in client-side code or public repositories. Rotate it immediately from your account settings if you suspect it has been compromised.

Base URL

https://twyft.im/api/v1

All endpoints are HTTPS only. HTTP requests will be rejected.

Error Codes

200OKRequest succeeded.
201CreatedResource created successfully.
400Bad RequestMissing or invalid parameters. Check the error message for details.
401UnauthorizedMissing, invalid, or revoked API key.
403ForbiddenAPI access is disabled for this account, or you are trying to access another account's data.
404Not FoundThe requested resource does not exist.
429Too Many RequestsRate limit exceeded. Standard tier: 100 req/min. High-volume tier: 1,000 req/min.
500Internal Server ErrorSomething went wrong on our end. Please try again or contact support.

Error response shape

{ "error": "Human-readable error message" }

Shipments

Create, list, and retrieve shipments programmatically.

Webhooks Guide

Webhooks let Twyft push tracking events to your server in real time, eliminating the need to poll the API. Configure endpoints from your account settings.

Event Types

shipment.createdA new shipment has been created.
shipment.status_updatedA tracking milestone has been reached (collected, in transit, out for delivery, etc.).
shipment.deliveredThe shipment has been delivered.
tracking.eventAny tracking event that does not change the top-level status.
webhook.testSent when you click "Send test" in the dashboard.

Verifying Signatures

Every delivery includes an X-Twyft-Signature header containing sha256=<hex>. Compute HMAC-SHA256 of the raw request body using your endpoint secret and compare.

Node.js verification example
const crypto = require('crypto');

function verifySignature(rawBody, secret, header) {
  const expected = 'sha256=' + crypto
    .createHmac('sha256', secret)
    .update(rawBody)
    .digest('hex');
  return crypto.timingSafeEqual(
    Buffer.from(expected),
    Buffer.from(header)
  );
}

Retry Policy

If your endpoint returns a non-2xx response or times out (10s), Twyft will retry up to 3 times with exponential backoff: 5 seconds, 30 seconds, then 2 minutes. After 3 failures the delivery is abandoned and logged.

Your endpoint should return a 2xx response as quickly as possible — process the payload asynchronously if needed. Delivery logs are visible in your webhook settings.

Status Reference

pendingBooking confirmed, awaiting collection or drop-off.
collectedParcel collected by Twyft driver or received at drop-off.
at_depotParcel arrived at Twyft depot.
in_transitParcel in transit (IOM domestic: en route; IOM-UK: crossing to the UK).
out_for_deliveryOut for final delivery.
deliveredDelivered to recipient.
failedDelivery attempt failed.
cancelledBooking cancelled.

Ready to integrate?

Generate your API key and start building in minutes.