Skip to content

Test an event subscription

POST
https://api.getsitecontrol.com/v1/sites/{site_id}/event-subscriptions/{event_subscription_id}/test
curl --request POST \
--url https://api.getsitecontrol.com/v1/sites/1/event-subscriptions/1/test \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "event_type": "example" }'

Sends a sample event to the receiver for real: signed, through the same queue as live events, once and without retries. Waits up to 20 seconds for the answer. Call it after creating or changing an event subscription to check the receiver end to end. Works on an inactive event subscription too. Returns the sample kind and the delivery with its attempts: the receiver’s status code and the first 16 KB of its answer. 200 when the delivery finished; 202 with the same body, status: pending and the Location of the delivery otherwise: read it later with get_event_subscription_delivery.

The sample is chosen as in preview_event_subscription. A template that fails on the sample gives a failed delivery with outcome invalid_request. Tests are listed in the journal with is_test: true, do not change last_success_at or last_failure_at and cannot be redelivered. Needs edit. Spends the heavy request limit.

FieldDescription
site_id
required
Site Id
integer
event_subscription_id
required
Event Subscription Id

Event subscription id from list_event_subscriptions

integer
>= 1 < 9223372036854776000

Event subscription id from list_event_subscriptions

FieldDescription
Idempotency-Key
Idempotency-Key

Makes a retry of a POST safe: a repeat with the same key, body and GSC-Version returns the stored response with Idempotency-Replayed: true instead of running again. The key protects against repeated execution while the key store works. Saving the change and storing the response under the key are not atomic: if the process or the key store fails between them, the change is kept, the key is released after 15 minutes and a retry runs the request again. After a timeout or a 5xx, read the resource to check the result before retrying. 5xx and 429 responses and responses over 256 KB are not stored, so a repeat runs the request again. A key is kept for 24 hours. The same key with another body or version is 422; a repeat while the first request runs is 409.

string
>= 1 characters <= 128 characters /^[A-Za-z0-9_-]+$/

Makes a retry of a POST safe: a repeat with the same key, body and GSC-Version returns the stored response with Idempotency-Replayed: true instead of running again. The key protects against repeated execution while the key store works. Saving the change and storing the response under the key are not atomic: if the process or the key store fails between them, the change is kept, the key is released after 15 minutes and a retry runs the request again. After a timeout or a 5xx, read the resource to check the result before retrying. 5xx and 429 responses and responses over 256 KB are not stored, so a repeat runs the request again. A key is kept for 24 hours. The same key with another body or version is 422; a repeat while the first request runs is 409.

Media typeapplication/json
EventTypeChoice
object
FieldDescription
event_type
Event Type

The event to use, one of the event subscription’s events; the first when left out

string
nullable

Example · Generated

{
"event_type": "example"
}

Successful Response

Media typeapplication/json
EventSubscriptionTestResult
object
FieldDescription
sample
required
Sample

Where the sample comes from. last_response: the latest response of the filtered widgets within 30 days; last_contact: the latest contact within 30 days; synthetic: made up, from the widget’s fields for a response. More values may appear

string
delivery
required
EventSubscriptionDeliveryDetail
object
FieldDescription
id
required
Id

Delivery id, sent as the webhook-id header: the same on every retry, new on a redelivery

string format: uuid
event_id
required
Event Id

id of the event in the payload: the same for every event subscription and every redelivery of the event

string
event_type
Event Type

Null once the event is purged

string
nullable
is_test
required
Is Test

True for a delivery of test_event_subscription

boolean
status
required
EventSubscriptionDeliveryStatus

Pending: waiting for an attempt or being sent; succeeded: accepted by the receiver; failed: given up, see outcome; cancelled: dropped before sending because the event subscription was deleted, switched off or saved since, or its URL host changed.

string
Allowed values: pending succeeded failed cancelled
outcome
Outcome

How a finished delivery ended. accepted: the receiver answered 2xx, 302 or 303, which is not proof it processed the event; rejected: another 4xx, or 301, 307, 308 and other 3xx (the receiver moved, see the attempt’s location), not retried; gone: 410; retry_exhausted: every retry failed; expired: no time left for a retry; rate_limited: the receiver’s 429 pause ran past the deadline; invalid_request: the request could not be built, e.g. a template failed on the event (last_error says why); private_network_block: the host resolved to a private address; cancelled: see status. More values may appear

string
nullable
attempts
required
Attempts

Requests sent so far

