Webhook endpoints
URLs that receive signed events.
https://sandbox-api.mysubbyapp.com/v1
POST
/webhook-endpointsCreate a webhook endpoint
Metered on successful live writeswebhooks:write
Request example
curl --request POST \
--url 'https://sandbox-api.mysubbyapp.com/v1/webhook-endpoints' \
--header 'Authorization: Bearer sk_test_YOUR_SECRET_KEY'Add a JSON body matching the request schema below and a Content-Type: application/json header.
Parameters
Idempotency-Keyheader · string Makes retries safe. Replays return the original response and are not metered.
Request body schema
{
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"url",
"enabled_events"
],
"properties": {
"url": {
"type": "string",
"format": "uri"
},
"description": {
"type": "string",
"maxLength": 200
},
"enabled_events": {
"type": "array",
"minItems": 1,
"items": {
"type": "string"
},
"example": [
"subscription.*",
"charge.failed"
]
}
}
}
}
}
}Responses
201 The endpoint, including `secret` (shown only in this response).
{
"application/json": {
"schema": {
"type": "object",
"properties": {
"success": {
"const": true
},
"data": {
"allOf": [
{
"type": "object",
"properties": {
"id": {
"type": "string",
"example": "we_1Lp4"
},
"object": {
"const": "webhook_endpoint"
},
"url": {
"type": "string",
"format": "uri"
},
"description": {
"type": [
"string",
"null"
]
},
"enabled_events": {
"type": "array",
"items": {
"type": "string"
}
},
"status": {
"type": "string",
"enum": [
"enabled",
"disabled"
]
},
"disabled_reason": {
"type": [
"string",
"null"
]
},
"livemode": {
"type": "boolean"
},
"created_at": {
"type": "string",
"format": "date-time"
}
}
},
{
"type": "object",
"properties": {
"secret": {
"type": "string",
"example": "whsec_4f9c..."
}
}
}
]
}
}
}
}
}400 Invalid request.
{
"application/json": {
"schema": {
"type": "object",
"required": [
"success",
"error"
],
"properties": {
"success": {
"const": false
},
"error": {
"type": "object",
"required": [
"type",
"code",
"message",
"request_id"
],
"properties": {
"type": {
"type": "string",
"enum": [
"authentication_error",
"permission_error",
"invalid_request_error",
"state_error",
"idempotency_error",
"rate_limit_error",
"api_error"
]
},
"code": {
"type": "string"
},
"message": {
"type": "string"
},
"param": {
"type": [
"string",
"null"
]
},
"request_id": {
"type": "string"
},
"doc_url": {
"type": "string",
"format": "uri"
}
}
}
}
}
}
}GET
/webhook-endpointsList webhook endpoints
Not meteredwebhooks:read
Request example
curl --request GET \
--url 'https://sandbox-api.mysubbyapp.com/v1/webhook-endpoints' \
--header 'Authorization: Bearer sk_test_YOUR_SECRET_KEY'Responses
200 Endpoints.
{
"application/json": {
"schema": {
"type": "object",
"properties": {
"success": {
"const": true
},
"data": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "string",
"example": "we_1Lp4"
},
"object": {
"const": "webhook_endpoint"
},
"url": {
"type": "string",
"format": "uri"
},
"description": {
"type": [
"string",
"null"
]
},
"enabled_events": {
"type": "array",
"items": {
"type": "string"
}
},
"status": {
"type": "string",
"enum": [
"enabled",
"disabled"
]
},
"disabled_reason": {
"type": [
"string",
"null"
]
},
"livemode": {
"type": "boolean"
},
"created_at": {
"type": "string",
"format": "date-time"
}
}
}
},
"meta": {
"type": "object",
"required": [
"has_more",
"limit"
],
"properties": {
"has_more": {
"type": "boolean"
},
"next_cursor": {
"type": [
"string",
"null"
]
},
"limit": {
"type": "integer"
}
}
}
}
}
}
}GET
/webhook-endpoints/{id}Retrieve a webhook endpoint
Not meteredwebhooks:read
Request example
curl --request GET \
--url 'https://sandbox-api.mysubbyapp.com/v1/webhook-endpoints/{id}' \
--header 'Authorization: Bearer sk_test_YOUR_SECRET_KEY'Parameters
idpath · string · requiredResponses
200 The endpoint.
{
"application/json": {
"schema": {
"type": "object",
"properties": {
"success": {
"const": true
},
"data": {
"type": "object",
"properties": {
"id": {
"type": "string",
"example": "we_1Lp4"
},
"object": {
"const": "webhook_endpoint"
},
"url": {
"type": "string",
"format": "uri"
},
"description": {
"type": [
"string",
"null"
]
},
"enabled_events": {
"type": "array",
"items": {
"type": "string"
}
},
"status": {
"type": "string",
"enum": [
"enabled",
"disabled"
]
},
"disabled_reason": {
"type": [
"string",
"null"
]
},
"livemode": {
"type": "boolean"
},
"created_at": {
"type": "string",
"format": "date-time"
}
}
}
}
}
}
}404 Object or route not found in this environment.
{
"application/json": {
"schema": {
"type": "object",
"required": [
"success",
"error"
],
"properties": {
"success": {
"const": false
},
"error": {
"type": "object",
"required": [
"type",
"code",
"message",
"request_id"
],
"properties": {
"type": {
"type": "string",
"enum": [
"authentication_error",
"permission_error",
"invalid_request_error",
"state_error",
"idempotency_error",
"rate_limit_error",
"api_error"
]
},
"code": {
"type": "string"
},
"message": {
"type": "string"
},
"param": {
"type": [
"string",
"null"
]
},
"request_id": {
"type": "string"
},
"doc_url": {
"type": "string",
"format": "uri"
}
}
}
}
}
}
}PATCH
/webhook-endpoints/{id}Update a webhook endpoint
Metered on successful live writeswebhooks:write
Request example
curl --request PATCH \
--url 'https://sandbox-api.mysubbyapp.com/v1/webhook-endpoints/{id}' \
--header 'Authorization: Bearer sk_test_YOUR_SECRET_KEY'Add a JSON body matching the request schema below and a Content-Type: application/json header.
Parameters
idpath · string · requiredRequest body schema
{
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"url": {
"type": "string",
"format": "uri"
},
"description": {
"type": "string"
},
"enabled_events": {
"type": "array",
"items": {
"type": "string"
}
},
"status": {
"type": "string",
"enum": [
"enabled",
"disabled"
]
}
}
}
}
}
}Responses
200 The updated endpoint.
{
"application/json": {
"schema": {
"type": "object",
"properties": {
"success": {
"const": true
},
"data": {
"type": "object",
"properties": {
"id": {
"type": "string",
"example": "we_1Lp4"
},
"object": {
"const": "webhook_endpoint"
},
"url": {
"type": "string",
"format": "uri"
},
"description": {
"type": [
"string",
"null"
]
},
"enabled_events": {
"type": "array",
"items": {
"type": "string"
}
},
"status": {
"type": "string",
"enum": [
"enabled",
"disabled"
]
},
"disabled_reason": {
"type": [
"string",
"null"
]
},
"livemode": {
"type": "boolean"
},
"created_at": {
"type": "string",
"format": "date-time"
}
}
}
}
}
}
}404 Object or route not found in this environment.
{
"application/json": {
"schema": {
"type": "object",
"required": [
"success",
"error"
],
"properties": {
"success": {
"const": false
},
"error": {
"type": "object",
"required": [
"type",
"code",
"message",
"request_id"
],
"properties": {
"type": {
"type": "string",
"enum": [
"authentication_error",
"permission_error",
"invalid_request_error",
"state_error",
"idempotency_error",
"rate_limit_error",
"api_error"
]
},
"code": {
"type": "string"
},
"message": {
"type": "string"
},
"param": {
"type": [
"string",
"null"
]
},
"request_id": {
"type": "string"
},
"doc_url": {
"type": "string",
"format": "uri"
}
}
}
}
}
}
}DELETE
/webhook-endpoints/{id}Delete a webhook endpoint
Metered on successful live writeswebhooks:write
Request example
curl --request DELETE \
--url 'https://sandbox-api.mysubbyapp.com/v1/webhook-endpoints/{id}' \
--header 'Authorization: Bearer sk_test_YOUR_SECRET_KEY'Parameters
idpath · string · requiredResponses
200 Deletion confirmation.
{
"application/json": {
"schema": {
"type": "object",
"properties": {
"success": {
"const": true
},
"data": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"object": {
"const": "webhook_endpoint"
},
"deleted": {
"const": true
}
}
}
}
}
}
}404 Object or route not found in this environment.
{
"application/json": {
"schema": {
"type": "object",
"required": [
"success",
"error"
],
"properties": {
"success": {
"const": false
},
"error": {
"type": "object",
"required": [
"type",
"code",
"message",
"request_id"
],
"properties": {
"type": {
"type": "string",
"enum": [
"authentication_error",
"permission_error",
"invalid_request_error",
"state_error",
"idempotency_error",
"rate_limit_error",
"api_error"
]
},
"code": {
"type": "string"
},
"message": {
"type": "string"
},
"param": {
"type": [
"string",
"null"
]
},
"request_id": {
"type": "string"
},
"doc_url": {
"type": "string",
"format": "uri"
}
}
}
}
}
}
}POST
/webhook-endpoints/{id}/testSend a test event
Metered on successful live writeswebhooks:write
Request example
curl --request POST \
--url 'https://sandbox-api.mysubbyapp.com/v1/webhook-endpoints/{id}/test' \
--header 'Authorization: Bearer sk_test_YOUR_SECRET_KEY'Parameters
idpath · string · requiredResponses
200 Delivery result.
{
"application/json": {
"schema": {
"type": "object",
"properties": {
"success": {
"const": true
},
"data": {
"type": "object",
"properties": {
"event": {
"type": "string"
},
"response_status": {
"type": [
"integer",
"null"
]
},
"duration_ms": {
"type": "integer"
},
"delivered": {
"type": "boolean"
}
}
}
}
}
}
}POST
/webhook-endpoints/{id}/roll-secretRoll the signing secret
The old secret keeps signing alongside the new one for 24 hours.
Metered on successful live writeswebhooks:write
Request example
curl --request POST \
--url 'https://sandbox-api.mysubbyapp.com/v1/webhook-endpoints/{id}/roll-secret' \
--header 'Authorization: Bearer sk_test_YOUR_SECRET_KEY'Parameters
idpath · string · requiredResponses
200 The endpoint with the new `secret`.
{
"application/json": {
"schema": {
"type": "object",
"properties": {
"success": {
"const": true
},
"data": {
"allOf": [
{
"type": "object",
"properties": {
"id": {
"type": "string",
"example": "we_1Lp4"
},
"object": {
"const": "webhook_endpoint"
},
"url": {
"type": "string",
"format": "uri"
},
"description": {
"type": [
"string",
"null"
]
},
"enabled_events": {
"type": "array",
"items": {
"type": "string"
}
},
"status": {
"type": "string",
"enum": [
"enabled",
"disabled"
]
},
"disabled_reason": {
"type": [
"string",
"null"
]
},
"livemode": {
"type": "boolean"
},
"created_at": {
"type": "string",
"format": "date-time"
}
}
},
{
"type": "object",
"properties": {
"secret": {
"type": "string"
},
"previous_secret_expires_at": {
"type": "string",
"format": "date-time"
}
}
}
]
}
}
}
}
}