Skip to main content
POST
/
api
/
send-email
PHP
<?php
$client = new isend('YOUR_API_KEY');
$client->emails->send([
  'from' => 'your@email.com',
  'to' => 'delivered@isend.dev',
  'template' => 'welcome_emailer',
  'data_mapping' => [
    'name' => 'John Doe',
    'email' => 'john@example.com'
  ]
]);
import requests

headers = {
"Authorization": "Bearer YOUR_API_KEY",
"Content-Type": "application/json"
}

data = {
"from": "your@email.com",
"to": "delivered@isend.dev",
"template": "welcome_emailer",
"data_mapping": {
"name": "John Doe",
"email": "john@example.com"
}
}

response = requests.post("https://api.example.com/api/send-email", json=data, headers=headers)
print(response.json())
const axios = require('axios');

const response = await axios.post('https://api.example.com/api/send-email', {
from: 'your@email.com',
to: 'delivered@isend.dev',
template: 'welcome_emailer',
data_mapping: {
name: 'John Doe',
email: 'john@example.com'
}
}, {
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
}
});

console.log(response.data);
OkHttpClient client = new OkHttpClient();

MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\"from\":\"your@email.com\",\"to\":\"delivered@isend.dev\",\"template\":\"welcome_emailer\",\"data_mapping\":{\"name\":\"John Doe\",\"email\":\"john@example.com\"}}");

Request request = new Request.Builder()
.url("https://api.example.com/api/send-email")
.post(body)
.addHeader("Authorization", "Bearer YOUR_API_KEY")
.addHeader("Content-Type", "application/json")
.build();

Response response = client.newCall(request).execute();
require 'net/http'
require 'uri'
require 'json'

uri = URI.parse("https://api.example.com/api/send-email")
header = {
'Content-Type': 'application/json',
'Authorization': 'Bearer YOUR_API_KEY'
}

body = {
from: 'your@email.com',
to: 'delivered@isend.dev',
template: 'welcome_emailer',
data_mapping: {
name: 'John Doe',
email: 'john@example.com'
}
}

http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
request = Net::HTTP::Post.new(uri.request_uri, header)
request.body = body.to_json

response = http.request(request)
puts response.body
curl -X POST https://api.example.com/api/send-email \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"from": "your@email.com",
"to": "delivered@isend.dev",
"template": "welcome_emailer",
"data_mapping": {
"name": "John Doe",
"email": "john@example.com"
}
}'
const options = {method: 'POST'};

fetch('https://api.example.com/api/send-email', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
package main

import (
"fmt"
"net/http"
"io"
)

func main() {

url := "https://api.example.com/api/send-email"

req, _ := http.NewRequest("POST", url, nil)

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}

Send Email

Send templated emails through the iSend API using dynamic placeholders with a single API call.

Endpoint

POST https://api.isend.ai/emails/send

Headers

  • Authorization (string, required): Bearer token using your API key.
    Example: Authorization: Bearer is_xxxxxxx
  • Content-Type: application/json

Request Body Parameters

FieldTypeRequiredDescription
fromstringSender’s email. Use name <email@domain.com> format if needed.
tostring or arrayEmail or array of emails for recipients.
templatestringIdentifier or name of the template to send.
data_mappingobjectDynamic placeholder values to inject into the template.

Sample Request

{
  "from": "your@email.com",
  "to": "delivered@isend.dev",
  "template": "welcome_emailer",
  "data_mapping": {
    "name": "John Doe",
    "email": "john@example.com"
  }
}

Sample Response

{
  "id": "abc1234-def5-6789-xyz-00000000",
  "status": "success"
}

PHP SDK Example

<?php
$client = new isend('YOUR_API_KEY');
$client->emails->send([
  'from' => 'your@email.com',
  'to' => 'delivered@isend.dev',
  'template' => 'welcome_emailer',
  'data_mapping' => [
    'name' => 'John Doe',
    'email' => 'john@example.com'
  ]
]);

Notes

  • Ensure the template exists and is active on your account.
  • data_mapping must match the placeholders used in your template.
  • You may use an array for to if you want to send to multiple recipients.

Response

200

Successful response