SDKs and compatibility
Use SendHog with familiar tools from the email provider you already know.
An SDK is a ready-made code library that helps your application use SendHog. We provide SDKs with the same sending methods and response formats as Amazon SES, Postmark, Resend and SendGrid for the operations we support.
Authentication is specific to SendHog: use a SendHog API key, not a key from your previous provider. The API reference lists the supported operations and their limits.
Starting fresh? Choose the SendHog SDK. Moving an existing application? Choose your current provider’s style to keep supported sending code familiar. Libraries are available for JavaScript, TypeScript and Python.
Install and send
JavaScript and TypeScript share @sendhog/sdk on npm. Install with npm install @sendhog/sdk; Node.js 22 or newer is required. Provider compatibility clients are included in the same package, not separate installations.
Python requires version 3.11 or newer. Install sendhog-sdk from PyPI with python -m pip install sendhog-sdk. No local SendHog checkout or Git installation is needed. The public source is available at SendHog/sdk-python.
Use SENDHOG_API_KEY to provide the full API key on your server. Keep it out of browser code. The getting started guide walks through creating a key and verifying your domain.
import { SendHog } from '@sendhog/sdk';
const client = new SendHog(process.env.SENDHOG_API_KEY ?? '');
const { id } = await client.send({
"from": "sender@example.com",
"to": "recipient@example.net",
"subject": "Hello from SendHog",
"text": "Hello from your application."
});
console.log(id);npm install @sendhog/sdkimport { SendHog } from '@sendhog/sdk';
const client = new SendHog(process.env.SENDHOG_API_KEY ?? '');
const { id } = await client.send({
"from": "sender@example.com",
"to": "recipient@example.net",
"subject": "Hello from SendHog",
"text": "Hello from your application."
});
console.log(id);npm install @sendhog/sdkimport os
from sendhog import SendHog
client = SendHog(os.environ['SENDHOG_API_KEY'])
result = client.send({
"from": "sender@example.com",
"to": "recipient@example.net",
"subject": "Hello from SendHog",
"text": "Hello from your application."
})
print(result['id'])python -m pip install sendhog-sdk# Native SendHog HTTP; the SDK translates the SendHog call above.
curl 'https://app.sendhog.com/v1/send' \
-H "Authorization: Bearer $SENDHOG_API_KEY" \
-H 'Content-Type: application/json' \
--data '{
"from": "sender@example.com",
"to": [
"recipient@example.net"
],
"subject": "Hello from SendHog",
"text": "Hello from your application."
}'No SDK installation required.import { SESv2Client, SendEmailCommand } from '@sendhog/sdk/ses';
const apiKey = process.env.SENDHOG_API_KEY;
if (!apiKey) throw new Error('Set SENDHOG_API_KEY on your server.');
const client = new SESv2Client({ apiKey });
const result = await client.send(new SendEmailCommand({
"FromEmailAddress": "sender@example.com",
"Destination": {
"ToAddresses": [
"recipient@example.net"
]
},
"Content": {
"Simple": {
"Subject": {
"Data": "Hello from SendHog"
},
"Body": {
"Text": {
"Data": "Hello from your application."
}
}
}
}
}));
console.log(result.MessageId);npm install @sendhog/sdkimport { SESv2Client, SendEmailCommand } from '@sendhog/sdk/ses';
const apiKey = process.env.SENDHOG_API_KEY;
if (!apiKey) throw new Error('Set SENDHOG_API_KEY on your server.');
const client = new SESv2Client({ apiKey });
const result = await client.send(new SendEmailCommand({
"FromEmailAddress": "sender@example.com",
"Destination": {
"ToAddresses": [
"recipient@example.net"
]
},
"Content": {
"Simple": {
"Subject": {
"Data": "Hello from SendHog"
},
"Body": {
"Text": {
"Data": "Hello from your application."
}
}
}
}
}));
console.log(result.MessageId);npm install @sendhog/sdkimport os
from sendhog.ses import SESv2Client
client = SESv2Client(os.environ['SENDHOG_API_KEY'])
result = client.send_email(**{
"FromEmailAddress": "sender@example.com",
"Destination": {
"ToAddresses": [
"recipient@example.net"
]
},
"Content": {
"Simple": {
"Subject": {
"Data": "Hello from SendHog"
},
"Body": {
"Text": {
"Data": "Hello from your application."
}
}
}
}
})
print(result['MessageId'])python -m pip install sendhog-sdk# Native SendHog HTTP; the SDK translates the Amazon SES call above.
curl 'https://app.sendhog.com/v1/send' \
-H "Authorization: Bearer $SENDHOG_API_KEY" \
-H 'Content-Type: application/json' \
--data '{
"from": "sender@example.com",
"to": [
"recipient@example.net"
],
"subject": "Hello from SendHog",
"text": "Hello from your application."
}'No SDK installation required.import { ServerClient } from '@sendhog/sdk/postmark';
const apiKey = process.env.SENDHOG_API_KEY;
if (!apiKey) throw new Error('Set SENDHOG_API_KEY on your server.');
const client = new ServerClient({ apiKey });
const result = await client.sendEmail({
"From": "sender@example.com",
"To": "recipient@example.net",
"Subject": "Hello from SendHog",
"TextBody": "Hello from your application."
});
console.log(result.MessageID);npm install @sendhog/sdkimport { ServerClient } from '@sendhog/sdk/postmark';
const apiKey = process.env.SENDHOG_API_KEY;
if (!apiKey) throw new Error('Set SENDHOG_API_KEY on your server.');
const client = new ServerClient({ apiKey });
const result = await client.sendEmail({
"From": "sender@example.com",
"To": "recipient@example.net",
"Subject": "Hello from SendHog",
"TextBody": "Hello from your application."
});
console.log(result.MessageID);npm install @sendhog/sdkimport os
from sendhog.postmark import ServerClient
import asyncio
async def main():
async with ServerClient(os.environ['SENDHOG_API_KEY']) as client:
result = await client.outbound.send({
"sender": "sender@example.com",
"to": "recipient@example.net",
"subject": "Hello from SendHog",
"text_body": "Hello from your application."
})
print(result.message_id)
asyncio.run(main())python -m pip install sendhog-sdk# Native SendHog HTTP; the SDK translates the Postmark call above.
curl 'https://app.sendhog.com/v1/send' \
-H "Authorization: Bearer $SENDHOG_API_KEY" \
-H 'Content-Type: application/json' \
--data '{
"from": "sender@example.com",
"to": [
"recipient@example.net"
],
"subject": "Hello from SendHog",
"text": "Hello from your application."
}'No SDK installation required.import { Resend } from '@sendhog/sdk/resend';
const apiKey = process.env.SENDHOG_API_KEY;
if (!apiKey) throw new Error('Set SENDHOG_API_KEY on your server.');
const client = new Resend({ apiKey });
const { data, error } = await client.emails.send({
"from": "sender@example.com",
"to": [
"recipient@example.net"
],
"subject": "Hello from SendHog",
"text": "Hello from your application."
});
if (error) throw new Error(error.message);
console.log(data.id);npm install @sendhog/sdkimport { Resend } from '@sendhog/sdk/resend';
const apiKey = process.env.SENDHOG_API_KEY;
if (!apiKey) throw new Error('Set SENDHOG_API_KEY on your server.');
const client = new Resend({ apiKey });
const { data, error } = await client.emails.send({
"from": "sender@example.com",
"to": [
"recipient@example.net"
],
"subject": "Hello from SendHog",
"text": "Hello from your application."
});
if (error) throw new Error(error.message);
console.log(data.id);npm install @sendhog/sdkimport os
from sendhog.resend import Resend
client = Resend(os.environ['SENDHOG_API_KEY'])
result = client.Emails.send({
"from": "sender@example.com",
"to": [
"recipient@example.net"
],
"subject": "Hello from SendHog",
"text": "Hello from your application."
})
print(result['id'])python -m pip install sendhog-sdk# Native SendHog HTTP; the SDK translates the Resend call above.
curl 'https://app.sendhog.com/v1/send' \
-H "Authorization: Bearer $SENDHOG_API_KEY" \
-H 'Content-Type: application/json' \
--data '{
"from": "sender@example.com",
"to": [
"recipient@example.net"
],
"subject": "Hello from SendHog",
"text": "Hello from your application."
}'No SDK installation required.import { SendGridClient } from '@sendhog/sdk/sendgrid';
const apiKey = process.env.SENDHOG_API_KEY;
if (!apiKey) throw new Error('Set SENDHOG_API_KEY on your server.');
const client = new SendGridClient({ apiKey });
const [response] = await client.send({
"from": "sender@example.com",
"to": "recipient@example.net",
"subject": "Hello from SendHog",
"text": "Hello from your application."
});
console.log(response.headers['x-message-id']);npm install @sendhog/sdkimport { SendGridClient } from '@sendhog/sdk/sendgrid';
const apiKey = process.env.SENDHOG_API_KEY;
if (!apiKey) throw new Error('Set SENDHOG_API_KEY on your server.');
const client = new SendGridClient({ apiKey });
const [response] = await client.send({
"from": "sender@example.com",
"to": "recipient@example.net",
"subject": "Hello from SendHog",
"text": "Hello from your application."
});
console.log(response.headers['x-message-id']);npm install @sendhog/sdkimport os
from sendhog.sendgrid import SendGridAPIClient
client = SendGridAPIClient(os.environ['SENDHOG_API_KEY'])
response = client.send({
"from": {
"email": "sender@example.com"
},
"personalizations": [
{
"to": [
{
"email": "recipient@example.net"
}
]
}
],
"subject": "Hello from SendHog",
"content": [
{
"type": "text/plain",
"value": "Hello from your application."
}
]
})
print(response.headers['x-message-id'])python -m pip install sendhog-sdk# Native SendHog HTTP; the SDK translates the SendGrid call above.
curl 'https://app.sendhog.com/v1/send' \
-H "Authorization: Bearer $SENDHOG_API_KEY" \
-H 'Content-Type: application/json' \
--data '{
"from": "sender@example.com",
"to": [
"recipient@example.net"
],
"subject": "Hello from SendHog",
"text": "Hello from your application."
}'No SDK installation required.Supported sending methods
A method is the action your application calls to send an email. These names match the supported provider style; requests go to SendHog, not to your previous provider.
| Style | JavaScript / TypeScript | Python |
|---|---|---|
| SendHog | SendHog.send | SendHog.send |
| Amazon SES | SESv2Client.send | SESv2Client.send_email |
| Postmark | ServerClient.sendEmail | ServerClient.outbound.send |
| Resend | Resend.emails.send | Resend.Emails.send |
| SendGrid | SendGridClient.send | SendGridAPIClient.send |
The SendHog SDK uses client.send(message). It returns a message ID and creation time; read result.id in JavaScript or result['id'] in Python. See sending and message events for fields, limits and delivery states.
What changes when you switch
Replace the provider package, client setup and API key with SendHog’s equivalents. Keep the sending methods and response fields listed here. Changing only your old provider’s server address will not work.
Compatibility covers the documented sending methods, not every feature in the original provider. Original provider-template IDs, attachments, scheduled sends, tracking and provider-specific settings are not supported. SendHog’s own published templates use its native template reference. Unsupported options produce an error rather than being silently ignored.
You can also read stored messages with messages.list and messages.get. These are SendHog features, not copies of another provider’s receiving service.
Response details by provider
- Amazon SES: JavaScript uses
SendEmailCommandand returnsMessageId. Python usessend_emailand includesResponseMetadata. Only SES v2 Simple text/HTML messages are supported; AWS credentials and signatures are not used. - Postmark: JavaScript uses
sendEmailand the usual capitalized field names. Python uses the current asyncoutbound.sendmethod. Only the outbound transactional stream is supported, not broadcast streams or older community Python clients. - Resend: JavaScript uses
emails.sendand returnsdata,errorandheaders. Python usesEmails.sendand returns a dictionary containing the ID. - SendGrid: JavaScript uses
sendwith a plain message object and returns a response/body pair. Python accepts a dictionary with one personalization and returnsstatus_code,headersandbody. SendGrid Mail helper objects and callback overloads are not supported.
Only the listed response fields are covered, not every helper on a provider’s response object. Request errors use SendHog’s error codes; they do not reproduce every error from the original provider. The SendHog SDK throws on failure. Resend-style JavaScript returns HTTP errors in its error field; local input-validation errors still throw.
Technical reference files
For tools that read API definitions, download OpenAPI 3.1, JSON Schema or the SDK method list. These describe the same requests and responses used in the examples.