# Updating a Template

```
PUT https://gateway.lipachat.com/api/v1/template/PHONE_NUMBER/:templateId
```

{% hint style="info" %}
Pass your WABA number or Sandbox phone number as the value of *PHONE\_NUMBER*
{% endhint %}

**Headers**

| Name         | Value                                                                           |
| ------------ | ------------------------------------------------------------------------------- |
| Content-Type | `application/json`                                                              |
| apiKey       | Get apiKey from App portal settings tab <https://app.lipachat.com/app/settings> |

**Body**

<table><thead><tr><th width="338">Name</th><th>Type</th><th>Description</th></tr></thead><tbody><tr><td>name</td><td>string</td><td>Name of template</td></tr><tr><td>language</td><td>string</td><td>Language code e.g en</td></tr><tr><td>category</td><td>string</td><td>Accepted values are: MARKETING, UTILITY or AUTHENTICATION.</td></tr><tr><td>component.header.format</td><td>string </td><td>Accepted values are: TEXT, IMAGE, VIDEO, DOCUMENT</td></tr><tr><td>component.header.text</td><td>string </td><td>Text to be sent on header</td></tr><tr><td>component.header.example</td><td>string </td><td>Should be present if text above has a variable.</td></tr><tr><td>component.body.text</td><td>string</td><td>Body text, accepts variables e.g Hello {{1}}, your balance is {{2}}</td></tr><tr><td>component.body.examples</td><td>array</td><td>Should match number of variables passed in text. For the example above it should be ['John', '2000']</td></tr><tr><td>component.footer.text</td><td>string</td><td>Optional footer text.</td></tr><tr><td>component.buttons[0].type</td><td>string</td><td>Accepted values are: PHONE_NUMBER, URL or QUICK_REPLY.</td></tr><tr><td>component.buttons[0].text</td><td>string</td><td>Text on button above.</td></tr><tr><td>component.buttons[0].phoneNumber</td><td>string</td><td>Should be passed if button type passed is PHONE_NUMBER.</td></tr><tr><td>component.buttons[0].url</td><td>string</td><td>Should be passed if button type passed is URL.</td></tr><tr><td>component.buttons[0].example</td><td>string</td><td>Applies for PHONE_NUMBER and URL.</td></tr></tbody></table>

> component.header, component.footer, component.buttons objects are optional.

<details>

<summary>Request to update a template with header and body.</summary>

```json
{
    "name": "test_campaign_utility2",
    "category": "MARKETING",
    "component": {
        "header": {
            "format": "TEXT",
            "text": "{{1}} sale",
            "example": "July"
        },
        "body": {
            "text": "Hi {{1}}, we have an offer for you, click on the link {{2}} to view it.",
            "examples": [
                "John",
                "http://lipachat.com/offers/ASHSH"
            ]
        }
    }
}
```

</details>

**Response**

{% tabs %}
{% tab title="200" %}

```json
{
    "timestamp": null,
    "data": {
        "success": true,
        "error": null
    },
    "status": "success",
    "message": "success",
    "errors": null
}
```

{% endtab %}

{% tab title="400" %}

```json
{
    "timestamp": "2024-09-15T20:06:38.675567555",
    "data": null,
    "status": "error",
    "message": "Content in this language already exists",
    "errors": null
}
```

{% endtab %}

{% tab title="401" %}

```json
{
    "timestamp": "2024-09-15T20:07:23.464199513",
    "data": null,
    "status": "success",
    "message": "Invalid credentials",
    "errors": null
}
```

{% endtab %}
{% endtabs %}
