# Copy Code Authentication Templates

Copy code authentication templates allow you to send a one-time password or code along with a copy code button to your users.

When a WhatsApp user taps the copy code button, it copies the password or code to the device's clipboard. The user can then switch to your app and paste the password or code into your app.

This process does not require the HandShake and App Signing Hash.

<figure><img src="https://3527970750-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M4sMxKjL6eJRvZn6jeG-887967055%2Fuploads%2FoLqdkCthjoWwpVqDOBP7%2Fimage.png?alt=media&#x26;token=2c67f46d-3cc1-49e2-9e7b-23d35136a468" alt=""><figcaption></figcaption></figure>

Copy code button authentication templates consist of:

* Preset text: _\<VERIFICATION\_CODE> is your verification code._
* An optional security disclaimer: _For your security, do not share this code._
* An optional expiration warning (optional): _This code expires in \<NUM\_MINUTES> minutes._
* A copy code button.

{% hint style="warning" %}
URLs, media, and emojis are not supported.
{% endhint %}

## Template Creation

You can use the WABA API to create copy code authentication templates. Alternatively, users can also create it using the WhatsApp Business Manager.&#x20;

Use the create template endpoint and assemble the components in the request:

The base-url should be `https://waba-v2.360dialog.io` for Cloud API and `https://waba.360dialog.io` for On-Premise.

{% hint style="danger" %}
If you are using On-Premise API, remember that it is being discontinued by Meta. No new signups will be allowed with this type of integration from May 15, 2024.

Numbers registered before this date will still be supported, but should start planning a [change of hosting type](../../../waba-management/hosting-type-change) as soon as possible.
{% endhint %}



<mark style="color:green;">`POST`</mark> `[base-url]/v1/configs/templates`&#x20;

The message template name field is limited to 512 characters. The message template content field is limited to 1024 characters.

#### Headers

| Name         | Type   | Description |
| ------------ | ------ | ----------- |
| D360-API-KEY | string |             |

#### Request Body

| Name                                         | Type            | Description                                                                                                                                |
| -------------------------------------------- | --------------- | ------------------------------------------------------------------------------------------------------------------------------------------ |
| name<mark style="color:red;">\*</mark>       | string          |                                                                                                                                            |
| components<mark style="color:red;">\*</mark> | array\[objects] | Array of objects that describe the components that make up the template.                                                                   |
| category<mark style="color:red;">\*</mark>   | string          | Allowed values: **`AUTHENTICATION`**                                                                                                       |
| language<mark style="color:red;">\*</mark>   | string          | [View list of supported languages here.](https://developers.facebook.com/docs/whatsapp/api/messages/message-templates#supported-languages) |

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

{% endtab %}
{% endtabs %}

#### Post Body <a href="#post-body" id="post-body"></a>

```json
{
  "name": "<TEMPLATE_NAME>",
  "language": "<TEMPLATE_LANGUAGE>",
  "category": "authentication",
  "message_send_ttl_seconds": <TIME_T0_LIVE>, // Optional
  "components": [
    {
      "type": "body", 
      "add_security_recommendation": <SECURITY_RECOMMENDATION> // Optional
    },
    {
      "type": "footer", 
      "code_expiration_minutes": <CODE_EXPIRATION> // Optional
    },
    { 
      "type": "buttons",
      "buttons": [
        {
          "type": "otp",
          "otp_type": "copy_code",
          "text": "<COPY_CODE_BUTTON_TEXT>"  // Optional
        }
      ]
    }
  ]
}
```

Note that in your template creation request the button `type` is designated as `OTP`, but upon creation the button `type` will be set to `URL`. You can confirm this by performing a **GET** request on a newly created authentication template and analyzing its components.

#### Properties <a href="#properties" id="properties"></a>

| Placeholder                                                               | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       | Example Value       |
| ------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------- |
| <p><code>&#x3C;CODE_EXPIRATION></code></p><p><em>Integer</em></p>         | <p><strong>Optional.</strong></p><p><br></p><p>Indicates the number of minutes the password or code is valid.</p><p><br></p><p>If included, the code expiration warning and this value will be displayed in the delivered message. The button will be disabled in the delivered message the indicated number of minutes from when the message was sent.</p><p><br></p><p><strong>If omitted, the code expiration warning will not be displayed in the delivered message. In addition, the button will be disabled 10 minutes from when the message was sent.</strong></p><p><br></p><p>Minimum 1, maximum 90.</p> | `5`                 |
| <p><code>&#x3C;COPY_CODE_BUTTON_TEXT></code></p><p><em>String</em></p>    | <p><strong>Optional.</strong></p><p><br></p><p>Copy code button label text.</p><p><br></p><p>If omitted, the text will default to a pre-set value localized to the template's language. For example, <code>Copy Code</code> for English (US).</p><p><br></p><p>Maximum 25 characters.</p>                                                                                                                                                                                                                                                                                                                         | `Copy Code`         |
| <p><code>&#x3C;SECURITY_RECOMMENDATION></code></p><p><em>Boolean</em></p> | <p><strong>Optional.</strong></p><p><br></p><p>Set to <code>true</code> if you want the template to include the string, <em>For your security, do not share this code.</em> Set to <code>false</code> to exclude the string.</p>                                                                                                                                                                                                                                                                                                                                                                                  | `true`              |
| <p><code>&#x3C;TEMPLATE_LANGUAGE></code></p><p><em>String</em></p>        | <p><strong>Required.</strong></p><p><br></p><p>Template <a href="https://developers.facebook.com/docs/whatsapp/business-management-api/message-templates/supported-languages">language and locale code</a>.</p>                                                                                                                                                                                                                                                                                                                                                                                                   | `en_US`             |
| <p><code>&#x3C;TEMPLATE_NAME></code></p><p><em>String</em></p>            | <p><strong>Required.</strong></p><p><br></p><p>Template name.</p><p><br></p><p>Maximum 512 characters.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        | `verification_code` |
| <p><code>&#x3C;TIME_TO_LIVE></code></p><p><em>Integer</em></p>            | <p><strong>Optional.</strong></p><p><br></p><p>Authentication message time-to-live value, in seconds. See <a href="broken-reference">Time-To-Live </a>below.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                  | `60`                |

#### Example Request <a href="#example-request" id="example-request"></a>

```json
{
  "name": "authentication_code_copy_code_button",
  "language": "en_US",
  "category": "authentication",
  "message_send_ttl_seconds": 60,
  "components": [
    {
      "type": "body",
      "add_security_recommendation": true
    },
    {
      "type": "footer",
      "code_expiration_minutes": 5
    },
    {
      "type": "buttons",
      "buttons": [
        {
          "type": "otp",
          "otp_type": "copy_code",
          "text": "Copy Code"
        }
      ]
    }
  ]
}
```





## Sending Copy Code Authentication Template Messages <a href="#sending-zero-tap-authentication-template-messages" id="sending-zero-tap-authentication-template-messages"></a>

See our[ Authentication Templates documentation]() to learn how to send it to customers.

