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
| Type | Prefix | Use Case |
|---|---|---|
| Live Secret | sk_live_ | Production server-side requests |
| Test Secret | sk_test_ | Development and testing |
| Restricted | rk_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
| Parameter | Type | Description |
|---|---|---|
| namerequired | string | Human-readable name (max 256 chars) |
| uidoptional | string | Your internal customer ID for lookup |
| metadataoptional | object | Custom key-value pairs |
| rateLimitoptional | integer | Max 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
| Parameter | Type | Description |
|---|---|---|
| app_idrequired | string | Application ID or UID |
Request Body
| Parameter | Type | Description |
|---|---|---|
| urlrequired | string | HTTPS URL for webhook delivery |
| descriptionoptional | string | Human-readable description |
| filterTypesoptional | string[] | Event types to receive (default: all) |
| secretoptional | string | Custom signing secret (auto-generated if omitted) |
| rateLimitoptional | integer | Max requests per second |
| headersoptional | object | Custom headers to include |
| disabledoptional | boolean | Whether 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
| Parameter | Type | Description |
|---|---|---|
| eventTyperequired | string | Event type (e.g., "order.created") |
| payloadrequired | object | JSON payload to deliver |
| eventIdoptional | string | Unique ID for idempotency |
| channelsoptional | string[] | 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"
}