[comment]: # ({984854ac-984854ac})
# hostprototype.create

[comment]: # ({/984854ac-984854ac})

[comment]: # ({8604fbe5-8604fbe5})
### Description

`object hostprototype.create(object/array hostPrototypes)`

This method allows to create new host prototypes.

[comment]: # ({/8604fbe5-8604fbe5})

[comment]: # ({b172c252-b172c252})
### Parameters

`(object/array)` Host prototypes to create.

Additionally to the [standard host prototype
properties](object#host_prototype), the method accepts the following
parameters.

|Parameter|[Type](/manual/api/reference_commentary#data_types)|Description|
|---------|---------------------------------------------------|-----------|
|**groupLinks**<br>(required)|array|Group links to be created for the host prototype.|
|**ruleid**<br>(required)|string|ID of the LLD rule that the host prototype belongs to.|
|groupPrototypes|array|Group prototypes to be created for the host prototype.|
|inventory|object|Host prototype inventory properties.|
|templates|object/array|Templates to be linked to the host prototype.<br><br>The templates must have the `templateid` property defined.|

[comment]: # ({/b172c252-b172c252})

[comment]: # ({b9613119-b9613119})
### Return values

`(object)` Returns an object containing the IDs of the created host
prototypes under the `hostids` property. The order of the returned IDs
matches the order of the passed host prototypes.

[comment]: # ({/b9613119-b9613119})

[comment]: # ({b41637d2-b41637d2})
### Examples

[comment]: # ({/b41637d2-b41637d2})

[comment]: # ({a0f128a7-a0f128a7})
#### Creating a host prototype

Create a host prototype "{\#VM.NAME}" on LLD rule "23542" with a group
prototype "{\#HV.NAME}". Link it to host group "2".

Request:

``` {.java}
{
    "jsonrpc": "2.0",
    "method": "hostprototype.create",
    "params": {
        "host": "{#VM.NAME}",
        "ruleid": "23542",
        "groupLinks": [
            {
                "groupid": "2"
            }
        ],
        "groupPrototypes": [
            {
                "name": "{#HV.NAME}"
            }
        ]
    },
    "auth": "038e1d7b1735c6a5436ee9eae095879e",
    "id": 1
}
```

Response:

``` {.java}
{
    "jsonrpc": "2.0",
    "result": {
        "hostids": [
            "10103"
        ]
    },
    "id": 1
}
```

[comment]: # ({/a0f128a7-a0f128a7})

[comment]: # ({cf1c169a-cf1c169a})
### See also

-   [Group link](object#group_link)
-   [Group prototype](object#group_prototype)
-   [Host prototype inventory](object#host_prototype_inventory)

[comment]: # ({/cf1c169a-cf1c169a})

[comment]: # ({f3236799-f3236799})
### Source

CHostPrototype::create() in
*frontends/php/include/classes/api/services/CHostPrototype.php*.

[comment]: # ({/f3236799-f3236799})
