Create a webhook endpoint
const url = 'https://api.koneth.com/api/v1/organizations/b7378db4-5a7a-4e69-a8df-04f2e6d94243/webhooks';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"name":"api.example.com","url":"https://api.example.com/koneth/events","events":["position.opened","position.closed","finance.transaction.completed"],"serverId":null}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api.koneth.com/api/v1/organizations/b7378db4-5a7a-4e69-a8df-04f2e6d94243/webhooks \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "name": "api.example.com", "url": "https://api.example.com/koneth/events", "events": [ "position.opened", "position.closed", "finance.transaction.completed" ], "serverId": null }'Registers an HTTPS receiver. The endpoint is created pending and
receives no events until it answers the verification challenge, which
is sent when Verify is clicked in Console.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”UUID of the organization the signed-in user belongs to.
Example
b7378db4-5a7a-4e69-a8df-04f2e6d94243Request Bodyrequired
Section titled “Request Bodyrequired”object
Label for the endpoint, usually the receiver host.
HTTPS address that receives the deliveries.
Deliver only this server’s events. Omit or send null to
receive events from every server in the organization.
Example
{ "name": "api.example.com", "url": "https://api.example.com/koneth/events", "events": [ "position.opened", "position.closed", "finance.transaction.completed" ], "serverId": null}Responses
Section titled “Responses”Endpoint created in the pending state.
object
object
Signing secret for this endpoint. It is not returned again after this response.
Challenge value your receiver must echo to activate the endpoint.
Example
{ "endpoint": { "id": "0f6f2d88-9357-4ce6-9b9e-76db2f98bb2e", "name": "api.example.com", "url": "https://api.example.com/koneth/events", "events": [ "position.opened", "position.closed" ], "serverId": null, "status": "pending", "secret": "kwhsec_5f0b6d7c8e9a0b1c2d3e4f5a6b7c8d9e", "verificationToken": "9f2c4d1e7a8b3c5d6e0f1a2b3c4d5e6f7a8b9c0d1e2f3a4b5c6d7e8f9a0b1c2d" }}Invalid request.
object
Validation issue details when the request fails schema validation.
object
Examplegenerated
{ "error": "example", "issues": [ {} ]}The Console session is missing or expired.
object
Validation issue details when the request fails schema validation.
object
Example
{ "error": "Authentication required"}The signed-in user is not an organization Owner or Finance member.
object
Validation issue details when the request fails schema validation.
object
Example
{ "error": "Insufficient organization permission"}The requested resource was not found.
object
Validation issue details when the request fails schema validation.
object
Examplegenerated
{ "error": "example", "issues": [ {} ]}Unexpected server error.
object
Validation issue details when the request fails schema validation.
object
Example
{ "error": "Internal server error"}