curl --request POST \
--url https://api.migma.ai/v1/send-approvals \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"action": "send_email",
"send": {
"from": "jsmith@example.com",
"fromName": "<string>",
"subject": "<string>",
"recipientId": "<string>",
"recipientEmail": "jsmith@example.com",
"replyTo": "jsmith@example.com",
"variables": {},
"providerType": "migma",
"projectId": "<string>",
"conversationId": "<string>",
"transactional": true,
"emailId": "<string>"
}
}
'import requests
url = "https://api.migma.ai/v1/send-approvals"
payload = {
"action": "send_email",
"send": {
"from": "jsmith@example.com",
"fromName": "<string>",
"subject": "<string>",
"recipientId": "<string>",
"recipientEmail": "jsmith@example.com",
"replyTo": "jsmith@example.com",
"variables": {},
"providerType": "migma",
"projectId": "<string>",
"conversationId": "<string>",
"transactional": True,
"emailId": "<string>"
}
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
action: 'send_email',
send: {
from: 'jsmith@example.com',
fromName: '<string>',
subject: '<string>',
recipientId: '<string>',
recipientEmail: 'jsmith@example.com',
replyTo: 'jsmith@example.com',
variables: {},
providerType: 'migma',
projectId: '<string>',
conversationId: '<string>',
transactional: true,
emailId: '<string>'
}
})
};
fetch('https://api.migma.ai/v1/send-approvals', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.migma.ai/v1/send-approvals",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'action' => 'send_email',
'send' => [
'from' => 'jsmith@example.com',
'fromName' => '<string>',
'subject' => '<string>',
'recipientId' => '<string>',
'recipientEmail' => 'jsmith@example.com',
'replyTo' => 'jsmith@example.com',
'variables' => [
],
'providerType' => 'migma',
'projectId' => '<string>',
'conversationId' => '<string>',
'transactional' => true,
'emailId' => '<string>'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.migma.ai/v1/send-approvals"
payload := strings.NewReader("{\n \"action\": \"send_email\",\n \"send\": {\n \"from\": \"jsmith@example.com\",\n \"fromName\": \"<string>\",\n \"subject\": \"<string>\",\n \"recipientId\": \"<string>\",\n \"recipientEmail\": \"jsmith@example.com\",\n \"replyTo\": \"jsmith@example.com\",\n \"variables\": {},\n \"providerType\": \"migma\",\n \"projectId\": \"<string>\",\n \"conversationId\": \"<string>\",\n \"transactional\": true,\n \"emailId\": \"<string>\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.migma.ai/v1/send-approvals")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"action\": \"send_email\",\n \"send\": {\n \"from\": \"jsmith@example.com\",\n \"fromName\": \"<string>\",\n \"subject\": \"<string>\",\n \"recipientId\": \"<string>\",\n \"recipientEmail\": \"jsmith@example.com\",\n \"replyTo\": \"jsmith@example.com\",\n \"variables\": {},\n \"providerType\": \"migma\",\n \"projectId\": \"<string>\",\n \"conversationId\": \"<string>\",\n \"transactional\": true,\n \"emailId\": \"<string>\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.migma.ai/v1/send-approvals")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"action\": \"send_email\",\n \"send\": {\n \"from\": \"jsmith@example.com\",\n \"fromName\": \"<string>\",\n \"subject\": \"<string>\",\n \"recipientId\": \"<string>\",\n \"recipientEmail\": \"jsmith@example.com\",\n \"replyTo\": \"jsmith@example.com\",\n \"variables\": {},\n \"providerType\": \"migma\",\n \"projectId\": \"<string>\",\n \"conversationId\": \"<string>\",\n \"transactional\": true,\n \"emailId\": \"<string>\"\n }\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"id": "<string>",
"action": "send_email",
"status": "pending",
"summary": {},
"approvalUrl": "<string>",
"editUrl": "<string>",
"result": {},
"error": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"expiresAt": "2023-11-07T05:31:56Z",
"decidedAt": "2023-11-07T05:31:56Z"
},
"error": "<string>"
}{
"success": true,
"data": null,
"error": "<string>"
}{
"success": true,
"data": null,
"error": "<string>"
}{
"success": true,
"data": null,
"error": "<string>"
}{
"success": true,
"data": null,
"error": "<string>"
}{
"success": true,
"data": null,
"error": "<string>"
}{
"success": true,
"data": null,
"error": "<string>"
}Request a send approval
Holds a direct send, campaign send, or schedule for the account owner’s approval in Migma and sends nothing. Migma checks the send as it would go out now and returns a summary with an approval link. The owner sends, schedules, or declines it on migma.ai; Migma checks it again then and refuses it if anything that decides who gets it, from whom, or when changed. Direct sends are marketing unless transactional is true, which is refused for tag and segment sends and needs a verified transactional sending identity. Requires API key with email:send (send_email) or campaign:write (campaign actions). Answers 403 if the key’s person cannot send from the brand by current membership; a campaign request needs campaign:write as a member.
After a person approves a schedule, an API key cannot change that campaign or its email. PATCH /v1/campaigns/ (except a change to name alone), POST /v1/campaigns//schedule and /send, and POST /v1/emails//edit answer 409 APPROVED_SEND_LOCKED. So do PATCH /v1/segments/ with filters and DELETE /v1/segments/ on a segment it sends to or leaves out, until the send has finished. To change the send, ask the person to change it on the campaign page in Migma. Or cancel it, create a new campaign, and request a new approval. For a new time alone, request a new schedule_campaign approval: approving it replaces the old one.
curl --request POST \
--url https://api.migma.ai/v1/send-approvals \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"action": "send_email",
"send": {
"from": "jsmith@example.com",
"fromName": "<string>",
"subject": "<string>",
"recipientId": "<string>",
"recipientEmail": "jsmith@example.com",
"replyTo": "jsmith@example.com",
"variables": {},
"providerType": "migma",
"projectId": "<string>",
"conversationId": "<string>",
"transactional": true,
"emailId": "<string>"
}
}
'import requests
url = "https://api.migma.ai/v1/send-approvals"
payload = {
"action": "send_email",
"send": {
"from": "jsmith@example.com",
"fromName": "<string>",
"subject": "<string>",
"recipientId": "<string>",
"recipientEmail": "jsmith@example.com",
"replyTo": "jsmith@example.com",
"variables": {},
"providerType": "migma",
"projectId": "<string>",
"conversationId": "<string>",
"transactional": True,
"emailId": "<string>"
}
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
action: 'send_email',
send: {
from: 'jsmith@example.com',
fromName: '<string>',
subject: '<string>',
recipientId: '<string>',
recipientEmail: 'jsmith@example.com',
replyTo: 'jsmith@example.com',
variables: {},
providerType: 'migma',
projectId: '<string>',
conversationId: '<string>',
transactional: true,
emailId: '<string>'
}
})
};
fetch('https://api.migma.ai/v1/send-approvals', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.migma.ai/v1/send-approvals",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'action' => 'send_email',
'send' => [
'from' => 'jsmith@example.com',
'fromName' => '<string>',
'subject' => '<string>',
'recipientId' => '<string>',
'recipientEmail' => 'jsmith@example.com',
'replyTo' => 'jsmith@example.com',
'variables' => [
],
'providerType' => 'migma',
'projectId' => '<string>',
'conversationId' => '<string>',
'transactional' => true,
'emailId' => '<string>'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.migma.ai/v1/send-approvals"
payload := strings.NewReader("{\n \"action\": \"send_email\",\n \"send\": {\n \"from\": \"jsmith@example.com\",\n \"fromName\": \"<string>\",\n \"subject\": \"<string>\",\n \"recipientId\": \"<string>\",\n \"recipientEmail\": \"jsmith@example.com\",\n \"replyTo\": \"jsmith@example.com\",\n \"variables\": {},\n \"providerType\": \"migma\",\n \"projectId\": \"<string>\",\n \"conversationId\": \"<string>\",\n \"transactional\": true,\n \"emailId\": \"<string>\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.migma.ai/v1/send-approvals")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"action\": \"send_email\",\n \"send\": {\n \"from\": \"jsmith@example.com\",\n \"fromName\": \"<string>\",\n \"subject\": \"<string>\",\n \"recipientId\": \"<string>\",\n \"recipientEmail\": \"jsmith@example.com\",\n \"replyTo\": \"jsmith@example.com\",\n \"variables\": {},\n \"providerType\": \"migma\",\n \"projectId\": \"<string>\",\n \"conversationId\": \"<string>\",\n \"transactional\": true,\n \"emailId\": \"<string>\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.migma.ai/v1/send-approvals")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"action\": \"send_email\",\n \"send\": {\n \"from\": \"jsmith@example.com\",\n \"fromName\": \"<string>\",\n \"subject\": \"<string>\",\n \"recipientId\": \"<string>\",\n \"recipientEmail\": \"jsmith@example.com\",\n \"replyTo\": \"jsmith@example.com\",\n \"variables\": {},\n \"providerType\": \"migma\",\n \"projectId\": \"<string>\",\n \"conversationId\": \"<string>\",\n \"transactional\": true,\n \"emailId\": \"<string>\"\n }\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"id": "<string>",
"action": "send_email",
"status": "pending",
"summary": {},
"approvalUrl": "<string>",
"editUrl": "<string>",
"result": {},
"error": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"expiresAt": "2023-11-07T05:31:56Z",
"decidedAt": "2023-11-07T05:31:56Z"
},
"error": "<string>"
}{
"success": true,
"data": null,
"error": "<string>"
}{
"success": true,
"data": null,
"error": "<string>"
}{
"success": true,
"data": null,
"error": "<string>"
}{
"success": true,
"data": null,
"error": "<string>"
}{
"success": true,
"data": null,
"error": "<string>"
}{
"success": true,
"data": null,
"error": "<string>"
}Authorizations
API key authentication. Use 'Authorization: Bearer YOUR_API_KEY' where YOUR_API_KEY is obtained from the Migma dashboard under Settings → Developers → API Keys.
Headers
Optional key (max 100 chars) for safe retries. Same key + same body within 24h replays the original response (same status and body); same key + a different body returns 409 IDEMPOTENCY_CONFLICT. Scoped per API key.
100Body
Was this page helpful?