Plans: Core and Plus, and the free trial, to add destinations. Listing and removing keep working after a move to
Starter. Adding and removing are refused with 402 while the workspace is read-only. Who: anyone with a workspace
token; owners and admins create workspace tokens.
Authentication
Every request needs a workspace token in theAuthorization header:
401 here. See
create a token.
Example: add a Slack channel
1
Get an incoming webhook URL in Slack
In Slack, set up an incoming webhook for the channel (a Slack app with Incoming Webhooks turned on) and copy its URL.
It starts with
https://hooks.slack.com/.2
Add the destination
201 Created with the new destination:3
Test it
Adding a destination through the API doesn’t send anything. To check it, go to Settings → Notifications and
select Send a test on the destination. A message “Test alert from Pharus” should appear in the channel.
id if your tool will remove the destination later.
List destinations
200 OK
Every destination in the workspace, oldest first, however it was added.Add a destination
Content-Type: application/json:
The body may be at most 16 384 characters.
URL rules
Every URL starts withhttps://, has a full host name and has no user name or password in it. On top of that:
201 Created
The destination, in the same shape as in the list, turned on. For a webhook, the response also hassecret:
secret is the webhook’s signing secret, starting with whsec_. Pharus signs every request to the endpoint with it;
see verify the signature for how to check it, and
outgoing webhooks for the request and body Pharus sends.
POST isn’t idempotent: sending the same body twice adds two destinations, and each gets every alert. If your tool
retries, list the destinations first, or remove the extra one.
Remove a destination
204 No Content and stops posting to the destination. Its failed deliveries stay listed under
Delivery problems. Removing works after a move to Starter too, so a workspace can wind its destinations down.
When the workspace has no destination with that id, Pharus answers 404 with not_found.
Audit trail
Destinations added and removed through the API are recorded in the audit trail, with the token’s name as the actor. Listing isn’t recorded.Errors
Errors return{ "error", "message" }. A 400 with invalid_request adds fields, with one English message for each
field that is missing or invalid:
Pharus checks in this order: the token, the rate limit, whether the workspace is read-only, then for
POST the plan, whether Pharus can store destination URLs,
and the body.