integer
status_code
Status Code

HTTP status of the last attempt’s answer; null without an answer

integer
nullable
last_error
Last Error

What went wrong last, e.g. HTTP 500 or render failed: ...

string
nullable
created_at
required
Created At
string format: date-time
next_attempt_at
Next Attempt At

When the next attempt is due; null once finished

string format: date-time
nullable
completed_at
Completed At

When it finished; null while pending

string format: date-time
nullable
redelivery_of
Redelivery Of

The delivery this one redelivers

string format: uuid
nullable
request
Request

The request as stored, masked

object
FieldDescription
method
required
Method
string
url
required
Url

With placeholders filled; in the journal query values read ***

string
content_type
Content Type

Content-Type sent

string
nullable
headers
required
Headers

Headers set on the event subscription; secret ones read ***, and in the journal Authorization and Cookie too. The webhook-* signature headers are added when sending

object
FieldDescription
key
additional properties
string
body
Body

The body as sent, as text

string
nullable
attempt_history
required
Attempt History

Every attempt, the first one first

Array<object>
EventSubscriptionDeliveryAttempt
object
FieldDescription
number
required
Number

1 for the first request of a delivery

integer
started_at
required
Started At
string format: date-time
finished_at
Finished At
string format: date-time
nullable
duration_ms
Duration Ms
integer
nullable
outcome
Outcome

Accepted: 2xx, 302 or 303; retryable: 408, 5xx, a timeout or a network error, may be tried again; rate_limited: 429; rejected: another 4xx, or 301, 307, 308 and other 3xx; gone: 410. More values may appear

string
nullable
status_code
Status Code

HTTP status of the receiver’s answer; null without an answer

integer
nullable
response_content_type
Response Content Type
string
nullable
response_body
Response Body

The first 16 KB of the receiver’s answer

string
nullable
is_response_truncated
required
Is Response Truncated

True when the answer was longer than response_body

boolean
retry_after
Retry After

The receiver’s Retry-After header, honoured for the next try

string
nullable
location
Location

The receiver’s Location header; redirects are not followed

string
nullable
error
Error

What went wrong, e.g. HTTP 500 or a network error

string
nullable

Example

{
"delivery": {
"status": "pending"
}
}
FieldDescription
GSC-Version
string

API version the response was produced for

X-Request-Id
string

Request id, echoed from the request when valid

X-RateLimit-Limit
integer

Limit of the tightest bucket

X-RateLimit-Remaining
integer

Requests left in its window

X-RateLimit-Reset
integer

End of its window, epoch seconds

Idempotency-Replayed
string

True when the response is a stored one, replayed

The receiver has not answered yet

Media typeapplication/json
EventSubscriptionTestResult
object
FieldDescription
sample
required
Sample

Where the sample comes from. last_response: the latest response of the filtered widgets within 30 days; last_contact: the latest contact within 30 days; synthetic: made up, from the widget’s fields for a response. More values may appear

string
delivery
required
EventSubscriptionDeliveryDetail
object
FieldDescription
id
required
Id

Delivery id, sent as the webhook-id header: the same on every retry, new on a redelivery

string format: uuid
event_id
required
Event Id

id of the event in the payload: the same for every event subscription and every redelivery of the event

string
event_type
Event Type

Null once the event is purged

string
nullable
is_test
required
Is Test

True for a delivery of test_event_subscription

boolean
status
required
EventSubscriptionDeliveryStatus

Pending: waiting for an attempt or being sent; succeeded: accepted by the receiver; failed: given up, see outcome; cancelled: dropped before sending because the event subscription was deleted, switched off or saved since, or its URL host changed.

string
Allowed values: pending succeeded failed cancelled
outcome
Outcome

How a finished delivery ended. accepted: the receiver answered 2xx, 302 or 303, which is not proof it processed the event; rejected: another 4xx, or 301, 307, 308 and other 3xx (the receiver moved, see the attempt’s location), not retried; gone: 410; retry_exhausted: every retry failed; expired: no time left for a retry; rate_limited: the receiver’s 429 pause ran past the deadline; invalid_request: the request could not be built, e.g. a template failed on the event (last_error says why); private_network_block: the host resolved to a private address; cancelled: see status. More values may appear

string
nullable
attempts
required
Attempts

Requests sent so far

integer
status_code
Status Code

HTTP status of the last attempt’s answer; null without an answer

integer
nullable
last_error
Last Error

