---
agentTools:
  projectIndex: https://sendinblue.readme.io/llms.txt
---

# Create an email template

# OpenAPI definition

```json
{
  "openapi": "3.0.1",
  "info": {
    "contact": {
      "email": "contact@brevo.com",
      "name": "Brevo Support",
      "url": "https://account.brevo.com/support"
    },
    "description": "Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to :\n  - Manage your campaigns and get the statistics\n  - Manage your contacts\n  - Send transactional Emails and SMS\n  - and much more...\n\nYou can download our wrappers at https://github.com/orgs/brevo\n**Possible responses**\n  | Code | Message |\n  | :-------------: | ------------- |\n  | 200  | OK. Successful Request  |\n  | 201  | OK. Successful Creation |\n  | 202  | OK. Request accepted |\n  | 204  | OK. Successful Update/Deletion  |\n  | 400  | Error. Bad Request  |\n  | 401  | Error. Authentication Needed  |\n  | 402  | Error. Not enough credit, plan upgrade needed  |\n  | 403  | Error. Permission denied  |\n  | 404  | Error. Object does not exist |\n  | 405  | Error. Method not allowed  |\n  | 406  | Error. Not Acceptable  |\n  | 422  | Error. Unprocessable Entity |\n",
    "license": {
      "name": "MIT",
      "url": "http://opensource.org/licenses/MIT"
    },
    "title": "Brevo API",
    "version": "3.0.0"
  },
  "servers": [
    {
      "url": "https://api.brevo.com/v3"
    }
  ],
  "security": [
    {
      "api-key": []
    },
    {
      "partner-key": []
    }
  ],
  "paths": {
    "/smtp/templates": {
      "post": {
        "operationId": "createSmtpTemplate",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "attachmentUrl": {
                    "description": "Absolute url of the attachment (**no local file**). Extension allowed: #### xlsx, xls, ods, docx, docm, doc, csv, pdf, txt, gif, jpg, jpeg, png, tif, tiff, rtf, bmp, cgm, css, shtml, html, htm, zip, xml, ppt, pptx, tar, ez, ics, mobi, msg, pub and eps'\n",
                    "example": "https://attachment.domain.com",
                    "format": "url",
                    "type": "string"
                  },
                  "htmlContent": {
                    "description": "Body of the message (HTML version). The field must have more than 10 characters. **REQUIRED if htmlUrl is empty**\n",
                    "example": "The order n°xxxxx has been confirmed. Thanks for your purchase",
                    "type": "string"
                  },
                  "htmlUrl": {
                    "description": "Url which contents the body of the email message. REQUIRED if htmlContent is empty",
                    "example": "https://html.domain.com",
                    "format": "url",
                    "type": "string"
                  },
                  "isActive": {
                    "description": "Status of template. isActive = true means template is active and isActive = false means template is inactive",
                    "example": true,
                    "type": "boolean"
                  },
                  "replyTo": {
                    "description": "Email on which campaign recipients will be able to reply to",
                    "example": "support@myshop.com",
                    "format": "email",
                    "type": "string"
                  },
                  "sender": {
                    "description": "Sender details including id or email and name (_optional_). Only one of either Sender's email or Sender's ID shall be passed in one request at a time. For example: **{\"name\":\"xyz\", \"email\":\"example@abc.com\"}** **{\"name\":\"xyz\", \"id\":123}**\n",
                    "properties": {
                      "email": {
                        "description": "Email of the sender",
                        "example": "contact@myshop.com",
                        "format": "email",
                        "type": "string"
                      },
                      "id": {
                        "description": "Select the sender for the template on the basis of sender id. _In order to select a sender with specific pool of IP’s, dedicated ip users shall pass id (instead of email)_.\n",
                        "example": 3,
                        "format": "int64",
                        "type": "integer"
                      },
                      "name": {
                        "description": "Name of the sender. **If not passed, will be set to default**\n",
                        "example": "Mary from MyShop",
                        "type": "string"
                      }
                    },
                    "type": "object"
                  },
                  "subject": {
                    "description": "Subject of the template",
                    "example": "Thanks for your purchase !",
                    "type": "string"
                  },
                  "tag": {
                    "description": "Tag of the template",
                    "example": "OrderConfirmation",
                    "type": "string"
                  },
                  "templateName": {
                    "description": "Name of the template",
                    "example": "Order Confirmation - EN",
                    "type": "string"
                  },
                  "toField": {
                    "description": "To personalize the **To** Field. If you want to include the first name and last name of your recipient, add **{FNAME} {LNAME}**. These contact attributes must already exist in your Brevo account. If input parameter **params** used please use **{{contact.FNAME}} {{contact.LNAME}}** for personalization\n",
                    "example": "{FNAME} {LNAME}",
                    "type": "string"
                  }
                },
                "required": [
                  "sender",
                  "subject",
                  "templateName"
                ],
                "type": "object"
              }
            }
          },
          "description": "values to update in transactional email template",
          "required": true
        },
        "responses": {
          "201": {
            "$ref": "#/components/responses/createModel"
          },
          "400": {
            "$ref": "#/components/responses/errorModel"
          }
        },
        "summary": "Create an email template",
        "tags": [
          "Transactional emails"
        ]
      }
    }
  },
  "components": {
    "securitySchemes": {
      "api-key": {
        "description": "The API key should be passed in the request headers as `api-key` for authentication.",
        "in": "header",
        "name": "api-key",
        "type": "apiKey"
      },
      "partner-key": {
        "description": "The partner key should be passed in the request headers as `partner-key` along with `api-key` pair for successful authentication of partner (Optional).",
        "in": "header",
        "name": "partner-key",
        "type": "apiKey"
      }
    },
    "responses": {
      "errorModel": {
        "content": {
          "application/json": {
            "schema": {
              "properties": {
                "code": {
                  "description": "Error code displayed in case of a failure",
                  "enum": [
                    "invalid_parameter",
                    "missing_parameter",
                    "out_of_range",
                    "campaign_processing",
                    "campaign_sent",
                    "document_not_found",
                    "not_enough_credits",
                    "permission_denied",
                    "duplicate_parameter",
                    "duplicate_request",
                    "method_not_allowed",
                    "unauthorized",
                    "account_under_validation",
                    "not_acceptable",
                    "bad_request",
                    "unprocessable_entity",
                    "Domain does not exist",
                    "Contact email not found",
                    "Attribute not found",
                    "Category id not found",
                    "Invalid parameters passed",
                    "Record(s) for identifier not found",
                    "Returned when query params are invalid",
                    "Returned when invalid data posted",
                    "Feed not found",
                    "Campaign ID not found",
                    "api-key not found",
                    "DMARC policy requires domain authentication",
                    "DNS records not properly configured",
                    "Invalid OTP code provided",
                    "OTP code has expired",
                    "Domain already exists in your account",
                    "The sum of all IP weights must equal 100",
                    "Authentication failed",
                    "Insufficient credits",
                    "Request already processed"
                  ],
                  "example": "method_not_allowed",
                  "type": "string"
                },
                "message": {
                  "description": "Readable message associated to the failure",
                  "example": "POST Method is not allowed on this path",
                  "type": "string"
                }
              },
              "required": [
                "code",
                "message"
              ],
              "type": "object"
            }
          }
        },
        "description": "bad request"
      },
      "createModel": {
        "content": {
          "application/json": {
            "schema": {
              "properties": {
                "id": {
                  "description": "ID of the object created",
                  "example": 5,
                  "format": "int64",
                  "type": "integer"
                }
              },
              "required": [
                "id"
              ],
              "type": "object"
            }
          }
        },
        "description": "successfully created"
      }
    }
  },
  "x-samples-languages": [
    "curl"
  ],
  "x-readme": {
    "explorer-enabled": true,
    "proxy-enabled": true
  },
  "_id": {
    "buffer": {
      "0": 91,
      "1": 104,
      "2": 180,
      "3": 205,
      "4": 240,
      "5": 82,
      "6": 207,
      "7": 0,
      "8": 3,
      "9": 36,
      "10": 63,
      "11": 142
    }
  }
}
```