Skip to content

Create a webhook

POST
/v1/webhooks
curl --request POST \
--url https://api.devsecure.io/v1/webhooks \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "url": "https://hooks.example.com/devsecure", "event_types": [ "scan.completed", "issue.created" ], "description": "Ticketing integration", "enabled": true }'

Subscribes an https endpoint to events. The response includes the signing secret, shown only once. Subscribing to an event type needs its read scope (see /v1/webhooks/event-types). The URL must be on a public host; private, loopback, link-local and metadata addresses are refused.

Idempotency-Key
string
<= 255 characters /^[A-Za-z0-9_\-:.]{1,255}$/

Makes the request safe to retry for 24 hours. Same key and same request: the first response is replayed. Same key, different request: 409 idempotency_conflict.

Media typeapplication/json
WebhookCreate
object
url
required
Url

An https URL on a public host. Redirects are not followed.

string
<= 2048 characters
event_types
required
Event Types
Array<string>
>= 1 items <= 32 items
description
Any of:
string
<= 500 characters
enabled
Enabled
boolean
default: true

Created.

Media typeapplication/json
WebhookWithSecret
object
id
required
Id
string format: uuid
url
required
Url
string
description
Any of:
string
event_types
required
Event Types
Array<string>
enabled
required
Enabled
boolean
disabled_reason
Any of:
string
Allowed values: endpoint_gone too_many_failures
previous_secret_expires_at
Any of:
string
created_at
required
Created At
string
updated_at
required
Updated At
string
last_delivery_at
Any of:
string
last_success_at
Any of:
string
secret
required
Any of:
string
Example
{
"url": "https://hooks.example.com/devsecure",
"disabled_reason": "endpoint_gone",
"secret": "whsec_EXAMPLE-not-a-real-secret-EXAMPLE-0000000000"
}
X-Request-ID
string

Identifies the request; quote it to support.

X-RateLimit-Limit
integer

Requests allowed per window.

X-RateLimit-Remaining
integer

Requests left in the window.

X-RateLimit-Reset
integer

Seconds until the window resets.

The request is not valid (validation_error, invalid_cursor).

Media typeapplication/json
ErrorEnvelope
object
error
required
ErrorBody
object
code
required
Code
string
message
required
Message
string
request_id
required
Any of:
string
details
Any of:
Array<object>
ErrorDetail
object
field
Any of:
string
message
required
Message
string
Example
{
"error": {
"code": "validation_error",
"message": "The request is not valid.",
"request_id": "req_3f0c2a9d5b6e4f7a8c1d2e3f4a5b6c7d"
}
}
X-Request-ID
string

Identifies the request; quote it to support.

Missing, unknown, expired or revoked credential (invalid_credentials).

Media typeapplication/json
ErrorEnvelope
object
error
required
ErrorBody
object
code
required
Code
string
message
required
Message
string
request_id
required
Any of:
string
details
Any of:
Array<object>
ErrorDetail
object
field
Any of:
string
message
required
Message
string
Example
{
"error": {
"code": "invalid_credentials",
"message": "The credential is missing, invalid, expired or revoked.",
"request_id": "req_3f0c2a9d5b6e4f7a8c1d2e3f4a5b6c7d"
}
}
X-Request-ID
string

Identifies the request; quote it to support.

The credential may not do this (insufficient_scope, permission_denied, plan_not_allowed, quota_exceeded, target_not_authorized).

Media typeapplication/json
ErrorEnvelope
object
error
required
ErrorBody
object
code
required
Code
string
message
required
Message
string
request_id
required
Any of:
string
details
Any of:
Array<object>
ErrorDetail
object
field
Any of:
string
message
required
Message
string
Example
{
"error": {
"code": "insufficient_scope",
"message": "The credential does not have the scope this operation needs.",
"request_id": "req_3f0c2a9d5b6e4f7a8c1d2e3f4a5b6c7d"
}
}
X-Request-ID
string

Identifies the request; quote it to support.

Conflicts with the current state or an earlier Idempotency-Key (conflict, idempotency_conflict).

Media typeapplication/json
ErrorEnvelope
object
error
required
ErrorBody
object
code
required
Code
string
message
required
Message
string
request_id
required
Any of:
string
details
Any of:
Array<object>
ErrorDetail
object
field
Any of:
string
message
required
Message
string
Example
{
"error": {
"code": "idempotency_conflict",
"message": "This Idempotency-Key was already used for a different request.",
"request_id": "req_3f0c2a9d5b6e4f7a8c1d2e3f4a5b6c7d"
}
}
X-Request-ID
string

Identifies the request; quote it to support.

Too many requests (rate_limited).

Media typeapplication/json
ErrorEnvelope
object
error
required
ErrorBody
object
code
required
Code
string
message
required
Message
string
request_id
required
Any of:
string
details
Any of:
Array<object>
ErrorDetail
object
field
Any of:
string
message
required
Message
string
Example
{
"error": {
"code": "rate_limited",
"message": "Too many requests. Retry after the time in Retry-After.",
"request_id": "req_3f0c2a9d5b6e4f7a8c1d2e3f4a5b6c7d"
}
}
X-Request-ID
string

Identifies the request; quote it to support.

X-RateLimit-Limit
integer

Requests allowed per window.

X-RateLimit-Remaining
integer

Requests left in the window.

X-RateLimit-Reset
integer

Seconds until the window resets.

Retry-After
integer

Seconds to wait before retrying.

Unexpected error (internal_error). Quote the request id to support.

Media typeapplication/json
ErrorEnvelope
object
error
required
ErrorBody
object
code
required
Code
string
message
required
Message
string
request_id
required
Any of:
string
details
Any of:
Array<object>
ErrorDetail
object
field
Any of:
string
message
required
Message
string
Example
{
"error": {
"code": "internal_error",
"message": "Something went wrong on our side.",
"request_id": "req_3f0c2a9d5b6e4f7a8c1d2e3f4a5b6c7d"
}
}
X-Request-ID
string

Identifies the request; quote it to support.