What went wrong last, e.g. HTTP 500 or render failed: ...

string
nullable
created_at
required
Created At
string format: date-time
next_attempt_at
Next Attempt At

When the next attempt is due; null once finished

string format: date-time
nullable
completed_at
Completed At

When it finished; null while pending

string format: date-time
nullable
redelivery_of
Redelivery Of

The delivery this one redelivers

string format: uuid
nullable
request
Request

The request as stored, masked

object
FieldDescription
method
required
Method
string
url
required
Url

With placeholders filled; in the journal query values read ***

string
content_type
Content Type

Content-Type sent

string
nullable
headers
required
Headers

Headers set on the event subscription; secret ones read ***, and in the journal Authorization and Cookie too. The webhook-* signature headers are added when sending

object
FieldDescription
key
additional properties
string
body
Body

The body as sent, as text

string
nullable
attempt_history
required
Attempt History

Every attempt, the first one first

Array<object>
EventSubscriptionDeliveryAttempt
object
FieldDescription
number
required
Number

1 for the first request of a delivery

integer
started_at
required
Started At
string format: date-time
finished_at
Finished At
string format: date-time
nullable
duration_ms
Duration Ms
integer
nullable
outcome
Outcome

Accepted: 2xx, 302 or 303; retryable: 408, 5xx, a timeout or a network error, may be tried again; rate_limited: 429; rejected: another 4xx, or 301, 307, 308 and other 3xx; gone: 410. More values may appear

string
nullable
status_code
Status Code

HTTP status of the receiver’s answer; null without an answer

integer
nullable
response_content_type
Response Content Type
string
nullable
response_body
Response Body

The first 16 KB of the receiver’s answer

string
nullable
is_response_truncated
required
Is Response Truncated

True when the answer was longer than response_body

boolean
retry_after
Retry After

The receiver’s Retry-After header, honoured for the next try

string
nullable
location
Location

The receiver’s Location header; redirects are not followed

string
nullable
error
Error

What went wrong, e.g. HTTP 500 or a network error

string
nullable

Example

{
"delivery": {
"status": "pending"
}
}
FieldDescription
GSC-Version
string

API version the response was produced for

X-Request-Id
string

Request id, echoed from the request when valid

X-RateLimit-Limit
integer

Limit of the tightest bucket

X-RateLimit-Remaining
integer

Requests left in its window

X-RateLimit-Reset
integer

End of its window, epoch seconds

Idempotency-Replayed
string

True when the response is a stored one, replayed

Location
string

The delivery to read later

Unsupported GSC-Version

Media typeapplication/problem+json
Problem

The documented shape of every error body on the versioned surface.

object
FieldDescription
type
required
Type
string
title
required
Title
string
status
required
Status
integer
detail
Detail
string
nullable
instance
required
Instance
string
reason
Reason
string
nullable
next
Next
string
nullable
request_id
required
Request Id
string
errors
Errors
Array<object>
nullable
ValidationIssue
object
FieldDescription
loc
required
Loc
Array
msg
required
Msg
string
type
required
Type
string
metadata
Metadata
object

Example · Generated

{
"type": "example",
"title": "example",
"status": 1,
"detail": "example",
"instance": "example",
"reason": "example",
"next": "example",
"request_id": "example",
"errors": [
{
"loc": [
"example"
],
"msg": "example",
"type": "example"
}
],
"metadata": {}
}
FieldDescription
GSC-Version
string

API version the response was produced for

X-Request-Id
string

Request id, echoed from the request when valid

X-RateLimit-Limit
integer

Limit of the tightest bucket

X-RateLimit-Remaining
integer

Requests left in its window

X-RateLimit-Reset
integer

End of its window, epoch seconds

Missing or invalid API key or access token

Media typeapplication/problem+json
Problem

The documented shape of every error body on the versioned surface.

object
FieldDescription
type
required
Type
string
title
required
Title
string
status
required
Status
integer
detail
Detail
string
nullable
instance
required
Instance
string
reason
Reason
string
nullable
next
Next
string
nullable
request_id
required
Request Id
string
errors
Errors
Array<object>
nullable
ValidationIssue
object
FieldDescription
loc
required
Loc
Array
msg
required
Msg
string
type
required
Type
string
metadata
Metadata
object

Example · Generated

