Account API2026-11
Webhook krajnje točke
URL-ovi na koje šaljemo (POST) događaje. Događaji, njihovi sadržaji, potpisivanje i ponovni pokušaji nalaze se na Webhookovima.
Endpointi
- POST/v1/webhook_endpointsIzradi endpoint
- GET/v1/webhook_endpointsPopis endpointa
- GET/v1/webhook_endpoints/{id}Dohvati endpoint
- PATCH/v1/webhook_endpoints/{id}Stiže uskoroAžuriraj krajnju točku
- DELETE/v1/webhook_endpoints/{id}Brisanje endpointa
- POST/v1/webhook_endpoints/{id}/rotate_secretStiže uskoroRotiraj tajni ključ
- POST/v1/webhook_endpoints/{id}/testPošalji testni događaj
- GET/v1/webhook_endpoints/{id}/deliveriesStiže uskoroPopis isporuka
- POST/v1/webhook_endpoints/{id}/deliveries/{delivery}/retryStiže uskoroPošalji isporuku ponovno
Objekt Webhook endpoint
idstring- Počinje s we_.
urlstring- Tvoj https URL koji odgovara s 2xx.
descriptionstring|null- Za tebe.
events[]array- Vrste događaja za slanje, ili
*za sve, uključujući vrste dodane kasnije: order.created, order.paid, order.bought, order.held, order.cancelled, order.shipped, product.cost_changed, product.repriced, product.out_of_stock, product.paused, product.resumed, product.removed. statusstring- enabled ili disabled (ti ili mi nakon pet dana u kojima je svaka isporuka propala; javljamo ti e-poštom).
api_versionstring- Verzija u kojoj se pišu sadržaji događaja. Zasad postoji jedna, 2026-11.
secretstring- Tajni ključ za potpisivanje. Samo u odgovorima na create i rotate.
webhook_endpoint
{ "id": "we_3d8s", "url": "https://acme-goods.com/hooks/ninjabuy", "description": "Order sync", "events": ["order.shipped", "product.out_of_stock", "product.paused"], "status": "enabled", "api_version": "2026-11", "created_at": "2026-11-01T08:00:00Z"}Izradi endpoint
POST/v1/webhook_endpoints
Vraća tajnu za potpisivanje samo jednom: spremi je odmah. Do 16 endpointa po računu.
Opsegwebhooks:write
Tijelo
urlstringobvezno- Samo https.
events[]arrayobvezno- Vrste događaja ili ["*"].
descriptionstring- Neobvezno.
Pogreške
| Status | Vrsta | Kada |
|---|---|---|
| 400 | bad-body | URL nije https ili je vrsta događaja nepoznata. |
| 409 | invalid-state | Račun već ima 16 krajnjih točaka. |
curl -X POST "https://www.ninjabuy.com/api/v1/webhook_endpoints" \ -H "Authorization: Bearer " \ -H "NinjaBuy-Version: 2026-11" \ -H "Idempotency-Key: $(uuidgen)" \ -H "Content-Type: application/json" \ -d '{ "url": "https://acme-goods.com/hooks/ninjabuy", "events": ["order.shipped", "product.out_of_stock", "product.paused"], "description": "Order sync" }'Response · 201
HTTP/2 201 Created{ "id": "we_3d8s", "url": "https://acme-goods.com/hooks/ninjabuy", "description": "Order sync", "events": ["order.shipped", "product.out_of_stock", "product.paused"], "status": "enabled", "api_version": "2026-11", "created_at": "2026-11-01T08:00:00Z", "secret": "whsec_MfKQ9r8GKYqrTwjUPD8ILPZIo2LaLaSw"}curl "https://www.ninjabuy.com/api/v1/webhook_endpoints" \ -H "Authorization: Bearer " \ -H "NinjaBuy-Version: 2026-11"Response · 200
HTTP/2 200 OK{ "data": [ { "id": "we_3d8s", "url": "https://acme-goods.com/hooks/ninjabuy", "description": "Order sync", "events": [ "order.shipped", "product.out_of_stock", "product.paused" ], "status": "enabled", "api_version": "2026-11", "created_at": "2026-11-01T08:00:00Z" } ], "has_more": false, "cursor": null}Dohvati endpoint
GET/v1/webhook_endpoints/{id}
Jedan endpoint, bez njegove tajne.
Opsegwebhooks:write
Parametri putanje
idstringobvezno- Id krajnje točke.
Pogreške
| Status | Vrsta | Kada |
|---|---|---|
| 404 | not-found | Na ovom računu nema takvog endpointa. |
curl "https://www.ninjabuy.com/api/v1/webhook_endpoints/we_3d8s" \ -H "Authorization: Bearer " \ -H "NinjaBuy-Version: 2026-11"Response · 200
HTTP/2 200 OK{ "id": "we_3d8s", "url": "https://acme-goods.com/hooks/ninjabuy", "description": "Order sync", "events": ["order.shipped", "product.out_of_stock", "product.paused"], "status": "enabled", "api_version": "2026-11", "created_at": "2026-11-01T08:00:00Z"}Ažuriraj krajnju točku
PATCH/v1/webhook_endpoints/{id}Stiže uskoro
Promijeni njegov URL ili događaje ili ga onemogući i omogući. Omogućavanje šalje ono što je propustio u zadnja 3 dana.
Opsegwebhooks:write
Parametri putanje
idstringobvezno- Id krajnje točke.
Tijelo
urlstring- Samo https.
events[]array- Vrste događaja ili ["*"].
descriptionstring- Neobvezno.
statusstring- Neobvezno. enabled ili disabled.
Pogreške
| Status | Vrsta | Kada |
|---|---|---|
| 404 | not-found | Na ovom računu nema takvog endpointa. |
curl -X PATCH "https://www.ninjabuy.com/api/v1/webhook_endpoints/we_3d8s" \ -H "Authorization: Bearer " \ -H "NinjaBuy-Version: 2026-11" \ -H "Content-Type: application/json" \ -d '{ "events": ["*"] }'Response · 200
HTTP/2 200 OK{ "id": "we_3d8s", "url": "https://acme-goods.com/hooks/ninjabuy", "description": "Order sync", "events": ["*"], "status": "enabled", "api_version": "2026-11", "created_at": "2026-11-01T08:00:00Z"}Brisanje endpointa
DELETE/v1/webhook_endpoints/{id}
Odmah zaustavlja svaku isporuku prema njemu, uključujući ponovne pokušaje.
Opsegwebhooks:write
Parametri putanje
idstringobvezno- Id krajnje točke.
Pogreške
| Status | Vrsta | Kada |
|---|---|---|
| 404 | not-found | Na ovom računu nema takvog endpointa. |
curl -X DELETE "https://www.ninjabuy.com/api/v1/webhook_endpoints/we_3d8s" \ -H "Authorization: Bearer " \ -H "NinjaBuy-Version: 2026-11"Response · 200
HTTP/2 200 OK{ "id": "we_3d8s", "deleted": true }Rotiraj tajni ključ
POST/v1/webhook_endpoints/{id}/rotate_secretStiže uskoro
Vraća novu tajnu. 24 sata potpisujemo objema, pa zaglavlje webhook-signature nosi dva potpisa i svaki se provjerava: postavi novu, a staru pusti da istekne.
Opsegwebhooks:write
Parametri putanje
idstringobvezno- Id krajnje točke.
Pogreške
| Status | Vrsta | Kada |
|---|---|---|
| 404 | not-found | Na ovom računu nema takvog endpointa. |
curl -X POST "https://www.ninjabuy.com/api/v1/webhook_endpoints/we_3d8s/rotate_secret" \ -H "Authorization: Bearer " \ -H "NinjaBuy-Version: 2026-11" \ -H "Idempotency-Key: $(uuidgen)"Response · 200
HTTP/2 200 OK{ "id": "we_3d8s", "secret": "whsec_C2FVsBQIhrscChlQIMV+b5sSYspob7oD", "previous_expires_at": "2026-11-05T09:30:00Z"}Pošalji testni događaj
POST/v1/webhook_endpoints/{id}/test
Stavlja u red uzorak jednog tipa događaja, potpisan kao i svaki drugi, s test: true. Primatelj potvrđuje isporuku kad stigne.
Opsegwebhooks:write
Parametri putanje
idstringobvezno- Id krajnje točke.
Tijelo
typestringobvezno- Vrsta događaja.
Pogreške
| Status | Vrsta | Kada |
|---|---|---|
| 404 | not-found | Na ovom računu nema takvog endpointa. |
curl -X POST "https://www.ninjabuy.com/api/v1/webhook_endpoints/we_3d8s/test" \ -H "Authorization: Bearer " \ -H "NinjaBuy-Version: 2026-11" \ -H "Idempotency-Key: $(uuidgen)" \ -H "Content-Type: application/json" \ -d '{ "type": "order.shipped" }'Response · 202
HTTP/2 202 Accepted{ "delivery": "dlv_0k2p", "status": "pending" }Popis isporuka
GET/v1/webhook_endpoints/{id}/deliveriesStiže uskoro
Svaki pokušaj u zadnjih 30 dana, najnoviji prvi: što smo poslali, kakav je bio tvoj odgovor i kada ponovno pokušavamo.
Opsegwebhooks:write
Parametri putanje
idstringobvezno- Id krajnje točke.
Parametri upita
statusstring- Neobvezno. succeeded, retrying ili failed.
eventstring- Neobvezno. Id događaja.
limit, cursor- Pagination
Pogreške
| Status | Vrsta | Kada |
|---|---|---|
| 404 | not-found | Na ovom računu nema takvog endpointa. |
curl "https://www.ninjabuy.com/api/v1/webhook_endpoints/we_3d8s/deliveries?status=retrying" \ -H "Authorization: Bearer " \ -H "NinjaBuy-Version: 2026-11"Response · 200
HTTP/2 200 OK{ "data": [ { "id": "dlv_0k3a", "event": "evt_4m2x", "type": "order.shipped", "status": "retrying", "attempts": 3, "last_response_status": 502, "next_attempt_at": "2026-11-03T08:35:00Z" } ], "has_more": false, "cursor": null}Pošalji isporuku ponovno
POST/v1/webhook_endpoints/{id}/deliveries/{delivery}/retryStiže uskoro
Odmah šalje događaj, s istim webhook-id, bez obzira na njegovo stanje. Već zakazani ponovni pokušaji nastavljaju se.
Opsegwebhooks:write
Parametri putanje
idstringobvezno- Id krajnje točke.
deliverystringobvezno- ID dostave.
Pogreške
| Status | Vrsta | Kada |
|---|---|---|
| 404 | not-found | Na ovom računu nema takvog endpointa. |
curl -X POST "https://www.ninjabuy.com/api/v1/webhook_endpoints/we_3d8s/deliveries/dlv_0k3a/retry" \ -H "Authorization: Bearer " \ -H "NinjaBuy-Version: 2026-11" \ -H "Idempotency-Key: $(uuidgen)"Response · 202
HTTP/2 202 Accepted{ "delivery": "dlv_0k3a", "status": "retrying", "next_attempt_at": "2026-11-03T08:01:10Z"}