linkEvent Types
The following events are dispatched to all endpoints with a POST request containing an event object.
account.plan
do
not trigger the parent's update
event. In addition, resource deletion
e.g. policy.deleted
or user.deleted
events will not trigger "cascading"
deletion events on dependent associations.
Event | Trigger | Payload |
---|---|---|
account.billing.updated |
When your account's billing is updated | The updated billing object |
account.plan.updated |
When your account's plan is updated | The updated plan object |
account.subscription.canceled |
When your account's subscription is canceled | The updated account object |
account.subscription.paused |
When your account's subscription is paused | The updated account object |
account.subscription.renewed |
When your account's subscription is renewed | The updated account object |
account.subscription.resumed |
When your account's subscription is resumed | The updated account object |
account.updated |
When your account is updated | The updated account object |
artifact.created |
When an artifact is created | The created artifact object |
artifact.deleted |
When an artifact is deleted | The deleted artifact object |
artifact.downloaded |
When an artifact is downloaded | The artifact object |
artifact.updated |
When an artifact is updated | The updated artifact object |
artifact.uploaded |
When an artifact is uploaded | The artifact object |
component.created |
When a component is created | The new component object |
component.deleted |
When a component is deleted | The deleted component object |
component.updated |
When a component is updated | The updated component object |
entitlement.created |
When an entitlement is created | The entitlement object |
entitlement.deleted |
When an entitlement is deleted | The deleted entitlement object |
entitlement.updated |
When an entitlement is updated | The updated entitlement object |
group.created |
When a group is created | The group object |
group.deleted |
When a group is deleted | The deleted group object |
group.owners.attached |
When owners are attached to a group | The attached owner objects |
group.owners.detached |
When owners are detached from a group | The detached owner objects |
group.updated |
When a group is updated | The updated group object |
license.check-in-overdue |
When a license is overdue for check-in | The overdue license object |
license.check-in-required-soon |
When a license requires a check-in within the next 3 days Note: Up to 1 event will be sent every day until overdue |
The license object |
license.checked-in |
When a license is checked in | The checked in license object |
license.checked-out |
When a license is checked out | The license file object |
license.created |
When a license is created | The license object |
license.deleted |
When a license is deleted | The deleted license object |
license.entitlements.attached |
When entitlements are attached to a license | The attached entitlement objects |
license.entitlements.detached |
When entitlements are detached from a license | The detached entitlement objects |
license.expired |
When a license has expired | The expired license object |
license.expiring-soon |
When a license is expiring within the next 3 days Note: Up to 1 event will be sent every day until expiration |
The expiring license object |
license.group.updated |
When a license's group relationship is changed | The license object |
license.policy.updated |
When a license's policy relationship has been changed | The license object |
license.reinstated |
When a license is reinstated | The reinstated license object |
license.renewed |
When a license is renewed | The renewed license object |
license.revoked |
When a license is revoked | The revoked license object |
license.suspended |
When a license is suspended | The suspended license object |
license.updated |
When a license is updated | The updated license object |
license.usage.decremented |
When a license's usage is decremented | The used license object |
license.usage.incremented |
When a license's usage is incremented | The used license object |
license.usage.reset |
When a license's usage is reset | The reset license object |
license.owner.updated |
When a license's owner relationship has been changed | The license object |
license.users.attached |
When users are attached to a license | The attached user objects |
license.users.detached |
When users are detached from a license | The detached user objects |
license.validation.failed |
When a license validation fails | The validated license object |
license.validation.succeeded |
When a license validation succeeds | The validated license object |
machine.checked-out |
When a machine is checked out | The machine file object |
machine.created |
When a machine is created | The machine object |
machine.deleted |
When a machine is deleted | The deleted machine object |
machine.group.updated |
When a machine's group relationship is changed | The machine object |
machine.owner.updated |
When a machine's owner relationship is changed | The machine object |
machine.heartbeat.dead |
When a machine heartbeat monitor determines the machine is dead (i.e. it received no ping within the heartbeat window) | The dead machine object |
machine.heartbeat.ping |
When a machine heartbeat ping is received | The pinged machine object |
machine.heartbeat.reset |
When a machine heartbeat is reset | The reset machine object |
machine.heartbeat.resurrected |
When a dead machine heartbeat is resurrected | The resurrected machine object |
machine.updated |
When a machine is updated | The updated machine object |
package.created |
When a package is created | The package object |
package.deleted |
When a package is deleted | The deleted package object |
package.updated |
When a package is updated | The updated package object |
policy.created |
When a policy is created | The policy object |
policy.deleted |
When a policy is deleted | The deleted policy object |
policy.entitlements.attached |
When entitlements are attached to a policy | The attached entitlement objects |
policy.entitlements.detached |
When entitlements are detached from a policy | The detached entitlement objects |
policy.pool.popped |
When a key is popped from a pool | The popped key object |
policy.updated |
When a policy is updated | The updated policy object |
process.created |
When a process is created | The new process object |
process.deleted |
When a process is deleted | The deleted process object |
process.heartbeat.dead |
When a process heartbeat monitor determines the process is dead (i.e. it received no ping within the heartbeat window) | The dead process object |
process.heartbeat.ping |
When a process heartbeat ping is received | The pinged process object |
process.heartbeat.resurrected |
When a dead machine heartbeat is resurrected | The resurrected process object |
process.updated |
When a process is updated | The updated process object |
product.created |
When a product is created | The product object |
product.deleted |
When a product is deleted | The deleted product object |
product.updated |
When a product is updated | The updated product object |
release.constraints.attached |
When constraints are attached to a release | The attached constraint objects |
release.constraints.detached |
When constraints are detached from a release | The detached constraint objects |
release.created |
When a release is created | The created release object |
release.deleted |
When a release is deleted | The deleted release object |
release.package.updated |
When a release's package is updated | The updated release object |
release.published |
When a release is published | The release object |
release.updated |
When a release is updated | The updated release object |
release.upgraded |
When a release is upgraded | The release object |
release.yanked |
When a release is yanked | The release object |
second-factor.created |
When a second factor is created | The second factor object |
second-factor.deleted |
When a second factor is deleted | The deleted second factor object |
second-factor.disabled |
When a second factor is disabled | The disabled second factor object |
second-factor.enabled |
When a second factor is enabled | The enabled second factor object |
token.generated |
When a token is generated | The generated token object |
token.regenerated |
When a token is regenerated | The regenerated token object |
token.revoked |
When a token is revoked | The revoked token object |
user.banned |
When a user is banned | The user object |
user.created |
When a user is created | The user object |
user.deleted |
When a user is deleted | The deleted user object |
user.group.updated |
When a user's group relationship is changed | The user object |
user.password-reset |
When a user requests a password reset | The user object and reset token |
user.unbanned |
When a user is unbanned | The user object |
user.updated |
When a user is updated | The updated user object |
Example webhook handler using Node and Express
const bodyParser = require("body-parser")const express = require("express")const app = express() app.use(bodyParser.json({ type: "application/vnd.api+json" }))app.use(bodyParser.json({ type: "application/json" })) app.post("/my/webhook/url", async (req, res) => { const { data } = req.body if (!data) { return res.sendStatus(400) } // TODO: Verify webhook's signature (https://keygen.sh/docs/api/signatures/) switch (data.attributes.event) { case "user.password-reset": const reset = JSON.parse(data.attributes.payload) const { passwordResetToken } = reset.meta // … email the password reset token to the user for fulfillment break case "user.created": const user = JSON.parse(data.attributes.payload) // … do something when a user is created e.g. create a Stripe customer break case "license.created": const license = JSON.parse(data.attributes.payload) // … do something when a license is created e.g. charge a user break } // Let Keygen know the event was received successfully res.sendStatus(200)}) const server = app.listen(8080, 'localhost', () => { const { address, port } = server.address() console.log(`Listening at http://${address}:${port}`)})