{
"type": "example",
"title": "example",
"status": 1,
"detail": "example",
"instance": "example",
"reason": "example",
"next": "example",
"request_id": "example",
"errors": [
{
"loc": [
"example"
],
"msg": "example",
"type": "example"
}
],
"metadata": {}
}
FieldDescription
GSC-Version
string

API version the response was produced for

X-Request-Id
string

Request id, echoed from the request when valid

X-RateLimit-Limit
integer

Limit of the tightest bucket

X-RateLimit-Remaining
integer

Requests left in its window

X-RateLimit-Reset
integer

End of its window, epoch seconds

WWW-Authenticate
string

Authentication scheme: Bearer

Access denied

Media typeapplication/problem+json
Problem

The documented shape of every error body on the versioned surface.

object
FieldDescription
type
required
Type
string
title
required
Title
string
status
required
Status
integer
detail
Detail
string
nullable
instance
required
Instance
string
reason
Reason
string
nullable
next
Next
string
nullable
request_id
required
Request Id
string
errors
Errors
Array<object>
nullable
ValidationIssue
object
FieldDescription
loc
required
Loc
Array
msg
required
Msg
string
type
required
Type
string
metadata
Metadata
object

Example · Generated

{
"type": "example",
"title": "example",
"status": 1,
"detail": "example",
"instance": "example",
"reason": "example",
"next": "example",
"request_id": "example",
"errors": [
{
"loc": [
"example"
],
"msg": "example",
"type": "example"
}
],
"metadata": {}
}
FieldDescription
GSC-Version
string

API version the response was produced for

X-Request-Id
string

Request id, echoed from the request when valid

X-RateLimit-Limit
integer

Limit of the tightest bucket

X-RateLimit-Remaining
integer

Requests left in its window

X-RateLimit-Reset
integer

End of its window, epoch seconds

Media typeapplication/problem+json

event_subscription_not_found: no event subscription with this id on the site; site_not_found: no such site

Problem

The documented shape of every error body on the versioned surface.

object
FieldDescription
type
required
Type
string
title
required
Title
string
status
required
Status
integer
detail
Detail
string
nullable
instance
required
Instance
string
reason
Reason
string
nullable
next
Next
string
nullable
request_id
required
Request Id
string
errors
Errors
Array<object>
nullable
ValidationIssue
object
FieldDescription
loc
required
Loc
Array
msg
required
Msg
string
type
required
Type
string
metadata
Metadata
object

Example · Generated

{
"type": "example",
"title": "example",
"status": 1,
"detail": "example",
"instance": "example",
"reason": "example",
"next": "example",
"request_id": "example",
"errors": [
{
"loc": [
"example"
],
"msg": "example",
"type": "example"
}
],
"metadata": {}
}
FieldDescription
GSC-Version
string

API version the response was produced for

X-Request-Id
string

Request id, echoed from the request when valid

X-RateLimit-Limit
integer

Limit of the tightest bucket

X-RateLimit-Remaining
integer

Requests left in its window

X-RateLimit-Reset
integer

End of its window, epoch seconds

Conflict

Media typeapplication/problem+json
Problem

The documented shape of every error body on the versioned surface.

object
FieldDescription
type
required
Type
string
title
required
Title
string
status
required
Status
integer
detail
Detail
string
nullable
instance
required
Instance
string
reason
Reason
string
nullable
next
Next
string
nullable
request_id
required
Request Id
string
errors
Errors
Array<object>
nullable
ValidationIssue
object
FieldDescription
loc
required
Loc
Array
msg
required
Msg
string
type
required
Type
string
metadata
Metadata
object

Example · Generated

{
"type": "example",
"title": "example",
"status": 1,
"detail": "example",
"instance": "example",
"reason": "example",
"next": "example",
"request_id": "example",
"errors": [
{
"loc": [
"example"
],
"msg": "example",
"type": "example"
}
],
"metadata": {}
}
FieldDescription
GSC-Version
string

API version the response was produced for

X-Request-Id
string

Request id, echoed from the request when valid

X-RateLimit-Limit
integer

Limit of the tightest bucket

X-RateLimit-Remaining
integer

Requests left in its window

X-RateLimit-Reset
integer

End of its window, epoch seconds

Request body too large

Media typeapplication/problem+json
Problem

The documented shape of every error body on the versioned surface.

object
FieldDescription
type
required
Type
string
title
required
Title
string
status
required
Status
integer
detail
Detail
string
nullable
instance
required
Instance
string
reason
Reason
string
nullable
next
Next
string
nullable
request_id
required
Request Id
string
errors
Errors
Array<object>
nullable
ValidationIssue
object
FieldDescription
loc
required
Loc
Array
msg
required
Msg
string
type
required
Type
string
metadata
Metadata
object

