# Send email based on template

Sends an email based on a custom template and data that you provided to the specified email address.
 

{% html name="div" attrs={"class": "notice"} %}
Notice

Rate limits for server-side methods are applied to this method.
{% /html %}

Endpoint: POST /templates/email/send
Version: v1
Security: Server

## Query parameters:

  - `projectId` (string, required)
    Login project ID from Publisher Account.

## Request fields (application/json):

  - `email` (string, required)
    User email address.
    Example: "john_smith@gmail.com"

  - `template` (object, required)
    Example: {"id":"Welcome email template","locale":"en_US","params":{"first_name":"John","last_name":"Smith","site_link":"https://example.com/"}}

  - `template.id` (string, required)
    Name of the template created by the [Create custom email template](https://developers.xsolla.com/api/login/operation/create-custom-email-template) call.
    Example: "Welcome email template"

  - `template.locale` (string)
    Region of the texts that you provided in the template in the _ format, where:
* language code: language code in the [ISO 639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) format;
* country code: country/region code in the [ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) format.
    Example: "en_US"

  - `template.params` (object)
    JSON object with texts for all variables that you specified in the email template created by the [Create custom email template](https://developers.xsolla.com/api/login/operation/create-custom-email-template) call.

// If you created body of the template with

Hi {{first_name}} {{last_name}}!We will be glad to see you on the {{site_link}} page.

// Pass the following JSON here

"params": {
  "first_name": "John",
  "last_name": "Smith",
  "site_link": "https://example.com/"
}
    Example: {"first_name":"John","last_name":"Smith","site_link":"https://example.com/"}

## Response 401 fields (application/json):

  - `error` (object, required)

  - `error.code` (string, required)
    Error code.
    Example: "003-061"

  - `error.description` (string, required)
    Error description.
    Example: "Object not found."

  - `error.details` (object)
    Additional information.

## Response 404 fields (application/json):

  - `error` (object, required)

  - `error.code` (string, required)
    Error code.
    Example: "003-061"

  - `error.description` (string, required)
    Error description.
    Example: "Object not found."

  - `error.details` (object)
    Additional information.

## Response 422 fields (application/json):

  - `error` (object, required)

  - `error.code` (string, required)
    Error code.
    Example: "003-061"

  - `error.description` (string, required)
    Error description.
    Example: "Object not found."

  - `error.details` (object)
    Additional information.


## Response 204 fields
