Fortinet white logo
Fortinet white logo

Administration Guide

Creating administrators for the FortiManager API

Creating administrators for the FortiManager API

In order to use the FortiManager JSON API, you must first create an administrator.

The type of administrator required depends on if you will be using a predefined API key or session-based authentication.

  • Predefined API key: A REST API Admin is used to generate a permanent API key, which means the same user account will always share the same session and you do not need to use the login/logout endpoints. Because of this benefit, predefined API keys are useful for simplifying automation workflows.

  • Session-based authentication: A regular FortiManager administrator with JSON API access is used with the login operation in order to get a session ID that is used in API requests.

Both types of administrators also require that you assign an Admin Profile with the appropriate permissions to complete the desired operations.

For more information on using the FortiManager JSON API, see the Fortinet Developer Network (FNDN).

To create REST API administrator with a predefined API key:
  1. Go to System Settings > Administrators.

  2. Click the Create New dropdown and choose REST API Admin.

  3. Configure the following required information:

    User Name Enter a username.
    Admin Profile Select an admin profile that provides appropriate permissions required to complete the operations needed using the API.
    JSON API Access Select Read or Read-Write access, depending on your need.
    PKI Group

    (Optional) Certificate matching is supported as an extra layer of security. Both the client certificate and token must match to be granted access to the API.

    CORS Allow Origin

    (Optional) Cross Origin Resource Sharing (CORS) allows third-party web apps to make API requests to the FortiManager using the token.

    Trusted Hosts

    At least one trusted host must be configured. This trusted host should align with the IP range where the API requests will originate from.

  4. Configure any remaining settings as required, such as additional role-based access control settings to restrict the administrator to specific ADOMs, policy packages, or policy blocks.

  5. Click OK to create the REST API Admin.
    An API key is automatically generated for the REST API Admin. The API key is permanent and only shown once.

  6. Copy the API key. The generated API key can be used in the request header using the bearer authentication scheme.

  7. Optionally, you can generate a new API key by editing the REST API Admin and clicking Regenerate API Key.

To create an administrator for session-based authentication:
  1. Go to System Settings > Administrators.

  2. Click the Create New dropdown and choose Administrator.

  3. Configure the following required information:

    User Name Enter a username.

    New Password/Confirm Password

    Enter a password.

    Admin Profile Select an admin profile that provides appropriate permissions required to complete the operations needed using the API.
    JSON API Access Select Read or Read-Write access, depending on your need.
  4. Configure any remaining settings as required, such as additional role-based access control settings to restrict the administrator to specific ADOMs, policy packages, or policy blocks.

  5. Click OK to create the administrator.

    The username and password of this administrator will be used for the login operation on FortiManager which will generate a session ID which is used in API requests.

Creating administrators for the FortiManager API

Creating administrators for the FortiManager API

In order to use the FortiManager JSON API, you must first create an administrator.

The type of administrator required depends on if you will be using a predefined API key or session-based authentication.

  • Predefined API key: A REST API Admin is used to generate a permanent API key, which means the same user account will always share the same session and you do not need to use the login/logout endpoints. Because of this benefit, predefined API keys are useful for simplifying automation workflows.

  • Session-based authentication: A regular FortiManager administrator with JSON API access is used with the login operation in order to get a session ID that is used in API requests.

Both types of administrators also require that you assign an Admin Profile with the appropriate permissions to complete the desired operations.

For more information on using the FortiManager JSON API, see the Fortinet Developer Network (FNDN).

To create REST API administrator with a predefined API key:
  1. Go to System Settings > Administrators.

  2. Click the Create New dropdown and choose REST API Admin.

  3. Configure the following required information:

    User Name Enter a username.
    Admin Profile Select an admin profile that provides appropriate permissions required to complete the operations needed using the API.
    JSON API Access Select Read or Read-Write access, depending on your need.
    PKI Group

    (Optional) Certificate matching is supported as an extra layer of security. Both the client certificate and token must match to be granted access to the API.

    CORS Allow Origin

    (Optional) Cross Origin Resource Sharing (CORS) allows third-party web apps to make API requests to the FortiManager using the token.

    Trusted Hosts

    At least one trusted host must be configured. This trusted host should align with the IP range where the API requests will originate from.

  4. Configure any remaining settings as required, such as additional role-based access control settings to restrict the administrator to specific ADOMs, policy packages, or policy blocks.

  5. Click OK to create the REST API Admin.
    An API key is automatically generated for the REST API Admin. The API key is permanent and only shown once.

  6. Copy the API key. The generated API key can be used in the request header using the bearer authentication scheme.

  7. Optionally, you can generate a new API key by editing the REST API Admin and clicking Regenerate API Key.

To create an administrator for session-based authentication:
  1. Go to System Settings > Administrators.

  2. Click the Create New dropdown and choose Administrator.

  3. Configure the following required information:

    User Name Enter a username.

    New Password/Confirm Password

    Enter a password.

    Admin Profile Select an admin profile that provides appropriate permissions required to complete the operations needed using the API.
    JSON API Access Select Read or Read-Write access, depending on your need.
  4. Configure any remaining settings as required, such as additional role-based access control settings to restrict the administrator to specific ADOMs, policy packages, or policy blocks.

  5. Click OK to create the administrator.

    The username and password of this administrator will be used for the login operation on FortiManager which will generate a session ID which is used in API requests.