Skip to content

Authentication and Roles

Every request to the OpsFusion API must include an API key. This page explains how to send it, what the roles allow, and how to handle keys safely.

Put your key in the Authorization header. Both formats work:

FormatExample header value
Raw keyYOUR_API_KEY
BearerBearer YOUR_API_KEY

Other things to know:

  • Send the complete key. A partial or altered key is rejected.
  • The account ID in the URL is the ID of your account. See Finding Your Account ID.
  • A key only works for the account that owns it. Using it with another account’s ID returns 403.
  • The account must be active, or on a trial that hasn’t expired.
  • Requests with a body need the Content-Type: application/json header.

To create a key, see Create an API Key.

Each key has one to three roles. If a key has several roles, it gets everything any of them allows.

EndpointAdminRead OnlyAlert Push
POST /push/alertYesNoYes
POST /push/alertmanagerYesNoYes
All GET endpoints (account, API keys, audit, invites, teams, alerts, users)YesYesNo
POST /invite, DELETE /invite/{email}YesNoNo
POST /team, PATCH /team/{teamId}, DELETE /team/{teamId}YesNoNo
POST /team/{teamId}/member, DELETE /team/{teamId}/member/{username}YesNoNo
PATCH /team/{teamId}/alert/{alertId} (acknowledge or close)YesNoNo
DELETE /user/{username}YesNoNo

All paths are under /account/{accountId}. The reference pages list the role each endpoint needs.

When you delete a key or change its roles, the change can take a few minutes to apply. During that time, the old key may still work.

StatusMeaning
401 UnauthorizedThe Authorization header is missing or blank
403 ForbiddenThe header is present but the request is denied

A 403 can mean any of the following:

  • The key is incorrect or doesn’t exist (for example, it was deleted)
  • The key belongs to a different account than the one in the URL
  • The account is inactive, or its trial has expired
  • The key’s roles don’t allow the endpoint
  • The endpoint isn’t available in the API

A request to a path that doesn’t exist also returns 403.

See Errors for all status codes.

  • Use keys on servers only. The API doesn’t support browser requests, and a key in front-end code is visible to everyone.
  • Use the narrowest role. Give monitoring tools Alert Push, and reporting tools Read Only.
  • Use one key per tool. You can then delete one key without breaking the others.
  • Store keys in a secrets manager. Don’t put them in source code or chat messages.
  • Rotate keys regularly. Create a new key, update your tools to use it, then delete the old key in the app.
  • Delete keys you no longer use. Your account can have up to 10 keys.