Example · Generated

{
"type": "example",
"title": "example",
"status": 1,
"detail": "example",
"instance": "example",
"reason": "example",
"next": "example",
"request_id": "example",
"errors": [
{
"loc": [
"example"
],
"msg": "example",
"type": "example"
}
],
"metadata": {}
}
FieldDescription
GSC-Version
string

API version the response was produced for

X-Request-Id
string

Request id, echoed from the request when valid

X-RateLimit-Limit
integer

Limit of the tightest bucket

X-RateLimit-Remaining
integer

Requests left in its window

X-RateLimit-Reset
integer

End of its window, epoch seconds

validation_failed: event_type is not one of the event subscription’s events

Media typeapplication/problem+json
Problem

The documented shape of every error body on the versioned surface.

object
FieldDescription
type
required
Type
string
title
required
Title
string
status
required
Status
integer
detail
Detail
string
nullable
instance
required
Instance
string
reason
Reason
string
nullable
next
Next
string
nullable
request_id
required
Request Id
string
errors
Errors
Array<object>
nullable
ValidationIssue
object
FieldDescription
loc
required
Loc
Array
msg
required
Msg
string
type
required
Type
string
metadata
Metadata
object

Example · Generated

{
"type": "example",
"title": "example",
"status": 1,
"detail": "example",
"instance": "example",
"reason": "example",
"next": "example",
"request_id": "example",
"errors": [
{
"loc": [
"example"
],
"msg": "example",
"type": "example"
}
],
"metadata": {}
}
FieldDescription
GSC-Version
string

API version the response was produced for

X-Request-Id
string

Request id, echoed from the request when valid

X-RateLimit-Limit
integer

Limit of the tightest bucket

X-RateLimit-Remaining
integer

Requests left in its window

X-RateLimit-Reset
integer

End of its window, epoch seconds

Rate limited

Media typeapplication/problem+json
Problem

The documented shape of every error body on the versioned surface.

object
FieldDescription
type
required
Type
string
title
required
Title
string
status
required
Status
integer
detail
Detail
string
nullable
instance
required
Instance
string
reason
Reason
string
nullable
next
Next
string
nullable
request_id
required
Request Id
string
errors
Errors
Array<object>
nullable
ValidationIssue
object
FieldDescription
loc
required
Loc
Array
msg
required
Msg
string
type
required
Type
string
metadata
Metadata
object

Example · Generated

{
"type": "example",
"title": "example",
"status": 1,
"detail": "example",
"instance": "example",
"reason": "example",
"next": "example",
"request_id": "example",
"errors": [
{
"loc": [
"example"
],
"msg": "example",
"type": "example"
}
],
"metadata": {}
}
FieldDescription
GSC-Version
string

API version the response was produced for

X-Request-Id
string

Request id, echoed from the request when valid

X-RateLimit-Limit
integer

Limit of the tightest bucket

X-RateLimit-Remaining
integer

Requests left in its window

X-RateLimit-Reset
integer

End of its window, epoch seconds

Retry-After
integer

Seconds until the bucket refills

Temporarily unavailable; retry later

Media typeapplication/problem+json
Problem

The documented shape of every error body on the versioned surface.

object
FieldDescription
type
required
Type
string
title
required
Title
string
status
required
Status
integer
detail
Detail
string
nullable
instance
required
Instance
string
reason
Reason
string
nullable
next
Next
string
nullable
request_id
required
Request Id
string
errors
Errors
Array<object>
nullable
ValidationIssue
object
FieldDescription
loc
required
Loc
Array
msg
required
Msg
string
type
required
Type
string
metadata
Metadata
object

Example · Generated

{
"type": "example",
"title": "example",
"status": 1,
"detail": "example",
"instance": "example",
"reason": "example",
"next": "example",
"request_id": "example",
"errors": [
{
"loc": [
"example"
],
"msg": "example",
"type": "example"
}
],
"metadata": {}
}
FieldDescription
GSC-Version
string

API version the response was produced for

X-Request-Id
string

Request id, echoed from the request when valid

X-RateLimit-Limit
integer

Limit of the tightest bucket

X-RateLimit-Remaining
integer

Requests left in its window

X-RateLimit-Reset
integer

End of its window, epoch seconds