Webhooks allow your application
to receive real-time HTTP notifications when specific events occur within the
TextWatermark system. Instead of polling the API for changes, you can subscribe to
events and have TextWatermark send a POST request to your specified URL when those
events happen.
Common use cases include
notifications for asynchronous job completion, quota warnings, or changes to your
account. All webhook management endpoints require JWT authentication. It is highly
recommended to use a secret
when creating webhooks to verify the authenticity of incoming payloads.
List
Webhooks
GET
/api/v2/webhooks
Retrieves a list of all
webhooks configured for the authenticated user's account.
Headers:
Authorization: Bearer <JWT_ACCESS_TOKEN>
Successful
Response (200 OK):
{
"webhooks": [
{
"id": "wh_uuid_1",
"url": "https://myapp.com/webhooks/textwatermark",
"subscribed_events": ["encode.success", "quota.warning"],
"status": "active",
"created_at": "2023-11-10T10:00:00Z",
"last_delivery_at": "2023-11-15T12:30:00Z",
"last_delivery_status": "success"
},
{
"id": "wh_uuid_2",
"url": "https://anotherapp.com/notifications",
"subscribed_events": ["decode.failed"],
"status": "inactive",
"created_at": "2023-10-05T08:00:00Z",
"last_delivery_at": null,
"last_delivery_status": null
}
]
}
Example
cURL:
curl -H "Authorization: Bearer <JWT_ACCESS_TOKEN>" \
https://api.textwatermark.com/api/v2/webhooks
Create
Webhook
POST
/api/v2/webhooks
Registers a new webhook
endpoint to receive notifications for specified events.
Headers:
Authorization: Bearer <JWT_ACCESS_TOKEN>
Request
Body:
{
"url": "https://myapp.com/webhooks/textwatermark-notifications",
"subscribed_events": ["encode.success", "encode.failed", "quota.limit.exceeded"],
"secret": "your_secure_random_string_for_signature_verification", // Optional, but highly recommended
"description": "Notifications for my primary application" // Optional
}
Successful
Response (201 Created):
{
"id": "wh_new_uuid",
"url": "https://myapp.com/webhooks/textwatermark-notifications",
"subscribed_events": ["encode.success", "encode.failed", "quota.limit.exceeded"],
"status": "active", // Webhooks are typically active by default
"has_secret": true,
"description": "Notifications for my primary application",
"created_at": "2023-11-16T14:00:00Z"
}
Note on
secret
:
If a secret is provided, TextWatermark will sign webhook event payloads. The
signature will be included in the X-Webhook-Signature
header (e.g., using HMAC-SHA256). You should verify this signature on your
server to ensure the payload is genuine.
Example
cURL:
curl -X POST https://api.textwatermark.com/api/v2/webhooks \
-H "Authorization: Bearer <JWT_ACCESS_TOKEN>" \
-H "Content-Type: application/json" \
-d '{
"url": "https://myapp.com/webhooks/textwatermark-notifications",
"subscribed_events": ["encode.success", "quota.limit.exceeded"],
"secret": "s3cr3t_k3y_v4lu3"
}'
Get Webhook
Details
GET
/api/v2/webhooks/{webhookId}
Retrieves the details of
a specific webhook by its ID.
Headers:
Authorization: Bearer <JWT_ACCESS_TOKEN>
Path
Parameters:
webhookId
(string, required): The ID of the webhook to
retrieve.
Successful
Response (200 OK):
{
"id": "wh_uuid_1",
"url": "https://myapp.com/webhooks/textwatermark",
"subscribed_events": ["encode.success", "quota.warning"],
"status": "active",
"has_secret": true,
"description": "Production webhook",
"created_at": "2023-11-10T10:00:00Z",
"updated_at": "2023-11-12T11:00:00Z"
}
Example
cURL:
curl -H "Authorization: Bearer <JWT_ACCESS_TOKEN>" \
https://api.textwatermark.com/api/v2/webhooks/wh_uuid_1
Update
Webhook
PUT
/api/v2/webhooks/{webhookId}
Updates the configuration
of an existing webhook. You can change the URL, subscribed events, secret, or
status.
Headers:
Authorization: Bearer <JWT_ACCESS_TOKEN>
Path
Parameters:
webhookId
(string, required): The ID of the webhook to update.
Request
Body: (Include only fields to update)
{
"url": "https://new-app-url.com/webhooks/listener",
"subscribed_events": ["decode.success"],
"status": "inactive", // e.g., to temporarily disable the webhook
"secret": "new_secure_secret_optional" // To update or set a secret
}
Successful
Response (200 OK):
{
"id": "wh_uuid_1",
"url": "https://new-app-url.com/webhooks/listener",
"subscribed_events": ["decode.success"],
"status": "inactive",
"has_secret": true, // Will be true if a secret is set or updated
"description": "Production webhook", // Unchanged fields remain
"created_at": "2023-11-10T10:00:00Z",
"updated_at": "2023-11-16T15:30:00Z"
}
Example
cURL:
curl -X PUT https://api.textwatermark.com/api/v2/webhooks/wh_uuid_1 \
-H "Authorization: Bearer <JWT_ACCESS_TOKEN>" \
-H "Content-Type: application/json" \
-d '{"url": "https://new-app-url.com/webhooks/listener", "status": "inactive"}'
Delete
Webhook
DELETE
/api/v2/webhooks/{webhookId}
Permanently removes a
webhook configuration. This action cannot be undone.
Headers:
Authorization: Bearer <JWT_ACCESS_TOKEN>
Path
Parameters:
webhookId
(string, required): The ID of the webhook to delete.
Successful
Response (204 No Content or 200 OK with message):
// HTTP 204 No Content (preferred for DELETE operations)
// OR (if providing a message):
{
"message": "Webhook wh_uuid_1 deleted successfully."
}
Example
cURL:
curl -X DELETE https://api.textwatermark.com/api/v2/webhooks/wh_uuid_1 \
-H "Authorization: Bearer <JWT_ACCESS_TOKEN>"
List Webhook
Deliveries
GET
/api/v2/webhooks/{webhookId}/deliveries
Retrieves a log of recent
event delivery attempts for a specific webhook. This is useful for diagnostics
and troubleshooting failed deliveries.
Headers:
Authorization: Bearer <JWT_ACCESS_TOKEN>
Path
Parameters:
webhookId
(string, required): The ID of the webhook.
Successful
Response (200 OK):
{
"deliveries": [
{
"id": "delivery_uuid_1",
"event_type": "encode.success",
"status": "success",
"timestamp": "2023-11-15T12:30:00Z",
"response_status_code": 200
},
{
"id": "delivery_uuid_2",
"event_type": "quota.warning",
"status": "failed",
"timestamp": "2023-11-14T10:15:00Z",
"response_status_code": 503,
"error_message": "Remote server unavailable"
}
],
"pagination": {
"next_cursor": "cursor_string_for_next_page",
"has_more": true
}
}
Example
cURL:
curl -H "Authorization: Bearer <JWT_ACCESS_TOKEN>" \
https://api.textwatermark.com/api/v2/webhooks/wh_uuid_1/deliveries
Redeliver
Webhook Event
POST
/api/v2/webhooks/deliveries/{deliveryId}/redeliver
Attempts to resend a
specific webhook event notification that previously failed or was not received.
Headers:
Authorization: Bearer <JWT_ACCESS_TOKEN>
Path
Parameters:
deliveryId
(string, required): The ID of the delivery attempt
to redeliver.
Successful
Response (202 Accepted or 200 OK):
{
"message": "Webhook event redelivery queued.",
"redelivery_attempt_id": "redelivery_uuid_new"
}
Example
cURL:
curl -X POST https://api.textwatermark.com/api/v2/webhooks/deliveries/delivery_uuid_2/redeliver \
-H "Authorization: Bearer <JWT_ACCESS_TOKEN>"