How to add Action to a device using API

I am trying to create devices using the API. There is an API to create a new Command. I don’t see an API to create a new Action.

How can I add Action to a device?

Also when using the API to create a device, the API doesn’t take the Template parameter.

curl -H "BOND-Token: xyz" -X POST -i http://192.168.1.2/v2/devices -d "{"name": "Test2","type": "GX","subtype": "AWNING","template": "A1","location": "Kitchen"}"

Response:
HTTP/1.1 500 Internal Server Error
Content-Length: 46
Content-Type: application/json; charset=utf-8

{"_error_id":1,"_error_msg":"name required"}

How can I either add actions to a device or use a Template when creating a device?