Skip to content

Other languages

Official Python and PHP SDKs are on the way. Until then, the REST API works from any language with one HTTPS request. The API reference has generated examples for each endpoint.

Python (requests)
import os
import requests
res = requests.post(
"https://api.vaartix.com/emails",
headers={
"Authorization": f"Bearer {os.environ['VAARTIX_API_KEY']}",
"Idempotency-Key": "order-1042-receipt",
},
json={
"from": "Acme <[email protected]>",
"to": ["[email protected]"],
"subject": "Your receipt",
"html": "<p>Thanks for your order.</p>",
},
)
print(res.status_code, res.json())
PHP (cURL)
<?php
$ch = curl_init('https://api.vaartix.com/emails');
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('VAARTIX_API_KEY'),
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode([
'from' => 'Acme <[email protected]>',
'to' => ['[email protected]'],
'subject' => 'Your receipt',
'html' => '<p>Thanks for your order.</p>',
]),
]);
echo curl_exec($ch);

More examples (Go, Rust, Java, Elixir, .NET, serverless platforms) are on the home page.

SMTP relay, for WordPress, Laravel and other apps that only speak SMTP, is coming soon after launch.