> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://api.alsona.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://api.alsona.com/_mcp/server.

# Update template

PUT https://alsona.com/rest/accounts/{account_id}/templates/{template_id}
Content-Type: application/json

Update a template.

**Request body fields:**
- `group` (string, required) - Template group identifier (e.g. `account_workflows`).
- `workflow` (object, required for workflow templates) - Contains `name`, `description`, and `body` (nodes + edges graph).
  - `body.nodes` (array) - Workflow action nodes (type: `start-node` | `action-node`).
  - `body.edges` (array) - Connections between nodes.
- `name` (string, optional on update) - Template display name.

Reference: https://api.alsona.com/api-reference/templates/update-template

## Authentication

- `X-API-KEY` header (required)

## Request

### Path parameters

- `account_id` (string, required)
- `template_id` (string, required)

### Body (application/json)

- `name` (string, required)
- `group` (string, required)

## Response

### 200

- `success` (boolean, required)
- `template_new` (object, required)
  - `name` (string, required)
  - `group` (string, required)
  - `account_id` (string, required)
  - `template_id` (string, required)
- `template_old` (object, required)
  - `name` (string, required)
  - `group` (string, required)
  - `account_id` (string, required)
  - `created_at` (integer, required)
  - `updated_at` (integer, required)
  - `description` (string, required)
  - `template_id` (string, required)

## Examples

### Response

**Request**

```json
undefined
```

**Response**

```json
{
  "success": true,
  "template_new": {
    "name": "Business Coaches - USA",
    "group": "account_workflows",
    "account_id": "ACCO136ce10b5f8a7682efb3",
    "template_id": "template_3cd3786f8006f39d4a73"
  },
  "template_old": {
    "name": "Business Coaches - US",
    "group": "account_workflows",
    "account_id": "ACCO136ce10b5f8a7682efb3",
    "created_at": 1753382019986,
    "updated_at": 1753382019986,
    "description": "Business Coaches - US",
    "template_id": "template_3cd3786f8006f39d4a73"
  }
}
```

**SDK Code**

```python Response
import requests

url = "https://alsona.com/rest/accounts/account_id/templates/template_id"

headers = {"X-API-KEY": "<apiKey>"}

response = requests.put(url, headers=headers)

print(response.json())
```

```javascript Response
const url = 'https://alsona.com/rest/accounts/account_id/templates/template_id';
const options = {method: 'PUT', headers: {'X-API-KEY': '<apiKey>'}};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Response
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://alsona.com/rest/accounts/account_id/templates/template_id"

	req, _ := http.NewRequest("PUT", url, nil)

	req.Header.Add("X-API-KEY", "<apiKey>")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Response
require 'uri'
require 'net/http'

url = URI("https://alsona.com/rest/accounts/account_id/templates/template_id")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Put.new(url)
request["X-API-KEY"] = '<apiKey>'

response = http.request(request)
puts response.read_body
```

```java Response
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.put("https://alsona.com/rest/accounts/account_id/templates/template_id")
  .header("X-API-KEY", "<apiKey>")
  .asString();
```

```php Response
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('PUT', 'https://alsona.com/rest/accounts/account_id/templates/template_id', [
  'headers' => [
    'X-API-KEY' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

```csharp Response
using RestSharp;

var client = new RestClient("https://alsona.com/rest/accounts/account_id/templates/template_id");
var request = new RestRequest(Method.PUT);
request.AddHeader("X-API-KEY", "<apiKey>");
IRestResponse response = client.Execute(request);
```

```swift Response
import Foundation

let headers = ["X-API-KEY": "<apiKey>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://alsona.com/rest/accounts/account_id/templates/template_id")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "PUT"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

### Templates_Update template_example

**Request**

```json
{
  "name": "Business Coaches - USA",
  "group": "account_workflows"
}
```

**Response**

```json
{
  "success": true,
  "template_new": {
    "name": "Business Coaches - USA",
    "group": "account_workflows",
    "account_id": "ACCO136ce10b5f8a7682efb3",
    "template_id": "template_3cd3786f8006f39d4a73"
  },
  "template_old": {
    "name": "Business Coaches - US",
    "group": "account_workflows",
    "account_id": "ACCO136ce10b5f8a7682efb3",
    "created_at": 1753382019986,
    "updated_at": 1753382019986,
    "description": "Business Coaches - US",
    "template_id": "template_3cd3786f8006f39d4a73"
  }
}
```

**SDK Code**

```python Templates_Update template_example
import requests

url = "https://alsona.com/rest/accounts/account_id/templates/template_id"

payload = {
    "name": "Business Coaches - USA",
    "group": "account_workflows"
}
headers = {
    "X-API-KEY": "<apiKey>",
    "Content-Type": "application/json"
}

response = requests.put(url, json=payload, headers=headers)

print(response.json())
```

```javascript Templates_Update template_example
const url = 'https://alsona.com/rest/accounts/account_id/templates/template_id';
const options = {
  method: 'PUT',
  headers: {'X-API-KEY': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"name":"Business Coaches - USA","group":"account_workflows"}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Templates_Update template_example
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://alsona.com/rest/accounts/account_id/templates/template_id"

	payload := strings.NewReader("{\n  \"name\": \"Business Coaches - USA\",\n  \"group\": \"account_workflows\"\n}")

	req, _ := http.NewRequest("PUT", url, payload)

	req.Header.Add("X-API-KEY", "<apiKey>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Templates_Update template_example
require 'uri'
require 'net/http'

url = URI("https://alsona.com/rest/accounts/account_id/templates/template_id")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Put.new(url)
request["X-API-KEY"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"name\": \"Business Coaches - USA\",\n  \"group\": \"account_workflows\"\n}"

response = http.request(request)
puts response.read_body
```

```java Templates_Update template_example
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.put("https://alsona.com/rest/accounts/account_id/templates/template_id")
  .header("X-API-KEY", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"name\": \"Business Coaches - USA\",\n  \"group\": \"account_workflows\"\n}")
  .asString();
```

```php Templates_Update template_example
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('PUT', 'https://alsona.com/rest/accounts/account_id/templates/template_id', [
  'body' => '{
  "name": "Business Coaches - USA",
  "group": "account_workflows"
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'X-API-KEY' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

```csharp Templates_Update template_example
using RestSharp;

var client = new RestClient("https://alsona.com/rest/accounts/account_id/templates/template_id");
var request = new RestRequest(Method.PUT);
request.AddHeader("X-API-KEY", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"name\": \"Business Coaches - USA\",\n  \"group\": \"account_workflows\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Templates_Update template_example
import Foundation

let headers = [
  "X-API-KEY": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "name": "Business Coaches - USA",
  "group": "account_workflows"
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://alsona.com/rest/accounts/account_id/templates/template_id")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "PUT"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```