Setting up API keys
In the previous example, we made an API call internally using the webGUI. To make an external call, we need to configure the API's authentication.
API authentication in OPNsense can be created by associating a key and a secret with an existing user. To create an API key and secret for the root user, follow these steps:
- On the webGUI, go to System | Access | Users and edit the root user:
- On the user's edit page, click the + button under API keys:
- This will save a text file that contains the API's key and secret:
key=xc8Odoms2r+a45Z9UOXG8drL5MHl+PkeUOrCTbj9abxZ7SDlFUJZ vp8s23uGB5eygqQDrl5wTv7f/yJm secret=RzYoJ/uw+8btPCbXVljqijDLRIywXpOUg2xmeashsl/l/+XhR D1DHaNVu0N3yq2xV1BJKdhoi1txcsnm
This file contains two lines. The first line specifies the API's...