Webhooks

Webhooks API Contract

Overview

The Webhooks API allows you to receive real-time notifications when STT or TTS jobs complete or fail. Instead of polling for job status, webhooks push events to your server automatically.

Base URL: https://tts-api.stg.prosa.ai/v2/speech/webhooks

Authentication: All endpoints require the x-api-key header with your API key.


Webhook Event Types

Event
Description

stt.job.completed

STT transcription job completed successfully

stt.job.failed

STT transcription job failed

tts.job.completed

TTS synthesis job completed successfully

tts.job.failed

TTS synthesis job failed

webhook.ping

Test event for endpoint verification


Endpoint Management

Create Endpoint (POST /webhooks/endpoints)

Register a new webhook endpoint to receive events.

Authentication: API key required

Request:

Request Body:

Field
Type
Required
Default
Description

url

string

✅ Yes

-

Your webhook endpoint URL (must be HTTPS)

event_filters

array

No

[]

Events to subscribe to (empty = all events)

ssl_verification

boolean

No

true

Verify SSL certificate

secret_key

string

No

Auto-generated

Custom secret key for signing

Response (201 Created):

Response Fields:

Field
Type
Description

id

string

Unique endpoint identifier

url

string

Registered webhook URL

secrets

array

Signing secrets for verification

secrets[].key

string

Secret key for HMAC signature

secrets[].expired_at

string

Expiration date (null = never)

event_filters

array

Subscribed event types

ssl_verification

boolean

SSL verification enabled

⚠️ Important: Save the secrets[0].key immediately - you'll need it to verify webhook signatures!

Error Responses:

  • 400 Bad Request: Invalid URL

  • 401 Unauthorized: Invalid API key


List Endpoints (GET /webhooks/endpoints)

List all registered webhook endpoints.

Authentication: API key required

Request:

Response (200 OK):


Get Endpoint (GET /webhooks/endpoints/{endpoint_id})

Get details of a specific webhook endpoint including secrets.

Authentication: API key required

Request:

Path Parameters:

Parameter
Type
Required
Description

endpoint_id

string

✅ Yes

Endpoint identifier

Response (200 OK):

Error Responses:

  • 404 Not Found: Endpoint not found


Update Endpoint (PUT /webhooks/endpoints/{endpoint_id})

Update an existing webhook endpoint.

Authentication: API key required

Request:

Path Parameters:

Parameter
Type
Required
Description

endpoint_id

string

✅ Yes

Endpoint identifier

Request Body:

Field
Type
Required
Description

url

string

No

New webhook URL

event_filters

array

No

Updated event subscriptions

ssl_verification

boolean

No

SSL verification setting

Response (200 OK):


Delete Endpoint (DELETE /webhooks/endpoints/{endpoint_id})

Delete a webhook endpoint.

Authentication: API key required

Request:

Path Parameters:

Parameter
Type
Required
Description

endpoint_id

string

✅ Yes

Endpoint identifier

Response (200 OK):

Error Responses:

  • 404 Not Found: Endpoint not found


Rotate Secret (POST /webhooks/endpoints/{endpoint_id}/rotate)

Rotate the signing secret for an endpoint. The old secret remains valid for a grace period.

Authentication: API key required

Request:

Path Parameters:

Parameter
Type
Required
Description

endpoint_id

string

✅ Yes

Endpoint identifier

Request Body:

Field
Type
Required
Default
Description

days

integer

No

0

Days until old secret expires

hours

integer

No

0

Hours until old secret expires

Response (200 OK):

Note: Both secrets are valid during the grace period. Update your server to use the new secret before the old one expires.


Test Endpoint (POST /webhooks/endpoints/{endpoint_id}/test)

Send a test event to verify your endpoint is working.

Authentication: API key required

Request:

Path Parameters:

Parameter
Type
Required
Description

endpoint_id

string

✅ Yes

Endpoint identifier

Response (200 OK):


Event Management

List Events (GET /webhooks/events)

List webhook events with optional filtering.

Authentication: API key required

Request:

Query Parameters:

Parameter
Type
Required
Description

from_date

string (date)

No

Filter from date (YYYY-MM-DD)

until_date

string (date)

No

Filter until date (YYYY-MM-DD)

Response (200 OK):


Get Event (GET /webhooks/events/{event_id})

Get details of a specific webhook event.

Authentication: API key required

Request:

Path Parameters:

Parameter
Type
Required
Description

event_id

string

✅ Yes

Event identifier

Response (200 OK):


Delivery Management

List Deliveries (GET /webhooks/endpoints/{endpoint_id}/deliveries)

List webhook deliveries for an endpoint.

Authentication: API key required

Request:

Path Parameters:

Parameter
Type
Required
Description

endpoint_id

string

✅ Yes

Endpoint identifier

Query Parameters:

Parameter
Type
Required
Description

from_date

string (date)

No

Filter from date

until_date

string (date)

No

Filter until date

Response (200 OK):

Response Fields:

Field
Type
Description

delivery_id

string

Unique delivery identifier

event_id

string

Associated event ID

endpoint_id

string

Target endpoint ID

delivery

string (datetime)

Delivery timestamp

request_method

string

HTTP method used

request_headers

object

Headers sent

request_body

object

Body sent

response_status

integer

HTTP response status

response_body

string

Response received

elapsed_time

number

Response time in seconds


Replay Delivery (POST /webhooks/deliveries/{delivery_id}/replay)

Replay a specific webhook delivery.

Authentication: API key required

Request:

Path Parameters:

Parameter
Type
Required
Description

delivery_id

string

✅ Yes

Delivery identifier

Response (200 OK):


Replay Failed Deliveries (POST /webhooks/endpoints/{endpoint_id}/replay-failed)

Replay all failed deliveries for an endpoint.

Authentication: API key required

Request:

Path Parameters:

Parameter
Type
Required
Description

endpoint_id

string

✅ Yes

Endpoint identifier

Response (200 OK):


Implementing Your Webhook Endpoint

Webhook Payload Format

Your endpoint will receive POST requests with the following format:

Headers:

Header
Description

Content-Type

application/json

X-Prosa-Signature

HMAC-SHA256 signature

X-Prosa-Event-UUID

Unique event identifier

X-Prosa-Event

Event type (e.g., stt.job.completed)

Example Payload (STT Job Completed):

Example Payload (TTS Job Completed):


Verifying Webhook Signatures

Always verify the X-Prosa-Signature header to ensure the webhook is authentic.

Python Example:

Node.js Example:


Response Requirements

Your webhook endpoint should:

  1. Return 2xx status within 30 seconds to acknowledge receipt

  2. Return 204 No Content for successful processing (recommended)

  3. Return 4xx/5xx if processing fails (will trigger retry)

Example Response:


Retry Policy

Failed webhook deliveries are retried with exponential backoff:

Attempt
Delay

1

Immediate

2

1 minute

3

5 minutes

4

30 minutes

5

2 hours

6+

Manual replay required

Last updated

Was this helpful?