Fortinet white logo
Fortinet white logo

Rest API

7.4.0

Generate an API Token

Generate an API Token

Each REST API request requires an API token to be authenticated. An API token is generated by creating a new REST API admin.

The steps below must be performed from the FortiNAC GUI as an Administrator with a profile that allows Admin User creation and are customized for this tutorial.

Step 1: Determine your Source Address

The source address is needed to ensure the API token can only be used from trusted hosts. To obtain this address, locate the IP Address of the machine you are going to be issuing the REST API request from. Keep track of this for later use when we create the API user.

Step 2: Create an Administrator profile

The REST API admin should have the minimum permissions required to complete the request.

In this tutorial, we will create a profile that only has Read access to the Host API.

  1. On the FortiNAC GUI, select User > Admin Profiles and click the Add button.
  2. Populate the fields as shown in the following images:
  3. Click OK.

Step 3: Create the REST API Admin

Use the steps below to create the FortiNAC API admin.

  1. On the FortiNAC GUI, select System > Admin Users and click the Add button.
  2. Populate the User ID you would like to use.
  3. Click OK.
  4. Select the Admin Profile that you created in the previous steps and fill in the required additional information.
  5. Select the checkbox that indicates you want this User to have API access and generate a token.
  6. Copy down this token as it will need to be included in your REST API calls and will be hidden after this configuration is completed.
  7. Make sure you enter the Allowed Subnets ( in this case the IP Address you used with a mask of 32 ).
  8. Click OK to finish creating this User.

Next: Your First API Request

Generate an API Token

Generate an API Token

Each REST API request requires an API token to be authenticated. An API token is generated by creating a new REST API admin.

The steps below must be performed from the FortiNAC GUI as an Administrator with a profile that allows Admin User creation and are customized for this tutorial.

Step 1: Determine your Source Address

The source address is needed to ensure the API token can only be used from trusted hosts. To obtain this address, locate the IP Address of the machine you are going to be issuing the REST API request from. Keep track of this for later use when we create the API user.

Step 2: Create an Administrator profile

The REST API admin should have the minimum permissions required to complete the request.

In this tutorial, we will create a profile that only has Read access to the Host API.

  1. On the FortiNAC GUI, select User > Admin Profiles and click the Add button.
  2. Populate the fields as shown in the following images:
  3. Click OK.

Step 3: Create the REST API Admin

Use the steps below to create the FortiNAC API admin.

  1. On the FortiNAC GUI, select System > Admin Users and click the Add button.
  2. Populate the User ID you would like to use.
  3. Click OK.
  4. Select the Admin Profile that you created in the previous steps and fill in the required additional information.
  5. Select the checkbox that indicates you want this User to have API access and generate a token.
  6. Copy down this token as it will need to be included in your REST API calls and will be hidden after this configuration is completed.
  7. Make sure you enter the Allowed Subnets ( in this case the IP Address you used with a mask of 32 ).
  8. Click OK to finish creating this User.

Next: Your First API Request