[Yandex Cloud documentation](../../index.md) > [Yandex Smart Web Security](../index.md) > [Step-by-step guides](index.md) > Response templates > Creating a template

# Creating a response page template

{% list tabs group=instructions %}

- Management console {#console}

  1. In the [management console](https://console.yandex.cloud), select the [folder](../../resource-manager/concepts/resources-hierarchy.md#folder) where you want to create the template.
  1. Navigate to **Smart Web Security**.
  1. In the left-hand panel, select **Response templates** and click **Create template**.
  1. Enter the **Page name**, which is the name of the file returned in response to the client request.

     The name must be between 1 to 50 characters long and may contain lowercase Latin letters, numbers, hyphens, underscores, and periods. The first character must be a letter or number.

  1. Optionally, provide a template description.
  1. Select a **Response code**, i.e., one of the standard [HTTP response codes](https://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml) for which the client will get a page based on your template.
  1. Select the **Response format**: **HTML**, **JSON**, **XML**, or **Custom**.

     Each format has a matching HTTP [Content-Type](https://www.rfc-editor.org/rfc/rfc9110.html#name-content-type) header: `text/html`, `application/json`, or `application/xml`. For a custom header, select **Custom**.

  1. For the **Custom** format, enter **Content-Type**, e.g., `text/plain`.

  1. Optionally, to add an HTTP header, click **Add response header** and specify its parameters:
     
     * **Key**: HTTP header name, e.g., `User-Agent`, `Host`.
     * **Value**: For example, `Mozilla/5.0 (...)`, `example.com`.
  
     You can add up to 10 headers. You cannot add **Content-Type** and **Content-Length** headers, you can only set **Content-Type** in a separate field for the **Custom** format.

  1. Enter the **Response body**, i.e., the page content the client will get as a response. The response must not exceed `2 KB` (about 2,000 UTF-8 characters) in size.
  
     The content of the response must match the selected response format, for example:
     
     * **HTML**
     
         ```html
         <!doctype html>
         <html lang="ru">
         <head><meta charset="utf-8"><title>403 Forbidden</title></head>
         <body><h1>403 Forbidden</h1><p>Access restricted.</p></body>
         </html>
         ```
     
     * **JSON**
     
         ```json
         {
         "error": {
             "code": 403,
             "message": "Access restricted.",
             "details": "Not enough permissions to perform the operation."
         }
         }
         ```
          
     * **XML**
         
         ```xml
         <?xml version="1.0" encoding="UTF-8"?>
         <error>
         <code>403</code>
         <message>Access restricted.</message>
         <details>Not enough permissions to perform the operation.</details>
         </error>
         ```

  1. Optionally, add other parameters to the response body by selecting the relevant preset: **Request ID**, **Client IP address**, **Request time**.

     This data may be useful when the client contacts support.

     Example of a page with optional parameters:
     
     ```html
     <html>
     <head><title>403 Forbidden</title></head>
     <body>
     <h1>403 Forbidden</h1>
     <p>Access restricted. If you should have access, provide the following details to support:</p>
     <p>ID: %unique_key%</p>
     <p>IP address: %client_ip%</p>
     <p>Request time: %request_time%</p>
     <p>Contacts: security@example.com</p>
     </body>
     </html>
     ```

  1. To view the final page on the client side, click **Preview** at the top right.
  1. Click **Create**.

{% endlist %}

#### Useful links {#see-also}

* [Adding a response page template to a profile or rule](template-attach.md)
* [Response page templates](../concepts/response-templates.md)