Account integrations
Webhooks
Signed HTTPS messages when learners enrol, finish courses and buy, sent to the address a school chooses.
What webhooks do
A webhook sends your academy's events to another tool as they happen: a learner enrols, an enrolment ends, a learner completes a course, a marketplace order is paid or refunded. AcademyOS makes an HTTPS POST with a signed JSON message to an address you choose, so tools such as Zapier, Make or your own server stop asking for changes on a timer.
Webhooks belong to one school or creator account and only ever carry that account's own records.
Set up an endpoint
- Open Settings β Webhooks as an admin of the account and choose Add endpoint. A school needs the Growth plan or above to add endpoints and send events.
- Enter the
httpsaddress that receives the events and pick the events it wants. The address must be reachable from the internet; it must use the standard HTTPS port (443, or 8443), and private and internal network addresses are refused. - On the endpoint's page, Reveal its signing secret (
whsec_β¦) and give it to your receiver. - Choose Send test, and check the result under Recent deliveries.
An account holds up to 10 endpoints. Coordinators, teachers and learners cannot see them.
Events
| Type | When | data |
|---|---|---|
enrollment.created | An enrolment becomes active: a new one, an accepted invitation, a purchase, a partner grant, or one brought back after it ended. Pending invitations are not sent. | enrollment, learner, course |
enrollment.ended | An active enrolment is withdrawn: unenrolled, expired, refunded, revoked or taken down. | enrollment, learner, course |
course.completed | A learner completes a course, once per learner and course. | course, learner, completed_at |
order.paid | A marketplace order is paid (creator accounts). Each payment of a subscription or payment plan is an order of its own. | order, product, buyer |
order.refunded | Each refund of a marketplace order, a later partial one included. | order, product, buyer |
webhook.test | Only when an admin chooses Send test. | endpoint, sent_by |
Learners are identified by id, name and email. No payment details, tax documents or addresses are ever sent.
The message
{
"id": "evt_3f1c9a0b7e2d4c55a1b2c3d4e5f60718",
"type": "enrollment.created",
"api_version": "2026-11-25",
"created_at": "2026-11-25T14:02:11Z",
"account_id": "acct_β¦",
"data": {
"enrollment": {"id": "enr_β¦", "status": "active", "source": "manual", "enrolled_at": "2026-11-25T14:02:11Z", "ended_at": null, "expires_at": null},
"learner": {"id": "user_β¦", "name": "Ana Souza", "email": "ana@example.com"},
"course": {"id": "lo_β¦", "title": "English B1"}
}
}id is the same for every delivery of one occurrence: keep the ids you have handled and drop a message whose id you have seen. Times are UTC, ISO 8601. Each request carries these headers:
| Header | Value |
|---|---|
Content-Type | application/json |
User-Agent | AcademyOS-Webhooks/1.0 |
AcademyOS-Event | The event type |
AcademyOS-Event-Id | The event's id |
AcademyOS-Signature | t=<unix seconds>,v1=<hex> |
Verify the signature
v1 is the HMAC-SHA256 of the timestamp, a dot and the raw request body ("<t>.<body>"), keyed by the endpoint's signing secret and hex encoded. Compare it in constant time, and refuse a message whose t is more than 5 minutes from your clock, so an old message replayed at you is refused.
# raw_body: the request body exactly as received, before any JSON parsing.
def academyos_webhook?(header, raw_body, secret)
parts = header.to_s.split(",").filter_map { |part| part.split("=", 2) if part.include?("=") }.to_h
timestamp = Integer(parts["t"].to_s, exception: false)
return false if timestamp.nil? || parts["v1"].nil?
return false if (Time.now.to_i - timestamp).abs > 300
expected = OpenSSL::HMAC.hexdigest("SHA256", secret, "#{parts["t"]}.#{raw_body}")
Rack::Utils.secure_compare(expected, parts["v1"])
endconst crypto = require("node:crypto");
// rawBody: the request body as a string, exactly as received.
function isAcademyOSWebhook(header, rawBody, secret) {
const parts = Object.fromEntries(
(header || "").split(",").filter((p) => p.includes("=")).map((p) => {
const at = p.indexOf("=");
return [p.slice(0, at), p.slice(at + 1)];
})
);
const timestamp = Number(parts.t);
if (!parts.t || !Number.isInteger(timestamp) || !parts.v1) return false;
if (Math.abs(Date.now() / 1000 - timestamp) > 300) return false;
const expected = Buffer.from(crypto.createHmac("sha256", secret).update(`${parts.t}.${rawBody}`).digest("hex"));
const given = Buffer.from(parts.v1);
return expected.length === given.length && crypto.timingSafeEqual(expected, given);
}Answering, retries and switching off
Answer with any 2xx status as soon as the message is stored, and do the work afterwards. Anything else counts as a failure: another status, a malformed answer, a network error, or a try that takes more than 15 seconds in all (5 to connect). Redirects are not followed, and the body of your answer is never read.
A failed delivery is tried again after 1 minute, 5 minutes, 30 minutes, 2 hours, 5 hours, 8 hours and 8 hours: 8 tries over about a day. Messages can arrive out of order and more than once; use id to drop duplicates and the timestamps to order them.
When every try of a delivery fails and the endpoint has not answered anything successfully since, AcademyOS switches it off and tells the account's admins in the app and by email. An endpoint that has never answered successfully is switched off sooner, after 10 failed tries in a row. Turn it back on in Settings once your receiver works; events from the time it was off are not resent. Deliveries are listed on the endpoint's page for 30 days.
Partner endpoints
A partner marketplace that grants access through the partner API can receive its grant events instead of polling. The partner's owner adds endpoints on the partner's page in the developer portal, with the same signing, retries, tests and switching off as above; when an endpoint is switched off, the owner gets an email.
| Type | When | data |
|---|---|---|
grant.activated | A grant gives the learner access: at once when they already have an account, or at their first sign-in. Once per grant. | grant |
grant.revoked | The partner revokes one of its grants. | grant |
grant is exactly what GET /api/partners/v1/enrollments/:external_reference answers, so it carries only the email the partner sent, never anything else about the learner. A partner only hears about grants it made, and a partner switched off by AcademyOS receives nothing. The message names the partner by its slug (partner) instead of account_id. Keep reconciling nightly with GET /api/partners/v1/enrollments: events from a time an endpoint was off are not resent.
Was this page useful?
Last updated November 24, 2026