> For a complete page index, fetch https://developer.close.com/llms.txt # Update an SMS template PUT https://api.close.com/api/v1/sms_template/{id}/ Content-Type: application/json Reference: https://developer.close.com/api/resources/sms-templates/update ## Authentication - `Authorization` header (basic auth, required) — Use your API key as the username and leave the password empty. - `Authorization` header (bearer token, required) — Bearer authentication of the form `Bearer `, where token is your auth token. ## Request ### Path parameters - `id` (string, required) ### Body (application/json) This endpoint expects an UpdateSMSTemplate. - `attachments` (list of UpdateSMSTemplateAttachment, optional) - `is_shared` (boolean, optional) - `name` (string, optional) - `status` (enum, optional) - Allowed values: `active`, `archived` - `text` (string, optional) ## Response ### 200 Successful response ## Errors ### 400 Bad Request Error Bad request - `any` ### 401 Unauthorized Error Unauthorized - `any` ### 404 Not Found Error Not found - `any` ## Types ### UpdateSMSTemplateAttachment - `content_type` (string, required) - `filename` (string, required) - `url` (string, required) ## Examples **Request** ```json { "is_shared": true } ``` **Response** ```json { "created_by": "user_edP6Tb2nqUe1iGz9mjkFb30RXPzz1mbPbGWbwVW0EGI", "date_created": "2022-09-26T15:08:02.738160", "date_updated": "2022-09-26T15:08:02.753292", "id": "smstmpl_5qJHPcWbk9XbDwCjP7osdX", "is_shared": true, "name": "changed name", "organization_id": "orga_RbREgmiiwcr1w2b4cOnCMQaQPSIFxMqAD2Dh243uxcH", "owned_by": "user_edP6Tb2nqUe1iGz9mjkFb30RXPzz1mbPbGWbwVW0EGI", "status": "active", "text": "This is a test template.", "updated_by": "user_edP6Tb2nqUe1iGz9mjkFb30RXPzz1mbPbGWbwVW0EGI" } ``` **SDK Code** ```python sms_templates_update_example import requests url = "https://api.close.com/api/v1/sms_template/id/" payload = { "is_shared": True } headers = { "Content-Type": "application/json" } response = requests.put(url, json=payload, headers=headers, auth=("", "")) print(response.json()) ``` ```javascript sms_templates_update_example const url = 'https://api.close.com/api/v1/sms_template/id/'; const credentials = btoa(":"); const options = { method: 'PUT', headers: {Authorization: `Basic ${credentials}`, 'Content-Type': 'application/json'}, body: '{"is_shared":true}' }; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go sms_templates_update_example package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.close.com/api/v1/sms_template/id/" payload := strings.NewReader("{\n \"is_shared\": true\n}") req, _ := http.NewRequest("PUT", url, payload) req.SetBasicAuth("", "") 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 sms_templates_update_example require 'uri' require 'net/http' url = URI("https://api.close.com/api/v1/sms_template/id/") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Put.new(url) request.basic_auth("", "") request["Content-Type"] = 'application/json' request.body = "{\n \"is_shared\": true\n}" response = http.request(request) puts response.read_body ``` ```java sms_templates_update_example import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.put("https://api.close.com/api/v1/sms_template/id/") .basicAuth("", "") .header("Content-Type", "application/json") .body("{\n \"is_shared\": true\n}") .asString(); ``` ```php sms_templates_update_example request('PUT', 'https://api.close.com/api/v1/sms_template/id/', [ 'body' => '{ "is_shared": true }', 'headers' => [ 'Content-Type' => 'application/json', ], 'auth' => ['', ''], ]); echo $response->getBody(); ``` ```csharp sms_templates_update_example using RestSharp; using RestSharp.Authenticators; var client = new RestClient("https://api.close.com/api/v1/sms_template/id/"); client.Authenticator = new HttpBasicAuthenticator("", ""); var request = new RestRequest(Method.PUT); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"is_shared\": true\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ```