You can use the PhishER GraphQL API to connect PhishER to your own tools. These tools can include a sandbox, a security orchestration, automation, and response (SOAR) platform, or your own scripts. For example, after your sandbox analyzes a reported message, your tool can run a PhishER action on that message without anyone logging in to PhishER.
To connect a tool to the PhishER API, you'll need an API token. You can create and manage API tokens from the API Tokens tab of your PhishER Integrations settings. For details about the requests you can make, see the PhishER API documentation on the KnowBe4 Developers KnowBe4 Developers (link opens in new window) site.
Before You Begin
Keep the following information in mind before you create an API token:
- To view the API Tokens tab, you need a security role with permission to view settings. To create or change tokens, you need permission to edit settings.
- Each token belongs to one PhishER user. The token can only do what that user can do. It uses the user's security role and tag restrictions, so the token can't access messages the user can't view.
- You can't create a token while you're logged in as another user.
Create an API Token
To create an API token, follow the steps below:
- In PhishER, click Settings > Integrations, then click the API Tokens tab.
- Click Create token.
- In the Name field, enter a name that describes where you'll use the token. For example, you might enter "SIEM integration" for a token that your security information and event management (SIEM) tool uses. The name can be up to 50 characters.
- From the User drop-down menu, select the user the token belongs to. The token uses this user's security role and tag restrictions.
- In the Expiration date field, choose a date. The date can't be more than 5 years from today.
- Click Create token. The API token created pop-up window opens.
- Click the copy icon, then store the token in a safe place, such as your organization's password manager.
- Click Done.
Use Your API Token
To make a request, send your token in the Authorization header. For example:
Authorization: Bearer <your token>Your token works with the PhishER API only. For the endpoint URL and the full list of requests, see the PhishER API documentation on the KnowBe4 Developers site KnowBe4 Developers site (link opens in new window).
Manage Your API Tokens
On the API Tokens tab, you can view every token for your account. For each token, the table shows its name, user, status, expiration date, when it was last used, and when it was created. If a token hasn't been used yet, the table shows Never.
Each token has one of the following statuses:
- Active: The token works, and your tools can use it to make requests.
- Inactive: Someone deactivated the token. Requests that use it fail until you activate it again.
- Expired: The token passed its expiration date. You can't activate an expired token, so you'll need to create a new one.
To manage a token, click the ellipses icon in the Actions column of its row. The options you see depend on the token's status:
- Deactivate: This option displays for active tokens. This option stops the token from working without deleting it. Use this option if you think the token was exposed or if you're pausing an integration.
- Activate: This option displays for inactive tokens. It turns the token back on. You can't activate a token if it has expired or if its user no longer has access to PhishER.
- Delete: This option displays for inactive tokens. It permanently deletes the token. To delete an active token, deactivate it first.
After you select an option, a confirmation pop-up window opens. Click Deactivate, Activate, or Delete to confirm.
Rate Limits
To keep the API stable for everyone, PhishER limits how many requests each token and each account can make.
If you go over a limit, the API returns an HTTP 429 error. The error includes a Retry-After header that tells your tool how long to wait before it tries again.
Frequently Asked Questions
Why Does My Tool Get a "not_authorized" Error?
The API returns a "not_authorized" error when the token is inactive, expired, or not valid. It also returns this error if the token's user no longer has access to PhishER. Check the token's status on the API Tokens tab, then confirm the user's account is active.
What Can I Do with the PhishER API?
You can view and update messages, add comments and tags, manage rules, view your actions, and run an action on up to 200 messages at a time. For the full list, see the PhishER API documentation on the KnowBe4 Developers KnowBe4 Developers (link opens in new window) site.
Can I Still Use My KSAT API Token for PhishER?
Yes. If you already use a KSAT API token to make PhishER requests, it still works. You don't need to replace it with a PhishER API token.