Events and webhooks#
Instead of asking again and again whether something happened, a client can be told: by a live event stream it keeps open, or by webhooks the server posts to.
Both carry the same events: logins, file transfers, shares, forms, jobs and their steps, admin changes, security events (bans, refusals), the server starting and stopping, AS2 and SLA alerts. An event is cut to the users the caller may see, and secrets in it are masked.
{
"id": "48213",
"category": "file",
"time": "2026-11-18T13:44:43.120Z",
"data": { "...": "the event's own fields" }
}
The categories: auth, file, form, job, jobstep, share, admin, security, server, as2, sla.
The stream#
GET /events/stream holds the connection open and sends each event as it happens, as Server-Sent Events (text/event-stream):
curl -N -H "Authorization: Bearer $TOKEN" "$API/events/stream?categories=file,security"
categories: the ones you want, comma separated; all of them when left out.max_seconds(default 3600, at most a day) andmax_eventsend the stream; reconnect to go on.- Missed nothing: a client that reconnects with the
Last-Event-IDheader (orlast_event_id) gets the events after that one, from the last 1000.
Reading the stream is a sensitive permission: events name users, paths and addresses.
Webhooks#
A webhook is a stored subscription: a URL, the categories, and a secret. The server posts each event of those categories to the URL as JSON:
curl -X PUT -u admin -H "Content-Type: application/json" \
-d '{"url": "https://hooks.example.com/crushmft", "categories": ["file", "security"]}' \
$API/webhooks/siem-bridge
Without a secret the server makes one and shows it once, in that answer. POST /webhooks/{id}/test sends a test event; GET /webhooks shows each one's last delivery, status and counts.
Each post carries these headers:
| Header | Value |
|---|---|
X-CrushMFT-Event |
The category. |
X-CrushMFT-Delivery |
The event's id: the same id again means a retry of the same event. |
X-CrushMFT-Webhook |
The webhook's id. |
X-CrushMFT-Signature |
sha256= and the HMAC-SHA256 of the body with the webhook's secret, in hex. |
Check the signature before trusting a post, over the raw body as it came:
import hmac, hashlib
def genuine(body: bytes, header: str, secret: str) -> bool:
want = "sha256=" + hmac.new(secret.encode(), body, hashlib.sha256).hexdigest()
return hmac.compare_digest(want, header)
A post that does not get a 2xx answer is tried again after 2 seconds, 10 seconds, 1 minute, 5 minutes and 30 minutes, then given up and logged. Answer quickly and do the work afterwards.
Note
A webhook to a loopback, link-local or cloud metadata address can be set only by an administrator. For log collection the server's log targets (syslog, SQL, files) already push structured events; webhooks are for everything else.
From openapi.json: CrushMFT API, version v1, build 27.0.0_2143.
Push instead of polling: the live event stream, and webhooks that post each event to a URL.
GET /WebInterface/api/v1/events/stream #
The server's events as they happen (text/event-stream), cut to the users the caller may see. Last-Event-ID resumes.
- Operation:
events.stream - Credentials:
tokenorbasicorsession - Permission:
server.events.stream - Tier:
1 - Token: by its grants
- Read only: yes
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
categories |
query | string | Categories, comma separated: auth, file, form, job, jobstep, share, admin, security, server, as2, sla. All when left out. | |
max_seconds |
query | integer | How long the stream stays open, 1 to 86400 seconds; reconnect with Last-Event-ID. Default 3600. |
|
max_events |
query | integer | End after this many events; 0 for no limit. Default 0. |
|
last_event_id |
query | string | As the Last-Event-ID header: the events after this one, from the last 1000. |
Responses
| Status | Description | Body |
|---|---|---|
200 |
The result. | string text/event-stream |
400 |
The request is not JSON, or a parameter is of the wrong kind. | Problem application/problem+json |
401 |
No credential, or one that did not log in. | Problem application/problem+json |
403 |
Logged in, and refused: detail says why, permission names what was missing. |
Problem application/problem+json |
default |
Any other error. | Problem application/problem+json |
GET /WebInterface/api/v1/webhooks #
The webhooks: their url, categories, and how delivery went. The secret is never shown.
- Operation:
webhooks.list - Credentials:
tokenorbasicorsession - Permission:
server.webhooks.edit - Tier:
1 - Token: by its grants
- Read only: yes
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
limit |
query | integer | At most this many items, 1 to 1000. Default 100. |
|
cursor |
query | string | The next_cursor of the page before. |
Responses
| Status | Description | Body |
|---|---|---|
200 |
The result. | object application/json |
400 |
The request is not JSON, or a parameter is of the wrong kind. | Problem application/problem+json |
401 |
No credential, or one that did not log in. | Problem application/problem+json |
403 |
Logged in, and refused: detail says why, permission names what was missing. |
Problem application/problem+json |
default |
Any other error. | Problem application/problem+json |
Fields of the 200 response
| Field | Type | Required | Description |
|---|---|---|---|
items |
list of object | ||
items[].categories |
list of string | ||
items[].delivered |
integer | ||
items[].enabled |
boolean | ||
items[].failed |
integer | ||
items[].id |
string | ||
items[].last_delivery |
string | ||
items[].last_error |
null | ||
items[].last_status |
integer | ||
items[].owner |
string | ||
items[].secret |
object | ||
items[].secret.set |
boolean | ||
items[].url |
string | ||
next_cursor |
null |
Example 200 response
{
"items": [
{
"id": "gatehook",
"url": "http://192.0.2.10:63817/hook",
"categories": [
"auth"
],
"enabled": true,
"secret": {
"set": true
},
"owner": "MainUsers/apiadmin",
"delivered": 1,
"failed": 0,
"last_status": 204,
"last_error": null,
"last_delivery": "2026-11-22T19:32:16.045Z"
}
],
"next_cursor": null
}
PUT /WebInterface/api/v1/webhooks/{id} #
Add or change a webhook: url, categories, secret (made by the server and shown once when not sent), enabled. Rule A14 for the url.
- Operation:
webhooks.save - Credentials:
tokenorbasicorsession - Permission:
server.webhooks.edit - Tier:
1 - Token: by its grants
- Read only: no
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
id |
path | string | yes | The webhook's id: 1 to 64 letters, digits, _ and -. |
dry_run |
query | boolean | Run every check, change nothing. Default false. |
Request body (required): application/json
| Field | Type | Required | Description |
|---|---|---|---|
url |
string | Where the events are posted: http or https. A new webhook needs it. | |
categories |
array | The categories of events to post. A new webhook needs them. | |
secret |
string | The key of the signature, 16 characters at least; the server makes one when a new webhook has none, and shows it once. | |
enabled |
boolean | Whether it posts. |
Example request body
{
"url": "http://192.0.2.10:63817/hook",
"categories": [
"auth"
],
"secret": "Gate-Hook-Secret-0001"
}
Responses
| Status | Description | Body |
|---|---|---|
201 |
Created. | object application/json |
400 |
The request is not JSON, or a parameter is of the wrong kind. | Problem application/problem+json |
401 |
No credential, or one that did not log in. | Problem application/problem+json |
403 |
Logged in, and refused: detail says why, permission names what was missing. |
Problem application/problem+json |
404 |
No such object, or one outside the caller's scope. | Problem application/problem+json |
412 |
If-Match did not match: someone changed the object since it was read. |
Problem application/problem+json |
422 |
A field fails its rule: errors lists every one. |
Problem application/problem+json |
default |
Any other error. | Problem application/problem+json |
Fields of the 201 response
| Field | Type | Required | Description |
|---|---|---|---|
categories |
list of string | ||
delivered |
integer | ||
enabled |
boolean | ||
failed |
integer | ||
id |
string | ||
last_delivery |
null | ||
last_error |
null | ||
last_status |
null | ||
owner |
string | ||
secret |
object | ||
secret.set |
boolean | ||
secret_value |
string | ||
url |
string |
Example 201 response
{
"id": "gatehook",
"url": "http://192.0.2.10:63817/hook",
"categories": [
"auth"
],
"enabled": true,
"secret": {
"set": true
},
"owner": "MainUsers/apiadmin",
"delivered": 0,
"failed": 0,
"last_status": null,
"last_error": null,
"last_delivery": null
}
DELETE /WebInterface/api/v1/webhooks/{id} #
Delete a webhook.
- Operation:
webhooks.delete - Credentials:
tokenorbasicorsession - Permission:
server.webhooks.edit - Tier:
1 - Token: by its grants
- Read only: no
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
id |
path | string | yes | The webhook's id. |
Responses
| Status | Description | Body |
|---|---|---|
204 |
Done, with nothing to answer. | |
400 |
The request is not JSON, or a parameter is of the wrong kind. | Problem application/problem+json |
401 |
No credential, or one that did not log in. | Problem application/problem+json |
403 |
Logged in, and refused: detail says why, permission names what was missing. |
Problem application/problem+json |
404 |
No such object, or one outside the caller's scope. | Problem application/problem+json |
default |
Any other error. | Problem application/problem+json |
POST /WebInterface/api/v1/webhooks/{id}/test #
Post a test event to a webhook now and answer how it went.
- Operation:
webhooks.test - Credentials:
tokenorbasicorsession - Permission:
server.webhooks.edit - Tier:
1 - Token: by its grants
- Read only: no
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
id |
path | string | yes | The webhook's id. |
Responses
| Status | Description | Body |
|---|---|---|
200 |
The result. | object application/json |
400 |
The request is not JSON, or a parameter is of the wrong kind. | Problem application/problem+json |
401 |
No credential, or one that did not log in. | Problem application/problem+json |
403 |
Logged in, and refused: detail says why, permission names what was missing. |
Problem application/problem+json |
404 |
No such object, or one outside the caller's scope. | Problem application/problem+json |
409 |
The object exists already, or its state does not allow this. | Problem application/problem+json |
default |
Any other error. | Problem application/problem+json |
Fields of the 200 response
| Field | Type | Required | Description |
|---|---|---|---|
delivered |
boolean | ||
error |
string or null | ||
status |
integer or null |
Example 200 response
{
"delivered": true,
"status": 204,
"error": null
}
Schemas used here#
Problem #
An error (RFC 9457), as application/problem+json. code is stable and is what a program switches on; detail says it in words; request_id finds the request in the server log.
| Code | Status | Meaning |
|---|---|---|
bad_request |
400 | The request cannot be read: a broken path, an unknown or badly typed parameter, a body that is not a JSON object. |
validation_failed |
422 | The body is well-formed, but one or more of its fields cannot be used. errors lists each field, the rule and a message. |
unauthenticated |
401 | No credential, or one that did not log in. |
forbidden |
403 | Logged in, and refused. detail carries the reason the access engine gave. |
tier0 |
403 | The operation is equal to full control of the server. No token may use it, and of the accounts only the Administrator role. |
read_only_token |
403 | The token is read-only and the operation changes something. |
legacy_account |
403 | The account holds legacy admin flags, which the API does not act on. Convert it to roles, or issue a token for it. |
not_open_yet |
403 | The command behind the operation is not switched on for roles and tokens yet. An administrator's own login can use it. |
dmz_not_allowed |
403 | The request came through a DMZ, and the API does not answer those unless api_from_dmz allows it. |
edition_required |
403 | The operation needs an edition this server is not licensed for. |
not_found |
404 | No such operation, no such object, or an object the caller's scope does not cover. |
method_not_allowed |
405 | The path exists and the method does not. Allow lists the methods that do. |
conflict |
409 | The object already exists, or is in a state that does not allow this. |
precondition_failed |
412 | If-Match did not match: the object changed since it was read. |
payload_too_large |
413 | The body is larger than api_max_body_kb. |
unsupported_media_type |
415 | A body must be Content-Type: application/json. |
rate_limited |
429 | Too many requests for this credential or address in this minute. Retry-After says when to try again. |
internal_error |
500 | A fault in the server. The server log has the cause under the request id. |
not_implemented |
501 | The operation is in the registry and is not built on this server yet. |
unavailable |
503 | The server is starting or shutting down. |
fips_restricted |
409 | The server runs in FIPS 140-3 mode (launched with -Dcrushmft.fips=true), and FIPS mode does not allow what was asked: the detail is the catalog row's reason and what to use instead, fips_id its id (CrushFTP design/61 section 5). |
| Field | Type | Required | Description |
|---|---|---|---|
type |
string | ||
title |
string | ||
code |
string, one of bad_request, validation_failed, unauthenticated, forbidden, tier0, read_only_token, legacy_account, not_open_yet, dmz_not_allowed, edition_required, not_found, method_not_allowed, conflict, precondition_failed, payload_too_large, unsupported_media_type, rate_limited, internal_error, not_implemented, unavailable, fips_restricted |
||
detail |
string | ||
operation |
string | ||
permission |
string | ||
request_id |
string | ||
status |
integer |