How To Set the Maximum Number of Images using API Commands
308
Created On 01/31/23 15:22 PM - Last Modified 10/30/25 20:57 PM
Objective
The 'set max-num-images count' command must be ran directly in the firewall's CLI. There is an API command that can be used to change the maximum number of software images as well. The following are the API commands that can be used via the web browser to set the maximum number of images allowed at any one time on the Firewall or Panorama. It is also possible to use a python (or other) script with these API commands to perform bulk firewall modification. However the scripting would need to be performed on the customer side.
Environment
Currently modifying the maximum number of PANOS images downloaded on the Firewall's or Panorama must be performed via the CLI on each device separately. In the case of a large amount of firewalls this can become time consuming. The following steps detail how to accomplish this same task using API commands via the web browser.
These same API commands can be used in an automated script as well, however this document will show how to use the web browser to accomplish this.
Procedure
The following are the steps to achieve setting the maximum number of images. Please note any text below inside <> will need replaced with the customer's devices specific information:
(1) First run the following as to output the KEY information to be used in the remaining step(s). This provides the authentication to the firewall or Panorama:
https://<FIREWALL_IP>/api/?type=keygen&user=<USERNAME>&password=<PASSWORD>
NOTE: For <FIREWALL_IP> replace with actual firewalls/Panorama management IP address or FQDN. For <USERNAME> and <PASSWORD> substitute with valid login credentials.
OUTPUT (sample):
<response status="success">
<result>
<key>LUF3042987010WVNaGp6344628UFwbGhkMm30429870101276344628TNaS1MyYQ==</key>
</result>
</response>
NOTE: In the above output the key would be:
LUF3042987010WVNaGp6344628UFwbGhkMm30429870101276344628TNaS1MyYQ==
(2) Once the KEY is found from the previous step, replace <API_KEY> below with the actual KEY from step 1 above:
(A) To set the Firewall's MAX image count to '3':
https://<FIREWALL_IP>/api/?key=<API_KEY>&type=op&cmd=<set><max-num-images><count>3</count></max-num-images></set>
OUTPUT:
<response status="success">
<result>Maximum number of images to keep is set to 3</result>
</response>
NOTE: Above '3' was chosen as an example. As of 10.0 PANOS code the range of values are: <value> <2-64>
(B) Use the following API command in the web browser to display the currently max-num-images value:
https://<FIREWALL_IP>/api/?key=<API_KEY>&type=op&cmd=<show><max-num-images></max-num-images></show>
OUTPUT:
<response status="success">
<result>Maximum images to keep is set to 3</result>
</response>
(C) Can also verify in the firewall's CLI that the change was successful:
> show max-num-images
Additional Information
Main API documentation for 10.1:
Get Started with the PAN-OS XML API
https://docs.paloaltonetworks.com/pan-os/10-1/pan-os-panorama-api/get-started-with-the-pan-os-xml-api