Customer Service
Customer Service Information and Announcements
lpizziniaco
Staff
Staff
Article Id 386326
Description This article describes how to access FortiFlex licensing system using API calls to retrieve OAuth token and make calls over the system.
Scope FortiFlex.
Solution

Whenever a user needs to make automatic some operations on the FortiFlex licensing system, like retrieving information or managing FortiFlex licenses, it is possible to access them using Fortinet’s FortiFlex public API. This guide explains how to the access and the usage. 

 

Create an API User.

 

To use the FortiFlex API, first create and configure an API User.

  1. Log in to the FortiCloud IAM portal.

  2. Create a new API User for the account. See FortiCloud IAM: Adding an API User - FortiCloud documentation.

  3. Assign the required permissions for FortiFlex:

    • Admin, ReadWrite, or ReadOnly  depending on the use case.

 

Retrieve a Token.

 

Using a tool like postman to perform an API request as shown below will generate a Bearer token. This token will be used to authenticate subsequent API calls.

 

Method:

POST

Endpoint:
https://customerapiauth.fortinet.com/api/v1/oauth/token/
Request Body:

{
  "username": "<API Username>",
  "password": "<API Password>",
  "client_id": "flexvm",
  "grant_type": "password"
}

If successful, the response will look like this:

{
  "access_token": "theTokenNeeded",
  "expires_in": 3660,
  "token_type": "Bearer",
  "scope": "read write",
  "refresh_token": "lessInterestingToken",
  "message": "successfully authenticated",
  "status": "success"
}

 

The theTokenNeeded will be used for the further calls.

 

A practical example: Call FortiFlex Points History API.

 

Once the token is acquired, it can be used to authenticate further requests like get the FortiFlex points history with the following API request:

 

Method:

POST

Endpoint:
https://support.fortinet.com/ES/api/fortiflex/v2/entitlements/points
Headers:
Authorization: Bearer <theTokenNeeded>
Request Body:

{
  "accountId": "<IAM Account ID>",
  "programSerialNumber": "<FortiFlex Serial Number>",
  "startDate": "2024-03-06",
  "endDate": "2025-04-03"
}

 

If successful, the answer would be like:

 

{
  "entitlements": [
    {
      "points": 117.30000000,
      "serialNumber": "FGVMELTM123456",
      "accountId": 123456
    },
...
   ],
  "error": null,
  "message": "Request processed successfully.",
  "status": 0
}

 

API Documentation:

official API reference