Get Email Templates
GET /v1/templates
GET
/v1/templates
Retrieves the list of email templates available in your account.
Authorizations
Section titled “Authorizations ”Responses
Section titled “ Responses ”Email templates retrieved successfully
Array<object>
object
template_id
The unique identifier of the template
string
template123 name
The name of the template
string
Welcome Email subject
The subject line of the template
string
Welcome to Our Service from_name
The sender display name
string
John Doe from_email
The sender email address
string format: email
john@doe.com status
Whether the template is active
boolean
trueExample
[ { "template_id": "template123", "name": "Welcome Email", "subject": "Welcome to Our Service", "from_name": "John Doe", "from_email": "john@doe.com", "status": true }]Unauthorized — invalid or missing API token
object
status
boolean
message
string
An http error occurred. If error persists, contact soporte@contacta.mx data
object
message
string
code
integer
Example
{ "status": false, "message": "An http error occurred. If error persists, contact soporte@contacta.mx", "data": { "message": "Your key auth is not valid, please check with your administrator", "code": 401 }}Examples
Section titled “Examples ”Useful for guiding users to view code examples in different developer languages.
curl -X GET "https://api.example.com/v1/templates" \ -H "Accept: application/json" \ -H "Connection: keep-alive" \ -H "Authorization: Bearer <your-token>" const fetch = require('node-fetch');
fetch("https://api.example.com/v1/templates", { method: "GET", headers: { "Accept": "application/json", "Connection": "keep-alive", "Authorization": "Bearer <your-token>"} }) .then(res => res.json()) .then(console.log) .catch(console.error); <?php $curl = curl_init();
curl_setopt_array($curl, [ CURLOPT_URL => "https://api.example.com/v1/templates", CURLOPT_RETURNTRANSFER => true, CURLOPT_CUSTOMREQUEST => "GET", CURLOPT_HTTPHEADER => [ "Accept: application/json", "Connection: keep-alive", "Authorization: Bearer <your-token>" ] ]);
$response = curl_exec($curl); curl_close($curl); echo $response; ?> using System.Net.Http; using System.Text; using System.Threading.Tasks;
var client = new HttpClient(); var request = new HttpRequestMessage(HttpMethod.GET, "https://api.example.com/v1/templates"); request.Headers.Add("Accept", "application/json");request.Headers.Add("Connection", "keep-alive");request.Headers.Add("Authorization", "Bearer <your-token>"); var response = await client.SendAsync(request); var responseBody = await response.Content.ReadAsStringAsync(); Console.WriteLine(responseBody); import requests import json
url = "https://api.example.com/v1/templates" headers = { "Accept": "application/json", "Connection": "keep-alive", "Authorization": "Bearer <your-token>" }
response = requests.get(url, headers=headers) print(response.text) import java.io.OutputStream; import java.net.HttpURLConnection; import java.net.URL; import java.nio.charset.StandardCharsets;
public class ApiExample { public static void main(String[] args) throws Exception { URL url = new URL("https://api.example.com/v1/templates"); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.setRequestMethod("GET");
conn.setRequestProperty("Accept", "application/json"); conn.setRequestProperty("Connection", "keep-alive"); conn.setRequestProperty("Authorization", "Bearer <your-token>");
int code = conn.getResponseCode(); System.out.println("Response code: " + code); } }