Skip to content

Updates a template.

Request

Security
Basic or oAuth2
Path
project_idstringrequired

Required. The project ID.

template_idstringrequired

The id of the template to be updated. Specified or automatically generated during template creation. Unique per project.

Bodyapplication/jsonrequired

Required. The updated template.

idstring

The id of the template. Specify this yourself during creation. Otherwise, we will generate an ID for you. This must be unique for a given project.

Example:"id_string"
descriptionstring

The description of the template.

Example:"Template description"
versioninteger

The version of the template. While creating a template, this will be defaulted to 1. When updating a template, you must supply the latest version of the template in order for the update to be successful.

Example:1
default_translationstring

The default translation to use if not specified. Specified as a BCP-47 language_code and the language_code must exist in the translations list.

Example:"en-US"
translationsArray of objects(v2TemplateTranslation)
curl -i -X PUT \
  -u '<username>:<password>' \
  'https://us.template.api.sinch.com/v2/projects/{project_id}/templates/{template_id}' \
  -H 'Content-Type: application/json' \
  -d '{
    "id": "<template id>",
    "description": "English text template with one parameter using Conversation API generic format.",
    "version": 1,
    "default_translation": "en-US",
    "translations": [
      {
        "language_code": "en-US",
        "version": "1",
        "variables": [
          {
            "key": "name",
            "preview_value": "Mr Jones"
          }
        ],
        "text_message": {
          "text": "Hi ${name}"
        },
        "channel_template_overrides": {
          "WHATSAPP": {
            "template_reference": {
              "template_id": "<referenced template id>",
              "version": "1",
              "language_code": "en-US",
              "parameters": {
                "body[1]text": "defaultValue"
              }
            },
            "parameter_mappings": {
              "body[1]text": "name"
            }
          }
        }
      }
    ]
  }'

Responses

A successful response.

Bodyapplication/json
idstring

The id of the template. Specify this yourself during creation. Otherwise, we will generate an ID for you. This must be unique for a given project.

Example:"id_string"
descriptionstring

The description of the template.

Example:"Template description"
versioninteger

The version of the template. While creating a template, this will be defaulted to 1. When updating a template, you must supply the latest version of the template in order for the update to be successful.

Example:1
default_translationstring

The default translation to use if not specified. Specified as a BCP-47 language_code and the language_code must exist in the translations list.

Example:"en-US"
translationsArray of objects(v2TemplateTranslation)
create_timestring, (date-time)read-only

Timestamp of when the template was created.

update_timestring, (date-time)read-only

Timestamp when the template was updated.

Response
{ "id": "id_string", "description": "Template description", "version": 1, "default_translation": "en-US", "translations": [ { … } ], "create_time": "2019-08-24T14:15:22Z", "update_time": "2019-08-24T14:15:22Z" }
We'd love to hear from you!
Rate this content: