Replaces the file of a template already stored under the name in the path. Send the new file as base64 in a JSON body, or as a multipart part.Requires Super User or Reseller scope. A Reseller can manage templates stored for its own reseller or for a domain in it. A template that applies to every reseller and every domain (reseller and domain both *) is platform-wide, and only a Super User can create, change, or delete it. Other scopes get 403.A template is stored per reseller, domain, and server, and each defaults to *, meaning all. The values are matched exactly here: a template stored for every domain is not found when you name one domain. Name the same reseller, domain, and server the template was created with. Every update must carry a file; description cannot be changed on its own. An image stored under the same name cannot be replaced here.The file must be an HTML template, a plain-text template, or a Word .docx document. The file's contents are checked, and the type detected from them is the one stored: text/html, text/plain, text/x-php for one whose contents read as PHP, such as a file that begins with <?php, or application/vnd.openxmlformats-officedocument.word for a .docx. Any other file, such as an image, SVG, JSON, a zip, or an executable, returns 400. A declared media type is optional; when one is sent, it must name the same kind as the contents. The file can be at most 1 MB (1,048,576 bytes); a larger one returns 413.Send a file part with Content-Type: multipart/form-data; only a multipart request is read as an upload. Send a JSON body with Content-Type: application/json. Send reseller and domain in the body; query-string values for them are ignored. The request returns 202: the change is accepted and applied shortly after.
Request
Authorization
Bearer Token
Provide your bearer token in the
Authorization
header when making requests to protected resources.
Example:
Authorization: Bearer ********************
or
Path Params
Body Params
application/json
Required
Examples
Responses
🟢202Accepted
application/json
Accepted. The new file is stored shortly after.
Bodyapplication/json
🟠400Bad Request
🟠401Authentication Required
🟠403Forbidden
🟠404Record not found
🟠413Content Too Large
🔴507Insufficient Storage
Request Request Example
Shell
JavaScript
Java
Swift
curl--location--request PUT 'https://awqacore01.crexendocloud.com/ns-api/v2/templates/welcome_email.php' \
--header'Authorization: Bearer <token>' \
--header'Content-Type: application/json' \
--data'{
"file-base64": "PGh0bWw+PGJvZHk+PHA+V2VsY29tZSB0byA8PyBHZXREb21haW4oKTsgPz4uPC9wPjwvYm9keT48L2h0bWw+",
"file-mime-type": "text/html",
"reseller": "example-reseller",
"description": "Welcome email for new users"
}'