curl --request POST \
--url https://api.bachs.io/v1/webhooks/replay \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"event_id": "evt_3ab4e0d5d27445cf8a52ab3d8cb8f0b1"
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({event_id: 'evt_3ab4e0d5d27445cf8a52ab3d8cb8f0b1'})
};
fetch('https://api.bachs.io/v1/webhooks/replay', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.bachs.io/v1/webhooks/replay"
payload = { "event_id": "evt_3ab4e0d5d27445cf8a52ab3d8cb8f0b1" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.bachs.io/v1/webhooks/replay"
payload := strings.NewReader("{\n \"event_id\": \"evt_3ab4e0d5d27445cf8a52ab3d8cb8f0b1\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"event_id": "evt_3ab4e0d5d27445cf8a52ab3d8cb8f0b1",
"attempt_id": "wha_6f1e40f6bdf84c1980e1e1f6407f3f8a",
"attempt_no": 3,
"event_type": "collection.failed"
}{
"detail": "Invalid request parameters",
"error_code": "VALIDATION_ERROR",
"errors": [
{
"field": "amount",
"message": "Amount must be a positive decimal string",
"type": "value_error"
}
]
}{
"detail": "Invalid API key",
"error_code": "UNAUTHORIZED"
}{
"detail": "API key does not have permission for this operation",
"error_code": "FORBIDDEN"
}{
"detail": "Resource not found",
"error_code": "NOT_FOUND"
}{
"detail": "Rate limit exceeded. Please retry after a few seconds.",
"error_code": "TOO_MANY_REQUESTS"
}{
"detail": "An unexpected error occurred. Please try again later.",
"error_code": "INTERNAL_SERVER_ERROR"
}Replay a webhook event
Replay a previously generated webhook event by creating a new outbound delivery attempt. Use this when your endpoint missed or rejected an earlier delivery and you need Bachs to send that event again.
Common errors:
400 BAD_REQUEST: No supported lookup field was provided. Resolution: provide at least one ofevent_id,charge_id, orreference.401 UNAUTHORIZED: Authorization is missing, invalid, or revoked. Resolution: send a valid bearer credential.404 NOT_FOUND: No matching webhook event could be resolved for your lookup values. Resolution: verify IDs/references and retry.
curl --request POST \
--url https://api.bachs.io/v1/webhooks/replay \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"event_id": "evt_3ab4e0d5d27445cf8a52ab3d8cb8f0b1"
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({event_id: 'evt_3ab4e0d5d27445cf8a52ab3d8cb8f0b1'})
};
fetch('https://api.bachs.io/v1/webhooks/replay', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.bachs.io/v1/webhooks/replay"
payload = { "event_id": "evt_3ab4e0d5d27445cf8a52ab3d8cb8f0b1" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.bachs.io/v1/webhooks/replay"
payload := strings.NewReader("{\n \"event_id\": \"evt_3ab4e0d5d27445cf8a52ab3d8cb8f0b1\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"event_id": "evt_3ab4e0d5d27445cf8a52ab3d8cb8f0b1",
"attempt_id": "wha_6f1e40f6bdf84c1980e1e1f6407f3f8a",
"attempt_no": 3,
"event_type": "collection.failed"
}{
"detail": "Invalid request parameters",
"error_code": "VALIDATION_ERROR",
"errors": [
{
"field": "amount",
"message": "Amount must be a positive decimal string",
"type": "value_error"
}
]
}{
"detail": "Invalid API key",
"error_code": "UNAUTHORIZED"
}{
"detail": "API key does not have permission for this operation",
"error_code": "FORBIDDEN"
}{
"detail": "Resource not found",
"error_code": "NOT_FOUND"
}{
"detail": "Rate limit exceeded. Please retry after a few seconds.",
"error_code": "TOO_MANY_REQUESTS"
}{
"detail": "An unexpected error occurred. Please try again later.",
"error_code": "INTERNAL_SERVER_ERROR"
}Authorizations
Bearer token authentication. Pass your API key as Authorization: Bearer sk_.... See Authentication for keys, scopes, and sandbox vs production.
Body
- Option 1
- Option 2
- Option 3
Provide at least one identifier. If event_id is provided, that exact event is replayed. Otherwise, the replay target is resolved by charge_id or reference.
Response
Success - replay request accepted and a new delivery attempt was created.
The event that was replayed. It keeps its original ID, so a replay is a fresh delivery of the same event rather than a new event.
"evt_3ab4e0d5d27445cf8a52ab3d8cb8f0b1"
The delivery attempt this replay created. Look it up to see whether the delivery succeeded.
"wha_6f1e40f6bdf84c1980e1e1f6407f3f8a"
Which attempt this is for the event, counting every earlier automatic retry.
3
The type of the event that was replayed, the same value your endpoint receives in the payload.
"collection.failed"

