Server-side Python SDK for Sentroy platform API
Project description
Sentroy Client SDK for Python
Server-side SDK to interact with the Sentroy platform API.
List domains, manage mailboxes, fetch templates, read inbox, and send emails.
Installation
pip install sentroy-client-sdk
Quick Start
from sentroy import Sentroy
sentroy = Sentroy(
base_url="https://sentroy.com",
company_slug="my-company",
access_token="stk_...",
)
Access tokens can be created from Admin > Access Tokens in the Sentroy dashboard.
Usage
Domains
# List all domains
domains = sentroy.domains.list()
# Get a single domain
domain = sentroy.domains.get("domain-id")
Mailboxes
# List all mailbox accounts
mailboxes = sentroy.mailboxes.list()
Templates
# List all templates
templates = sentroy.templates.list()
# Get a template by ID
template = sentroy.templates.get("template-id")
Templates support multiple languages. A field like name or subject can be a plain string or a dict keyed by language code:
# Example template response
{
"id": "b3f1a2c4-...",
"name": {"en": "Welcome Email", "tr": "Hosgeldin E-postasi"},
"subject": {"en": "Welcome, {{name}}!", "tr": "Hosgeldin, {{name}}!"},
"mjmlBody": {"en": "<mjml>...</mjml>", "tr": "<mjml>...</mjml>"},
"variables": ["name", "company"],
"domainId": "a1b2c3d4-...",
"domainName": "example.com"
}
Use the variables list to know which placeholders ({{name}}, {{company}}) the template expects.
Inbox
from sentroy import InboxListParams
# List messages
messages = sentroy.inbox.list(InboxListParams(
mailbox="info@example.com",
folder="INBOX",
page=1,
limit=20,
))
# Get a single message
message = sentroy.inbox.get(1234, mailbox="info@example.com")
# List IMAP folders
folders = sentroy.inbox.list_folders("info@example.com")
# Get a thread by subject
thread = sentroy.inbox.get_thread("Re: Project update", "info@example.com")
# Mark as read / unread
sentroy.inbox.mark_as_read(1234, mailbox="info@example.com")
sentroy.inbox.mark_as_unread(1234, mailbox="info@example.com")
# Move message
sentroy.inbox.move(1234, "Trash", from_folder="INBOX", mailbox="info@example.com")
# Delete message
sentroy.inbox.delete(1234, mailbox="info@example.com")
Send Email
from sentroy import SendParams, Attachment
# Send with a template
result = sentroy.send.email(SendParams(
to="user@example.com",
from_addr="info@example.com",
subject="Welcome!",
domain_id="domain-id",
template_id="template-id",
variables={
"name": "John",
"company": "Acme",
},
))
# Send with a specific language
result = sentroy.send.email(SendParams(
to="user@example.com",
from_addr="info@example.com",
subject="Hosgeldin!",
domain_id="domain-id",
template_id="template-id",
lang="tr",
variables={"name": "Ahmet"},
))
# Send with raw HTML
result = sentroy.send.email(SendParams(
to=["user1@example.com", "user2@example.com"],
from_addr="info@example.com",
subject="Hello",
domain_id="domain-id",
html="<h1>Hello World</h1>",
))
# Send with attachments
result = sentroy.send.email(SendParams(
to="user@example.com",
from_addr="info@example.com",
subject="Invoice",
domain_id="domain-id",
html="<p>Please find your invoice attached.</p>",
attachments=[
Attachment(
filename="invoice.pdf",
content=base64_string,
content_type="application/pdf",
),
],
))
Error Handling
from sentroy import Sentroy, SentroyError
try:
sentroy.send.email(params)
except SentroyError as err:
print(err.status_code) # 401, 403, 500, etc.
print(err) # Human-readable error
Configuration
| Option | Type | Required | Description |
|---|---|---|---|
base_url |
str |
Yes | Sentroy instance URL (e.g. https://sentroy.com) |
company_slug |
str |
Yes | Your company slug |
access_token |
str |
Yes | Access token (stk_...) |
timeout |
int |
No | Request timeout in seconds (default: 30) |
Requirements
- Python 3.10+
- Zero external dependencies (stdlib only)
Raw Documentation
For AI agents and LLMs — plain-text version of this document:
https://raw.githubusercontent.com/Sentroy-Co/client-sdk/refs/heads/main/python/README.md
License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sentroy_client_sdk-1.1.5.tar.gz.
File metadata
- Download URL: sentroy_client_sdk-1.1.5.tar.gz
- Upload date:
- Size: 6.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f08c7d8882e6786e0119f68c00ad5a0c051ab0c5e935f5bf2d9ec7ec21a03c39
|
|
| MD5 |
98d0d08b41824f9eae1ef7c21467c363
|
|
| BLAKE2b-256 |
a070f25f1fb6313fafc26e683b08d69930bd3060f1be301c9ba195f24ebcc32a
|
Provenance
The following attestation bundles were made for sentroy_client_sdk-1.1.5.tar.gz:
Publisher:
publish-python.yml on Sentroy-Co/client-sdk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
sentroy_client_sdk-1.1.5.tar.gz -
Subject digest:
f08c7d8882e6786e0119f68c00ad5a0c051ab0c5e935f5bf2d9ec7ec21a03c39 - Sigstore transparency entry: 1336679607
- Sigstore integration time:
-
Permalink:
Sentroy-Co/client-sdk@459498550c77c2cd5a5eb7991b68310bccbaf8c6 -
Branch / Tag:
refs/tags/v1.1.5 - Owner: https://github.com/Sentroy-Co
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-python.yml@459498550c77c2cd5a5eb7991b68310bccbaf8c6 -
Trigger Event:
push
-
Statement type:
File details
Details for the file sentroy_client_sdk-1.1.5-py3-none-any.whl.
File metadata
- Download URL: sentroy_client_sdk-1.1.5-py3-none-any.whl
- Upload date:
- Size: 9.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8b78c5343048c1637411874e59e332b1c2382af29d3fadcd5b91d9806821bb19
|
|
| MD5 |
8899791904b885d1f9617bc24594c691
|
|
| BLAKE2b-256 |
4d0b17f3e9f9e03f91de6bb4792f94ba451a877a88d2dc068019cd318591192f
|
Provenance
The following attestation bundles were made for sentroy_client_sdk-1.1.5-py3-none-any.whl:
Publisher:
publish-python.yml on Sentroy-Co/client-sdk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
sentroy_client_sdk-1.1.5-py3-none-any.whl -
Subject digest:
8b78c5343048c1637411874e59e332b1c2382af29d3fadcd5b91d9806821bb19 - Sigstore transparency entry: 1336679769
- Sigstore integration time:
-
Permalink:
Sentroy-Co/client-sdk@459498550c77c2cd5a5eb7991b68310bccbaf8c6 -
Branch / Tag:
refs/tags/v1.1.5 - Owner: https://github.com/Sentroy-Co
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-python.yml@459498550c77c2cd5a5eb7991b68310bccbaf8c6 -
Trigger Event:
push
-
Statement type: