Created on
‎06-17-2025
09:51 AM
Edited on
‎07-07-2025
10:21 PM
By
Anthony_E
Description | This article describes how to create a Certificate Template and generate certificates for FortiGates using the FortiManager JSON API. |
Scope | FortiManager. |
Solution |
FortiManager Certificate Template has two types of certificate templates:
{
"method": "add",
"params": [
{
"data": {
"name": "{{CERT_NAME}}",
"digest-type": "sha256",
"key-size": "4096",
"key-type": "rsa",
"type": "local",
"organization-unit": "{{OU}}",
"organization": "{{ORG}}",
"city": "{{CITY}}",
"email": "{{EMAIL}}",
"state": "{{STATE}}",
"country": "{{COUNTRY}}"
},
"url": "/pm/config/adom/{{ADOM}}/obj/certificate/template"
}
],
"id": "1",
"session": "{{session}}"
}
{
"method": "add",
"params": [
{
"data": {
"name": "{{CERT_NAME}}",
"digest-type": "sha256",
"key-size": "4096",
"key-type": "rsa",
"type": "external",
"organization-unit": "{{OU}}",
"organization": "{{ORG}}",
"city": "{{CITY}}",
"email": "{{EMAIL}}",
"state": "{{STATE}}",
"country": "{{COUNTRY}}",
"id-type": "host-ip",
"subject-name": "{{IP}}",
"scep-server": "{{SCEP_Server_URL}}",
"scep-password": "{{SCEP_Challenge_Password}}}",
"scep-ca-identifier": "{{SCEP_Identifier}}"
},
"url": "/pm/config/adom/{{ADOM}}/obj/certificate/template"
}
],
"id": "1",
"session": "{{session}}"
}
{
"method": "exec",
"params": [
{
"url": "/securityconsole/sign/certificate/template",
"data": {
"adom": "root",
"template": "adom/{{ADOM}}/obj/certificate/template/{{CERT_NAME}}",
"scope": [
{
"name": "{{FortiGate_Device_Name}}",
"vdom": "root"
}
]
}
}
],
"id": "1",
"session": "{{session}}"
}
This creates a new Task. In this case, task #5 - check the task to see progress: {
"method": "get",
"params": [
{
"url": "/task/task/5"
}
],
"id": "1",
"session": "{{session}}"
}
Sample output:
The same Task can be checked in FortiManager GUI: System Settings -> Task Monitor:
{
"method": "get",
"params": [
{
"url": "/pm/config/device/{{FortiGate_Device_Name}}/vdom/{{VDOM}}/vpn/certificate/local/{{CERT_NAME}}"
}
],
"id": "1",
"session": "{{session}}"
}
Sample output:
On FortiManager GUI: Device Manager -> Device & Objects -> Managed FortiGate -> Select the FortiGate > System -> Certificates:
Note:
In case the certificate generation fails (in step 2), use the debug commands below to collect logs:
diagnose debugs application securityconsole 255
diagnose de en
Attached is the Postman API collection, which can be imported directly into Postman
Related documents:
Technical Tip: Using FortiManager API Fortinet Development Network (FNDN) - FortiManager FortiAuthenticator Certificate Management Technical Tip: Certificate Template with SCEP enrollment, using FortiAuthenticator as external CA Technical Tip: How to create a CLI Template and Pre-Run CLI Template using JSON API Technical Tip: How to create IPSec Template and assign to a device using JSON API |
The Fortinet Security Fabric brings together the concepts of convergence and consolidation to provide comprehensive cybersecurity protection for all users, devices, and applications and across all network edges.
Copyright 2025 Fortinet, Inc. All Rights Reserved.