curl --request POST \
--url https://kourio.app/v1/emails \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"to": "<string>",
"from": "<string>",
"cc": "<string>",
"bcc": "<string>",
"replyTo": "<string>",
"templateId": "<string>",
"variables": {},
"subject": "<string>",
"html": "<string>",
"text": "<string>",
"type": "TRANSACTIONAL",
"scheduledAt": "2023-11-07T05:31:56Z",
"idempotencyKey": "<string>"
}
'import requests
url = "https://kourio.app/v1/emails"
payload = {
"to": "<string>",
"from": "<string>",
"cc": "<string>",
"bcc": "<string>",
"replyTo": "<string>",
"templateId": "<string>",
"variables": {},
"subject": "<string>",
"html": "<string>",
"text": "<string>",
"type": "TRANSACTIONAL",
"scheduledAt": "2023-11-07T05:31:56Z",
"idempotencyKey": "<string>"
}
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({
to: '<string>',
from: '<string>',
cc: '<string>',
bcc: '<string>',
replyTo: '<string>',
templateId: '<string>',
variables: {},
subject: '<string>',
html: '<string>',
text: '<string>',
type: 'TRANSACTIONAL',
scheduledAt: '2023-11-07T05:31:56Z',
idempotencyKey: '<string>'
})
};
fetch('https://kourio.app/v1/emails', 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://kourio.app/v1/emails",
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([
'to' => '<string>',
'from' => '<string>',
'cc' => '<string>',
'bcc' => '<string>',
'replyTo' => '<string>',
'templateId' => '<string>',
'variables' => [
],
'subject' => '<string>',
'html' => '<string>',
'text' => '<string>',
'type' => 'TRANSACTIONAL',
'scheduledAt' => '2023-11-07T05:31:56Z',
'idempotencyKey' => '<string>'
]),
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://kourio.app/v1/emails"
payload := strings.NewReader("{\n \"to\": \"<string>\",\n \"from\": \"<string>\",\n \"cc\": \"<string>\",\n \"bcc\": \"<string>\",\n \"replyTo\": \"<string>\",\n \"templateId\": \"<string>\",\n \"variables\": {},\n \"subject\": \"<string>\",\n \"html\": \"<string>\",\n \"text\": \"<string>\",\n \"type\": \"TRANSACTIONAL\",\n \"scheduledAt\": \"2023-11-07T05:31:56Z\",\n \"idempotencyKey\": \"<string>\"\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://kourio.app/v1/emails")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"to\": \"<string>\",\n \"from\": \"<string>\",\n \"cc\": \"<string>\",\n \"bcc\": \"<string>\",\n \"replyTo\": \"<string>\",\n \"templateId\": \"<string>\",\n \"variables\": {},\n \"subject\": \"<string>\",\n \"html\": \"<string>\",\n \"text\": \"<string>\",\n \"type\": \"TRANSACTIONAL\",\n \"scheduledAt\": \"2023-11-07T05:31:56Z\",\n \"idempotencyKey\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://kourio.app/v1/emails")
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 \"to\": \"<string>\",\n \"from\": \"<string>\",\n \"cc\": \"<string>\",\n \"bcc\": \"<string>\",\n \"replyTo\": \"<string>\",\n \"templateId\": \"<string>\",\n \"variables\": {},\n \"subject\": \"<string>\",\n \"html\": \"<string>\",\n \"text\": \"<string>\",\n \"type\": \"TRANSACTIONAL\",\n \"scheduledAt\": \"2023-11-07T05:31:56Z\",\n \"idempotencyKey\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "<string>",
"status": "QUEUED",
"warnings": [
{
"code": "no_reply_sender",
"title": "<string>",
"detail": "<string>"
}
]
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"requestId": "<string>",
"details": [
{}
]
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"requestId": "<string>",
"details": [
{}
]
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"requestId": "<string>",
"details": [
{}
]
}
}Envia uma mensagem
A mensagem entra na fila e a resposta volta antes de ela sair. O from tem de estar num domínio verificado desta organização. Cada destinatário conta na cota, então uma chamada para três pessoas consome três — do mesmo jeito que os servidores de destino contam. Envie o cabeçalho Idempotency-Key para poder repetir a chamada com segurança depois de um tempo esgotado.
Duas formas de montar a mensagem, e só uma por chamada. Ou você manda templateId, e o assunto e o remetente vêm do template; ou manda subject e from junto com html ou text. Misturar as duas é recusado. Os campos aparecem como opcionais no esquema abaixo porque a exigência é entre eles, não de cada um.
curl --request POST \
--url https://kourio.app/v1/emails \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"to": "<string>",
"from": "<string>",
"cc": "<string>",
"bcc": "<string>",
"replyTo": "<string>",
"templateId": "<string>",
"variables": {},
"subject": "<string>",
"html": "<string>",
"text": "<string>",
"type": "TRANSACTIONAL",
"scheduledAt": "2023-11-07T05:31:56Z",
"idempotencyKey": "<string>"
}
'import requests
url = "https://kourio.app/v1/emails"
payload = {
"to": "<string>",
"from": "<string>",
"cc": "<string>",
"bcc": "<string>",
"replyTo": "<string>",
"templateId": "<string>",
"variables": {},
"subject": "<string>",
"html": "<string>",
"text": "<string>",
"type": "TRANSACTIONAL",
"scheduledAt": "2023-11-07T05:31:56Z",
"idempotencyKey": "<string>"
}
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({
to: '<string>',
from: '<string>',
cc: '<string>',
bcc: '<string>',
replyTo: '<string>',
templateId: '<string>',
variables: {},
subject: '<string>',
html: '<string>',
text: '<string>',
type: 'TRANSACTIONAL',
scheduledAt: '2023-11-07T05:31:56Z',
idempotencyKey: '<string>'
})
};
fetch('https://kourio.app/v1/emails', 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://kourio.app/v1/emails",
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([
'to' => '<string>',
'from' => '<string>',
'cc' => '<string>',
'bcc' => '<string>',
'replyTo' => '<string>',
'templateId' => '<string>',
'variables' => [
],
'subject' => '<string>',
'html' => '<string>',
'text' => '<string>',
'type' => 'TRANSACTIONAL',
'scheduledAt' => '2023-11-07T05:31:56Z',
'idempotencyKey' => '<string>'
]),
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://kourio.app/v1/emails"
payload := strings.NewReader("{\n \"to\": \"<string>\",\n \"from\": \"<string>\",\n \"cc\": \"<string>\",\n \"bcc\": \"<string>\",\n \"replyTo\": \"<string>\",\n \"templateId\": \"<string>\",\n \"variables\": {},\n \"subject\": \"<string>\",\n \"html\": \"<string>\",\n \"text\": \"<string>\",\n \"type\": \"TRANSACTIONAL\",\n \"scheduledAt\": \"2023-11-07T05:31:56Z\",\n \"idempotencyKey\": \"<string>\"\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://kourio.app/v1/emails")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"to\": \"<string>\",\n \"from\": \"<string>\",\n \"cc\": \"<string>\",\n \"bcc\": \"<string>\",\n \"replyTo\": \"<string>\",\n \"templateId\": \"<string>\",\n \"variables\": {},\n \"subject\": \"<string>\",\n \"html\": \"<string>\",\n \"text\": \"<string>\",\n \"type\": \"TRANSACTIONAL\",\n \"scheduledAt\": \"2023-11-07T05:31:56Z\",\n \"idempotencyKey\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://kourio.app/v1/emails")
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 \"to\": \"<string>\",\n \"from\": \"<string>\",\n \"cc\": \"<string>\",\n \"bcc\": \"<string>\",\n \"replyTo\": \"<string>\",\n \"templateId\": \"<string>\",\n \"variables\": {},\n \"subject\": \"<string>\",\n \"html\": \"<string>\",\n \"text\": \"<string>\",\n \"type\": \"TRANSACTIONAL\",\n \"scheduledAt\": \"2023-11-07T05:31:56Z\",\n \"idempotencyKey\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "<string>",
"status": "QUEUED",
"warnings": [
{
"code": "no_reply_sender",
"title": "<string>",
"detail": "<string>"
}
]
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"requestId": "<string>",
"details": [
{}
]
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"requestId": "<string>",
"details": [
{}
]
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"requestId": "<string>",
"details": [
{}
]
}
}Autorizações
Sua chave de API.
Corpo
3 - 3203 - 3843 - 3203 - 3203 - 3841 - 64Show child attributes
Show child attributes
1 - 99810485761048576TRANSACTIONAL, MARKETING 1 - 255Resposta
A requisição foi aceita, e o trabalho acontece depois dela.
Show child attributes
Show child attributes