curl --request POST \
--url https://api.useanima.sh/v1/email/drafts \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"agentId": "<string>",
"fromIdentityId": "<string>",
"to": [],
"cc": [],
"bcc": [],
"subject": "<string>",
"body": "<string>",
"bodyHtml": "<string>",
"inReplyTo": "<string>",
"references": [],
"metadata": {}
}
'import requests
url = "https://api.useanima.sh/v1/email/drafts"
payload = {
"agentId": "<string>",
"fromIdentityId": "<string>",
"to": [],
"cc": [],
"bcc": [],
"subject": "<string>",
"body": "<string>",
"bodyHtml": "<string>",
"inReplyTo": "<string>",
"references": [],
"metadata": {}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
agentId: '<string>',
fromIdentityId: '<string>',
to: [],
cc: [],
bcc: [],
subject: '<string>',
body: JSON.stringify('<string>'),
bodyHtml: '<string>',
inReplyTo: '<string>',
references: [],
metadata: {}
})
};
fetch('https://api.useanima.sh/v1/email/drafts', 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.useanima.sh/v1/email/drafts",
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([
'agentId' => '<string>',
'fromIdentityId' => '<string>',
'to' => [
],
'cc' => [
],
'bcc' => [
],
'subject' => '<string>',
'body' => '<string>',
'bodyHtml' => '<string>',
'inReplyTo' => '<string>',
'references' => [
],
'metadata' => [
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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.useanima.sh/v1/email/drafts"
payload := strings.NewReader("{\n \"agentId\": \"<string>\",\n \"fromIdentityId\": \"<string>\",\n \"to\": [],\n \"cc\": [],\n \"bcc\": [],\n \"subject\": \"<string>\",\n \"body\": \"<string>\",\n \"bodyHtml\": \"<string>\",\n \"inReplyTo\": \"<string>\",\n \"references\": [],\n \"metadata\": {}\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.useanima.sh/v1/email/drafts")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"agentId\": \"<string>\",\n \"fromIdentityId\": \"<string>\",\n \"to\": [],\n \"cc\": [],\n \"bcc\": [],\n \"subject\": \"<string>\",\n \"body\": \"<string>\",\n \"bodyHtml\": \"<string>\",\n \"inReplyTo\": \"<string>\",\n \"references\": [],\n \"metadata\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.useanima.sh/v1/email/drafts")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"agentId\": \"<string>\",\n \"fromIdentityId\": \"<string>\",\n \"to\": [],\n \"cc\": [],\n \"bcc\": [],\n \"subject\": \"<string>\",\n \"body\": \"<string>\",\n \"bodyHtml\": \"<string>\",\n \"inReplyTo\": \"<string>\",\n \"references\": [],\n \"metadata\": {}\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"agentId": "<string>",
"orgId": "<string>",
"fromIdentityId": "<string>",
"to": [
"<string>"
],
"cc": [
"<string>"
],
"bcc": [
"<string>"
],
"subject": "<string>",
"body": "<string>",
"bodyHtml": "<string>",
"inReplyTo": "<string>",
"references": [
"<string>"
],
"metadata": {},
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z"
}Post emaildrafts
curl --request POST \
--url https://api.useanima.sh/v1/email/drafts \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"agentId": "<string>",
"fromIdentityId": "<string>",
"to": [],
"cc": [],
"bcc": [],
"subject": "<string>",
"body": "<string>",
"bodyHtml": "<string>",
"inReplyTo": "<string>",
"references": [],
"metadata": {}
}
'import requests
url = "https://api.useanima.sh/v1/email/drafts"
payload = {
"agentId": "<string>",
"fromIdentityId": "<string>",
"to": [],
"cc": [],
"bcc": [],
"subject": "<string>",
"body": "<string>",
"bodyHtml": "<string>",
"inReplyTo": "<string>",
"references": [],
"metadata": {}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
agentId: '<string>',
fromIdentityId: '<string>',
to: [],
cc: [],
bcc: [],
subject: '<string>',
body: JSON.stringify('<string>'),
bodyHtml: '<string>',
inReplyTo: '<string>',
references: [],
metadata: {}
})
};
fetch('https://api.useanima.sh/v1/email/drafts', 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.useanima.sh/v1/email/drafts",
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([
'agentId' => '<string>',
'fromIdentityId' => '<string>',
'to' => [
],
'cc' => [
],
'bcc' => [
],
'subject' => '<string>',
'body' => '<string>',
'bodyHtml' => '<string>',
'inReplyTo' => '<string>',
'references' => [
],
'metadata' => [
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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.useanima.sh/v1/email/drafts"
payload := strings.NewReader("{\n \"agentId\": \"<string>\",\n \"fromIdentityId\": \"<string>\",\n \"to\": [],\n \"cc\": [],\n \"bcc\": [],\n \"subject\": \"<string>\",\n \"body\": \"<string>\",\n \"bodyHtml\": \"<string>\",\n \"inReplyTo\": \"<string>\",\n \"references\": [],\n \"metadata\": {}\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.useanima.sh/v1/email/drafts")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"agentId\": \"<string>\",\n \"fromIdentityId\": \"<string>\",\n \"to\": [],\n \"cc\": [],\n \"bcc\": [],\n \"subject\": \"<string>\",\n \"body\": \"<string>\",\n \"bodyHtml\": \"<string>\",\n \"inReplyTo\": \"<string>\",\n \"references\": [],\n \"metadata\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.useanima.sh/v1/email/drafts")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"agentId\": \"<string>\",\n \"fromIdentityId\": \"<string>\",\n \"to\": [],\n \"cc\": [],\n \"bcc\": [],\n \"subject\": \"<string>\",\n \"body\": \"<string>\",\n \"bodyHtml\": \"<string>\",\n \"inReplyTo\": \"<string>\",\n \"references\": [],\n \"metadata\": {}\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"agentId": "<string>",
"orgId": "<string>",
"fromIdentityId": "<string>",
"to": [
"<string>"
],
"cc": [
"<string>"
],
"bcc": [
"<string>"
],
"subject": "<string>",
"body": "<string>",
"bodyHtml": "<string>",
"inReplyTo": "<string>",
"references": [
"<string>"
],
"metadata": {},
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z"
}Authorizations
JWT Bearer token obtained from authentication. Pass as: Authorization: Bearer
Body
Request body for creating an email draft
Owning agent ID
^[cC][^\s-]{8,}$Optional EmailIdentity ID to send from. Must belong to this agent and be verified.
^[cC][^\s-]{8,}$Recipient email addresses (may be empty for an incomplete draft)
CC recipients
BCC recipients
Subject line
Plain-text body
HTML body
Optional In-Reply-To header for threading on send
Optional References chain for threading
Arbitrary metadata
Show child attributes
Show child attributes
Response
OK
Email draft resource
Unique identifier of the draft
^[cC][^\s-]{8,}$Owning agent ID
^[cC][^\s-]{8,}$Owning organization ID
^[cC][^\s-]{8,}$EmailIdentity used as the sender, or null to use the agent's primary identity at send time
^[cC][^\s-]{8,}$Recipient email addresses
CC recipient email addresses
BCC recipient email addresses
Subject line, or null if not yet written
Plain-text body, or null if not yet written
HTML body, or null if not provided
Optional In-Reply-To Message-ID for threading on send
Optional References Message-ID chain for threading
Arbitrary metadata
Show child attributes
Show child attributes
Timestamp when the draft was created
Timestamp when the draft was last updated
