Skip to main content

Create Endpoint

POST /v1/webhooks/endpoints

Register a URL to receive your account's events as signed POST requests. The response contains the endpoint's signing secret; it is shown only here and after a rotate, so store it. The endpoint starts as pending_verification and gets no events until POST /v1/webhooks/endpoints/{endpoint_id}/verify succeeds. event_patterns accepts exact event types (see GET /v1/audit/catalog), prefixes such as vm.*, or *; omit it for the default set. The URL must resolve to a public address. Deliveries are at least once: a delivery can repeat (same InstaVM-Event-Id header), and a VM can report vm.terminated more than once, so handle both as safe to receive twice.

Authentication​

Requires authentication via: OAuth2PasswordBearer.

Parameters​

NameInTypeRequiredDescriptionConstraints
X-API-Keyheaderstring | nullNonullable

Request Body​

Required: Yes

application/json​

Resolved schema:

{
"properties": {
"url": {
"type": "string",
"title": "Url"
},
"description": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Description"
},
"event_patterns": {
"anyOf": [
{
"items": {
"type": "string"
},
"type": "array"
},
{
"type": "null"
}
],
"title": "Event Patterns"
},
"timeout_seconds": {
"type": "integer",
"maximum": 60,
"minimum": 3,
"title": "Timeout Seconds",
"default": 10
},
"max_retries": {
"type": "integer",
"maximum": 7,
"minimum": 1,
"title": "Max Retries",
"default": 7
}
},
"type": "object",
"required": [
"url"
],
"title": "WebhookEndpointCreateRequest"
}

Field details:

FieldTypeRequiredDescriptionConstraints
urlstringYes
descriptionstring | nullNonullable
event_patternsarray<string> | nullNonullable
event_patterns[]stringNo
timeout_secondsintegerNodefault=10, min=3, max=60
max_retriesintegerNodefault=7, min=1, max=7

Responses​

200​

Successful Response

application/json​

Resolved schema:

{
"properties": {
"endpoint": {
"properties": {
"id": {
"type": "string",
"title": "Id"
},
"user_id": {
"type": "integer",
"title": "User Id"
},
"url": {
"type": "string",
"title": "Url"
},
"description": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Description"
},
"status": {
"type": "string",
"title": "Status"
},
"enabled": {
"type": "boolean",
"title": "Enabled"
},
"subscribed_event_patterns": {
"items": {
"type": "string"
},
"type": "array",
"title": "Subscribed Event Patterns"
},
"signing_version": {
"type": "string",
"title": "Signing Version"
},
"secret_hint": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Secret Hint"
},
"timeout_seconds": {
"type": "integer",
"title": "Timeout Seconds"
},
"max_retries": {
"type": "integer",
"title": "Max Retries"
},
"consecutive_failures": {
"type": "integer",
"title": "Consecutive Failures"
},
"last_verified_at": {
"anyOf": [
{
"type": "string",
"format": "date-time"
},
{
"type": "null"
}
],
"title": "Last Verified At"
},
"last_delivery_at": {
"anyOf": [
{
"type": "string",
"format": "date-time"
},
{
"type": "null"
}
],
"title": "Last Delivery At"
},
"last_error": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Last Error"
},
"created_at": {
"type": "string",
"format": "date-time",
"title": "Created At"
},
"updated_at": {
"type": "string",
"format": "date-time",
"title": "Updated At"
}
},
"type": "object",
"required": [
"id",
"user_id",
"url",
"status",
"enabled",
"signing_version",
"timeout_seconds",
"max_retries",
"consecutive_failures",
"created_at",
"updated_at"
],
"title": "WebhookEndpointResponse"
},
"secret": {
"type": "string",
"title": "Secret"
}
},
"type": "object",
"required": [
"endpoint",
"secret"
],
"title": "WebhookEndpointCreateResponse"
}

Field details:

FieldTypeRequiredDescriptionConstraints
endpointobjectYes
endpoint.idstringYes
endpoint.user_idintegerYes
endpoint.urlstringYes
endpoint.descriptionstring | nullNonullable
endpoint.statusstringYes
endpoint.enabledbooleanYes
endpoint.subscribed_event_patternsarray<string>No
endpoint.subscribed_event_patterns[]stringNo
endpoint.signing_versionstringYes
endpoint.secret_hintstring | nullNonullable
endpoint.timeout_secondsintegerYes
endpoint.max_retriesintegerYes
endpoint.consecutive_failuresintegerYes
endpoint.last_verified_atstring | nullNoformat=date-time, nullable
endpoint.last_delivery_atstring | nullNoformat=date-time, nullable
endpoint.last_errorstring | nullNonullable
endpoint.created_atstringYesformat=date-time
endpoint.updated_atstringYesformat=date-time
secretstringYes

400​

The URL is not http(s), is longer than 2048 characters, does not resolve, or resolves to a private, loopback or other non-public address. Or the server cannot encrypt the signing secret.

No response body.

401​

No credentials, or the Bearer token / X-API-Key is invalid.

No response body.

403​

The account is disabled, or a guest token was used.

No response body.

422​

Validation Error

application/json​

Resolved schema:

{
"properties": {
"detail": {
"items": {
"properties": {
"loc": {
"items": {
"anyOf": [
{
"type": "string"
},
{
"type": "integer"
}
]
},
"type": "array",
"title": "Location"
},
"msg": {
"type": "string",
"title": "Message"
},
"type": {
"type": "string",
"title": "Error Type"
}
},
"type": "object",
"required": [
"loc",
"msg",
"type"
],
"title": "ValidationError"
},
"type": "array",
"title": "Detail"
}
},
"type": "object",
"title": "HTTPValidationError"
}

Field details:

FieldTypeRequiredDescriptionConstraints
detailarray<object>No
detail[]objectNo
detail[].locarray<string | integer>No
detail[].loc[]string | integerNo
detail[].msgstringNo
detail[].typestringNo