This is the documentation page for an unsupported version of Zabbix.
Is this not what you were looking for? Switch to the current version or choose one from the drop-down menu.



object template.create(object/array templates)

This method allows to create new templates.

This method is only available to Admin and Super admin user types. Permissions to call the method can be revoked in user role settings. See User roles for more information.


(object/array) Templates to create.

Additionally to the standard template properties, the method accepts the following parameters.

Parameter Type Description
object/array Host groups to add the template to.

The host groups must have the groupid property defined.
tags object/array Template tags.
templates object/array Templates to be linked to the template.

The templates must have the templateid property defined.
macros object/array User macros to be created for the template.
hosts object/array Hosts to link the template to.

The hosts must have the hostid property defined.

Return values

(object) Returns an object containing the IDs of the created templates under the templateids property. The order of the returned IDs matches the order of the passed templates.


Creating a template

Create a template with tags and link it to two hosts.


           "jsonrpc": "2.0",
           "method": "template.create",
           "params": {
               "host": "Linux template",
               "groups": {
                   "groupid": 1
               "hosts": [
                       "hostid": "10084"
                       "hostid": "10090"
               "tags": [
                       "tag": "Host name",
                       "value": "{HOST.NAME}"
           "auth": "038e1d7b1735c6a5436ee9eae095879e",
           "id": 1


           "jsonrpc": "2.0",
           "result": {
               "templateids": [
           "id": 1


CTemplate::create() in ui/include/classes/api/services/CTemplate.php.