# Update a template in project

Updates a template DRAFT.
    
    Note that it is not possible to update all fields for a template,
    if you want to update a field that is not supported you will need to delete the draft and create a new one.

    Update a template REJECTED / APPROVED / PAUSED / DISABLED

    It is possible to update templates that have been rejected, approved, paused or disabled, we will automatically set the status to draft when update a rejected template.

Endpoint: PATCH /v1/projects/{projectId}/whatsapp/templates/{templateName}/languages/{languageCode}
Version: 1.2.79
Security: BasicAuth, BearerAuth, OAuth2Production

## Path parameters:

  - `projectId` (string, required)
    The unique ID of the project. You can find this on the Sinch Dashboard.

  - `templateName` (string, required)
    The unique name of the template.

  - `languageCode` (string, required)
    The language code of the specific template.
    Enum: "AF", "AR", "AZ", "BG", "BN", "CA", "CS", "DA", "DE", "EL", "EN", "EN_GB", "EN_US", "ES", "ES_AR", "ES_ES", "ES_MX", "ET", "FA", "FI", "FIL", "FR", "GA", "GU", "HA", "HE", "HI", "HR", "HU", "ID", "IT", "JA", "KA", "KK", "KN", "KO", "KY_KG", "LO", "LT", "LV", "MK", "ML", "MR", "MS", "NB", "NL", "PA", "PL", "PT_BR", "PT_PT", "RO", "RU", "RW_RW", "SK", "SL", "SQ", "SR", "SV", "SW", "TA", "TE", "TH", "TR", "UK", "UR", "UZ", "VI", "ZH_CN", "ZH_HK", "ZH_TW", "ZU", "UNRECOGNIZED"

## Request fields (application/json):

  - `status` (string)
    Create as draft or submit. Defaults to draft.
    Enum: "DRAFT", "SUBMIT"

  - `category` (string)
    Works if status template is DRAFT or it was rejected with INCORRECT_CATEGORY.
    Enum: "AUTHENTICATION", "MARKETING", "UTILITY"

  - `allowCategoryChange` (boolean)
    Works if status template is DRAFT or it was rejected with INCORRECT_CATEGORY True if Meta should be allowed to change the category if they determine the category is wrong. If false, Meta might reject the template if they determine the category is wrong based on the template contents. Defaults to false.

  - `details` (object)
    'Template input details and information.' Not required for draft.

  - `details.components` (array)
    List of components in the template. Must contain a BODY component and can only have one entry of each type. Not required for draft. Field 'type' must have unique values across items.

  - `details.messageSendTtlSeconds` (number)
    Template message delivery retry time-to-live (TTL) override value. If unable to deliver the template message, it will be periodically retry for this period of time. If it is unable to deliver the message for this period of time, the message will be dropped.

|  | AUTHENTICATION | MARKETING | UTILITY |
| -- | -- | -- | -- |
| Default | 10 minutes | 30 days | 30 days |
| Customizable range | 10 seconds to 15 minutes | 12 hours to 30 days | 30 seconds to 12 hours |
| Valid values | 10 to 900 seconds | 43200 to 2592000 seconds | 30 to 43200 seconds |

  Please note that authentication templates created before October 23, 2024, have a default TTL of 30 days.

