API REFERENCE

REST API

The PatternHooks API is organized around REST. Our API accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs.

BASE URL

All API requests should be made to:

https://api.patternhooks.com/api/v1

All requests must be made over HTTPS. Requests made over HTTP will be rejected.

AUTHENTICATION

Authenticate API requests using Bearer tokens in the Authorization header:

HTTP Header
Authorization: Bearer sk_live_your_api_key_here

API Key Types

TypePrefixUse Case
Live Secretsk_live_Production server-side requests
Test Secretsk_test_Development and testing
Restrictedrk_live_Limited permissions (custom scopes)

ERROR HANDLING

The API uses conventional HTTP response codes:

200OK — Request succeeded
201Created — Resource created
400Bad Request — Invalid parameters
401Unauthorized — Invalid API key
404Not Found — Resource doesn't exist
429Rate Limited — Too many requests

Error Response Format

JSON
{ "error": { "code": "validation_error", "message": "Invalid request parameters", "details": [ {"field": "url", "message": "Must be a valid HTTPS URL"} ], "requestId": "req_abc123xyz" } }

APPLICATIONS

POST /v1/app Create application

Create a new application. Applications typically represent one of your customers.

Request Body

ParameterTypeDescription
namerequiredstringHuman-readable name (max 256 chars)
uidoptionalstringYour internal customer ID for lookup
metadataoptionalobjectCustom key-value pairs
rateLimitoptionalintegerMax messages per second (default: 1000)
Request
curl -X POST https://api.patternhooks.com/api/v1/app \ -H "Authorization: Bearer sk_live_xxx" \ -H "Content-Type: application/json" \ -d '{ "name": "Acme Corporation", "uid": "customer_12345", "metadata": {"plan": "enterprise"} }'
Response
{ "id": "app_2X8BfDj3K4mN", "name": "Acme Corporation", "uid": "customer_12345", "metadata": {"plan": "enterprise"}, "rateLimit": 1000, "createdAt": "2026-01-06T10:30:00Z", "updatedAt": "2026-01-06T10:30:00Z" }

ENDPOINTS

POST /v1/app/{app_id}/endpoint Create endpoint

Create a new endpoint to receive webhook deliveries.

Path Parameters

ParameterTypeDescription
app_idrequiredstringApplication ID or UID

Request Body

ParameterTypeDescription
urlrequiredstringHTTPS URL for webhook delivery
descriptionoptionalstringHuman-readable description
filterTypesoptionalstring[]Event types to receive (default: all)
secretoptionalstringCustom signing secret (auto-generated if omitted)
rateLimitoptionalintegerMax requests per second
headersoptionalobjectCustom headers to include
disabledoptionalbooleanWhether endpoint is disabled
Request
curl -X POST https://api.patternhooks.com/api/v1/app/app_xxx/endpoint \ -H "Authorization: Bearer sk_live_xxx" \ -H "Content-Type: application/json" \ -d '{ "url": "https://example.com/webhooks", "filterTypes": ["order.created", "order.updated"], "headers": {"X-Custom": "value"} }'

MESSAGES

POST /v1/app/{app_id}/msg Send message

Send a webhook message to all subscribed endpoints.

Request Body

ParameterTypeDescription
eventTyperequiredstringEvent type (e.g., "order.created")
payloadrequiredobjectJSON payload to deliver
eventIdoptionalstringUnique ID for idempotency
channelsoptionalstring[]Channels to send to (for filtering)
Request
curl -X POST https://api.patternhooks.com/api/v1/app/app_xxx/msg \ -H "Authorization: Bearer sk_live_xxx" \ -H "Content-Type: application/json" \ -d '{ "eventType": "order.created", "eventId": "evt_unique_123", "payload": { "orderId": "ord_abc", "amount": 9900, "currency": "usd" } }'
Response
{ "id": "msg_7K9mNpQrSt", "eventType": "order.created", "eventId": "evt_unique_123", "payload": {"orderId": "ord_abc", "amount": 9900, "currency": "usd"}, "timestamp": "2026-01-06T10:30:00Z" }