Add a Slack channel or a webhook
Alerts and keys live in the Alerts and API section of the portal. Every member sees it. An admin changes it.
- Under Alert destinations, pick Slack channel or Signed webhook.
- For Slack, create an incoming webhook for the channel in Slack and paste it under Slack incoming webhook address. It starts with https://hooks.slack.com/services/.
- For a webhook, paste a public https address under Your endpoint.
- Press Add and send a test. A test.ping event goes out at once.
- For a webhook, copy the signing secret now. It starts with whsec_ and is shown only this once. Press I have copied it.
- An account holds up to 5 destinations. Remove deletes one.
- Each destination shows Delivered with the time, or Last delivery failed with the status your side answered.
The events
Slack gets one line per event, for example: HIGH finding on app.yourcompany.com: Any user can read any invoice, followed by the link. A webhook gets a JSON body with event, created_at and data.
- test.started: testing of a hostname has begun. Data: test_id, hostname, kind.
- finding.created: sent for each critical or high finding when the test delivers its results, up to 20 per test. Data: test_id, hostname, url, name, severity.
- test.finished: data adds findings, the total, and urgent, the number that are critical or high.
- test.cancelled: the test was cancelled mid-run and delivered what it had found. Same data as test.finished.
- test.ping: the test sent when you add a destination.
{
"event": "test.finished",
"created_at": "2026-11-23T15:04:05.000Z",
"data": {
"test_id": "k17d2m9x4q8v",
"hostname": "app.yourcompany.com",
"url": "https://grapefruitsecurity.com/portal/scan/k17d2m9x4q8v",
"findings": 4,
"urgent": 1
}
}Verify a webhook
Each webhook request carries two headers. X-Grapefruit-Timestamp is the send time in Unix seconds. X-Grapefruit-Signature is sha256= followed by the hex HMAC-SHA256 of the timestamp, a dot and the raw request body, keyed with your signing secret. Compute the same value over the body exactly as received and compare.
- Answer with a 2xx status within 10 seconds. Anything else counts as a failure, a redirect included.
- A failed delivery is retried twice: after 1 minute, then after 5 more.
- Requests carry the User-Agent grapefruit-webhooks/1.0.
import { createHmac, timingSafeEqual } from "node:crypto";
// rawBody: the request body as a string, before any JSON parsing.
export function fromGrapefruit(rawBody, headers, secret) {
const stamp = headers["x-grapefruit-timestamp"] ?? "";
const sent = Buffer.from(headers["x-grapefruit-signature"] ?? "");
const mac = createHmac("sha256", secret).update(stamp + "." + rawBody).digest("hex");
const want = Buffer.from("sha256=" + mac);
const fresh = Math.abs(Date.now() / 1000 - Number(stamp)) < 300;
return fresh && sent.length === want.length && timingSafeEqual(sent, want);
}Create an API key
- Under API keys, type a label under Name for a new key, for example CI pipeline.
- Press Create API key.
- Copy the key now. It is shown only this once, and only a SHA-256 hash of it is stored.
- A key is gf_live_ followed by 48 hexadecimal characters.
- An account holds up to 5 keys. Each row shows the label, the first 12 characters and when it was last used.
- Revoke ends a key at once.
Call the API
The API answers GET requests under /api/v1 on the same address as the portal. Send the key in the Authorization header. Every answer is JSON with a data field, or an error field with a message.
- GET /api/v1/hostnames: each hostname with verified and authorized, true or false.
- GET /api/v1/tests: your 100 most recent tests, newest first.
- GET /api/v1/tests/{id}: one test, plus finding_list with the id, name, severity, class, asset, summary and evidence of each finding.
curl -H "Authorization: Bearer gf_live_<your key>" https://grapefruitsecurity.com/api/v1/tests
{
"data": [
{
"id": "k17d2m9x4q8v",
"hostname": "app.yourcompany.com",
"kind": "full",
"status": "done",
"started_at": "2026-11-23T09:00:00.000Z",
"finished_at": "2026-11-23T15:04:05.000Z",
"findings": 4,
"new": null,
"fixed": null,
"url": "https://grapefruitsecurity.com/portal/scan/k17d2m9x4q8v"
}
]
}Limits and errors
- Each key may make 60 requests a minute. Past that the answer is 429 with: Rate limit: 60 requests a minute per key. Wait for the next minute.
- 401: the key is missing, malformed, unknown or revoked.
- 404: no such test in your account, or an unknown endpoint.
- kind is full or maintenance. status is queued, running, paused, done, failed or cancelled.
- findings, new and fixed are null until a test has them. new and fixed compare a test with the previous finished test of the same hostname.