Skip to content

Send a test delivery

Viewing v2— current version

POST
/v2/workspaces/{workspace_id}/webhook-tests
curl --request POST \
--url https://api.app.layer.ai/api/v2/workspaces/:workspace_id/webhook-tests \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"webhook": {
"url": "<string>",
"events": [
"inference.completed"
],
"metadata": {}
}
}'

Unchanged from v1. This endpoint’s documented request and response schemas are identical in v1 and v2 — change the /v1 prefix to /v2. Schema equality is not a promise about behaviour, so keep your usual smoke tests.

POST a signed sample event to a URL and report what came back, synchronously. Use it to check reachability and your signature verification before spending Creative Units on a real run. The sample carries type inference.completed with an empty data object, and is signed exactly as a real delivery is.

Nothing is charged, and no run is created.

workspace_id
required
Workspace Id

Id of the workspace that owns the resource.

string format: uuid

Id of the workspace that owns the resource.

Idempotency-Key
string
<= 255 characters

Opaque key making a retry of this request return the first result. A 2xx response is replayed for 24 hours with Idempotent-Replayed: true. A 4xx releases the key. A 5xx, or a request still running, holds the key for 120 seconds, during which a retry gets 409; after that a retry executes again. The key covers the method, path, query, and byte-identical body it was first used with; reusing it for a different request is rejected with 422. Protection is best effort: if the key store is unavailable, or a record is lost early, a retry can execute again even after an earlier 409. See the Idempotency section of the API description.

Media typeapplication/json
WebhookTestRequest
object
webhook
required
WebhookInput

The endpoint to test. url and metadata are used; events is ignored.

object
url
required
Url

HTTPS URL that receives a POST when this request reaches a terminal state. Must be publicly reachable; must not redirect. Acknowledge with any 2xx within 10 seconds and do the work asynchronously. Reply 410 to stop delivery permanently.

string
<= 2048 characters
events
Events

Narrows what is delivered. Omit to receive every event this request can produce, which is what expected_events on the response lists.

Array<string>
nullable
Allowed values: inference.completed inference.failed inference.cancelled training.succeeded training.failed scoring_run.completed scoring_run.failed workflow_run.succeeded workflow_run.failed workflow_run.cancelled
metadata
Metadata

Opaque key/value pairs echoed back verbatim in every delivery, for correlating a callback with your own records. At most 10 keys and 1024 bytes in total.

object
key
additional properties
string

Successful Response

Media typeapplication/json
WebhookTestResponse
object
delivered
required
Delivered

Whether the receiver acknowledged with a 2xx.

boolean
response_status
Response Status

HTTP status the receiver returned, or null if it never responded.

integer
nullable
latency_ms
required
Latency Ms

How long the attempt took, end to end.

integer
error
Error

Why the attempt did not succeed, when it did not.

string
nullable
Examplegenerated
{
"delivered": true,
"response_status": 1,
"latency_ms": 1,
"error": "example"
}

Unauthenticated — missing or invalid Bearer token.

Media typeapplication/problem+json
object
type
required
string
title
required
string
status
required
integer
detail
required
string
Example
{
"type": "https://api.layer.ai/errors/ERROR_CODE",
"title": "Error Title",
"status": 400,
"detail": "Human-readable description."
}

Forbidden — insufficient permissions, or the access token lacks the scope the operation requires.

Media typeapplication/problem+json
object
type
required
string
title
required
string
status
required
integer
detail
required
string
Example
{
"type": "https://api.layer.ai/errors/ERROR_CODE",
"title": "Error Title",
"status": 400,
"detail": "Human-readable description."
}

Resource not found.

Media typeapplication/problem+json
object
type
required
string
title
required
string
status
required
integer
detail
required
string
Example
{
"type": "https://api.layer.ai/errors/ERROR_CODE",
"title": "Error Title",
"status": 400,
"detail": "Human-readable description."
}

The outcome of the request with this Idempotency-Key is not known yet: it is still running, or it failed without a stored response. Retry after the number of seconds in Retry-After.

Media typeapplication/problem+json
object
type
required
string
title
required
string
status
required
integer
detail
required
string
Example
{
"type": "https://api.layer.ai/errors/ERROR_CODE",
"title": "Error Title",
"status": 400,
"detail": "Human-readable description."
}

Invalid input parameters, or an Idempotency-Key reused for a different request.

Media typeapplication/problem+json
object
type
required
string
title
required
string
status
required
integer
detail
required
string
Example
{
"type": "https://api.layer.ai/errors/ERROR_CODE",
"title": "Error Title",
"status": 400,
"detail": "Human-readable description."
}

Rate limited — retry after the number of seconds in Retry-After.

Media typeapplication/problem+json
object
type
required
string
title
required
string
status
required
integer
detail
required
string
Example
{
"type": "https://api.layer.ai/errors/ERROR_CODE",
"title": "Error Title",
"status": 400,
"detail": "Human-readable description."
}

Internal server error.

Media typeapplication/problem+json
object
type
required
string
title
required
string
status
required
integer
detail
required
string
Example
{
"type": "https://api.layer.ai/errors/ERROR_CODE",
"title": "Error Title",
"status": 400,
"detail": "Human-readable description."
}