## Response 200 fields (application/json):

  - `name` (string, required)

  - `language` (string, required)
    Enum: "AF", "AR", "AZ", "BG", "BN", "CA", "CS", "DA", "DE", "EL", "EN", "EN_GB", "EN_US", "ES", "ES_AR", "ES_ES", "ES_MX", "ET", "FA", "FI", "FIL", "FR", "GA", "GU", "HA", "HE", "HI", "HR", "HU", "ID", "IT", "JA", "KA", "KK", "KN", "KO", "KY_KG", "LO", "LT", "LV", "MK", "ML", "MR", "MS", "NB", "NL", "PA", "PL", "PT_BR", "PT_PT", "RO", "RU", "RW_RW", "SK", "SL", "SQ", "SR", "SV", "SW", "TA", "TE", "TH", "TR", "UK", "UR", "UZ", "VI", "ZH_CN", "ZH_HK", "ZH_TW", "ZU", "UNRECOGNIZED"

  - `category` (string, required)
    Enum: "AUTHENTICATION", "MARKETING", "UTILITY", "UNRECOGNIZED"

  - `analytics` (array, required)
    Template analytics.

  - `analytics.sent` (number, required)
    Number of times template has been sent.

  - `analytics.delivered` (number, required)
    Number of times template has been delivered.

  - `analytics.read` (number, required)
    Number of times template has been read.

  - `analytics.start` (string, required)
    The UTC Date Time in ISO 8601 for start of date range.

  - `analytics.end` (string, required)
    The UTC Date Time in ISO 8601 for end of date range.

  - `analytics.buttons` (array, required)
    Number of times buttons in the template has been clicked.

  - `analytics.buttons.type` (string, required)
    Type of button.
    Enum: "QUICK_REPLY", "UNIQUE_URL", "URL", "UNRECOGNIZED"

  - `analytics.buttons.content` (string, required)
    Content of the button.

  - `analytics.buttons.clicks` (number, required)
    Number of times the button has been clicked.

  - `isMetaGenerated` (boolean, required)
    Indicates if the template was auto-generated by Meta.

  - `whatsappId` (string)

  - `state` (string)
    Enum: "APPROVED", "DISABLED", "PAUSED", "REJECTED"

  - `rejectionCode` (string)
    Rejection code if template is in status 'REJECTED'
    Enum: "ABUSIVE_CONTENT", "INCORRECT_CATEGORY", "INVALID_FORMAT", "NONE", "SCAM", "UNRECOGNIZED"

  - `qualityScore` (string)
    Quality score of the HSM.
    Enum: "QUALITY_SCORE_GREEN", "QUALITY_SCORE_RED", "QUALITY_SCORE_YELLOW", "QUALITY_SCORE_UNKNOWN", "UNRECOGNIZED"

  - `changes` (object)
    Object containing changes on the template. If empty the changes has been approved and applied to the template.

  - `changes.status` (string, required)
    The current status of the changes.
    
    DRAFT: The changes has not been submitted.
    IN_PROGRESS: The changes has been submitted.
    Enum: "DRAFT", "IN_PROGRESS", "REJECTED"

  - `changes.allowCategoryChange` (boolean)
    True if Meta should be allowed to change the category if they determine the category is wrong. If false, Meta might reject the template if they determine the category is wrong based on the template contents. Defaults to false.

  - `changes.details` (array)
    Template details and information.

  - `details` (object)
    Template details and information.

  - `details.components` (array, required)
    List of components in the template. Must contain a BODY component and can only have one entry of each type.

  - `details.messageSendTtlSeconds` (number)
    Template message delivery retry time-to-live (TTL) override value. If unable to deliver the template message, it will be periodically retry for this period of time. If it is unable to deliver the message for this period of time, the message will be dropped.

|  | AUTHENTICATION | MARKETING | UTILITY |
| -- | -- | -- | -- |
| Default | 10 minutes | 30 days | 30 days |
| Customizable range | 10 seconds to 15 minutes | 12 hours to 30 days | 30 seconds to 12 hours |
| Valid values | 10 to 900 seconds | 43200 to 2592000 seconds | 30 to 43200 seconds |

  Please note that authentication templates created before October 23, 2024, have a default TTL of 30 days.

## Response 401 fields (application/json):

  - `errorCode` (string)
    Error code allows to programmatically handle errors.
    Example: "unauthorized_error"

  - `message` (string)
    Human readable message.
    Example: "Unauthorized error."

  - `resolution` (string)
    Human readable message with an explanation of how to solve the error.
    Example: "Verify that projectId is correct."

## Response 404 fields (application/json):

  - `errorCode` (string)
    Error code allows to programmatically handle errors.
    Example: "template_not_found"

  - `message` (string)
    Human readable message.
    Example: "Template not found."

  - `resolution` (string)
    Human readable message with an explanation of how to solve the error.
    Example: "Verify that the parameters are correct."

## Response 429 fields (application/json):

  - `errorCode` (string)
    Error code allows to programmatically handle errors.
    Example: "whatsapp_business_api_request_limit_exceeded"

  - `message` (string)
    Human readable message.
    Example: "WhatsApp business api request limit reached."

  - `resolution` (string)
    Human readable message with an explanation of how to solve the error.
    Example: "WhatsApp business API request limits reached. Please try again later."


