Webhooks
Event notification endpoints
GET /webhooks List webhooks
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
page | query | integer | ||
per_page | query | integer |
Responses
200 Webhook list
| Property | Type | Required | Description | ||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
data | array<Webhook> | ||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||
pagination | Pagination | ||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||
401 Missing or invalid API key application/problem+json
| Property | Type | Required | Description |
|---|---|---|---|
type | stringformat: uri | required | |
title | string | required | |
status | integer | required | |
detail | stringnullable | ||
instance | stringnullable |
Request example
curl -X GET "https://api.ampr.dev/v1/webhooks" \
-H "Authorization: Bearer $AMPR_API_KEY" const res = await fetch('https://api.ampr.dev/v1/webhooks', {
method: 'GET',
headers: {
Authorization: `Bearer ${process.env.AMPR_API_KEY}`,
},
});
const data = await res.json(); Note
This endpoint requires an API key. Send it as a Bearer token in the Authorization header.
POST /webhooks Register a webhook endpoint
Request body
| Property | Type | Required | Description |
|---|---|---|---|
url | stringformat: uri | required | |
events | array<WebhookEventType> | required |
Responses
201 Webhook created (secret shown only on creation)
| Property | Type | Required | Description | ||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
data | Webhook | ||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||
401 Missing or invalid API key application/problem+json
| Property | Type | Required | Description |
|---|---|---|---|
type | stringformat: uri | required | |
title | string | required | |
status | integer | required | |
detail | stringnullable | ||
instance | stringnullable |
422 Request understood but cannot be processed (e.g., invalid state) application/problem+json
| Property | Type | Required | Description |
|---|---|---|---|
type | stringformat: uri | required | |
title | string | required | |
status | integer | required | |
detail | stringnullable | ||
instance | stringnullable |
Request example
curl -X POST "https://api.ampr.dev/v1/webhooks" \
-H "Authorization: Bearer $AMPR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"url": "string",
"events": [
"charger.connected"
]
}' const res = await fetch('https://api.ampr.dev/v1/webhooks', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.AMPR_API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"url": "string",
"events": [
"charger.connected"
]
}),
});
const data = await res.json(); Note
This endpoint requires an API key. Send it as a Bearer token in the Authorization header.
GET /webhooks/{webhook_id} Get webhook detail
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
webhook_id | path | string | required |
Responses
200 Webhook detail
| Property | Type | Required | Description | ||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
data | Webhook | ||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||
401 Missing or invalid API key application/problem+json
| Property | Type | Required | Description |
|---|---|---|---|
type | stringformat: uri | required | |
title | string | required | |
status | integer | required | |
detail | stringnullable | ||
instance | stringnullable |
404 Resource not found application/problem+json
| Property | Type | Required | Description |
|---|---|---|---|
type | stringformat: uri | required | |
title | string | required | |
status | integer | required | |
detail | stringnullable | ||
instance | stringnullable |
Request example
curl -X GET "https://api.ampr.dev/v1/webhooks/whk_example" \
-H "Authorization: Bearer $AMPR_API_KEY" const res = await fetch('https://api.ampr.dev/v1/webhooks/whk_example', {
method: 'GET',
headers: {
Authorization: `Bearer ${process.env.AMPR_API_KEY}`,
},
});
const data = await res.json(); Note
This endpoint requires an API key. Send it as a Bearer token in the Authorization header.
DELETE /webhooks/{webhook_id} Delete webhook
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
webhook_id | path | string | required |
Responses
204 Webhook deleted
401 Missing or invalid API key application/problem+json
| Property | Type | Required | Description |
|---|---|---|---|
type | stringformat: uri | required | |
title | string | required | |
status | integer | required | |
detail | stringnullable | ||
instance | stringnullable |
404 Resource not found application/problem+json
| Property | Type | Required | Description |
|---|---|---|---|
type | stringformat: uri | required | |
title | string | required | |
status | integer | required | |
detail | stringnullable | ||
instance | stringnullable |
Request example
curl -X DELETE "https://api.ampr.dev/v1/webhooks/whk_example" \
-H "Authorization: Bearer $AMPR_API_KEY" const res = await fetch('https://api.ampr.dev/v1/webhooks/whk_example', {
method: 'DELETE',
headers: {
Authorization: `Bearer ${process.env.AMPR_API_KEY}`,
},
});
const data = await res.json(); Note
This endpoint requires an API key. Send it as a Bearer token in the Authorization header.
PATCH /webhooks/{webhook_id} Update webhook
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
webhook_id | path | string | required |
Request body
| Property | Type | Required | Description |
|---|---|---|---|
url | stringformat: uri | ||
events | array<WebhookEventType> | ||
enabled | boolean |
Responses
200 Webhook updated
| Property | Type | Required | Description | ||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
data | Webhook | ||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||
401 Missing or invalid API key application/problem+json
| Property | Type | Required | Description |
|---|---|---|---|
type | stringformat: uri | required | |
title | string | required | |
status | integer | required | |
detail | stringnullable | ||
instance | stringnullable |
404 Resource not found application/problem+json
| Property | Type | Required | Description |
|---|---|---|---|
type | stringformat: uri | required | |
title | string | required | |
status | integer | required | |
detail | stringnullable | ||
instance | stringnullable |
Request example
curl -X PATCH "https://api.ampr.dev/v1/webhooks/whk_example" \
-H "Authorization: Bearer $AMPR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"url": "string",
"events": [
"charger.connected"
],
"enabled": true
}' const res = await fetch('https://api.ampr.dev/v1/webhooks/whk_example', {
method: 'PATCH',
headers: {
Authorization: `Bearer ${process.env.AMPR_API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"url": "string",
"events": [
"charger.connected"
],
"enabled": true
}),
});
const data = await res.json(); Note
This endpoint requires an API key. Send it as a Bearer token in the Authorization header.