Client for Segnivo Developer API
Project description
segnivo-python-sdk
API Version: 1.7
Date: 9th July, 2024
๐ Getting Started
This API is based on the REST API architecture, allowing the user to easily manage their data with this resource-based approach.
Every API call is established on which specific request type (GET, POST, PUT, DELETE) will be used.
The API must not be abused and should be used within acceptable limits.
To start using this API, you will need not create or access an existing Segnivo account to obtain your API key (retrievable from your account settings).
-
You must use a valid API Key to send requests to the API endpoints.
-
The API only responds to HTTPS-secured communications. Any requests sent via HTTP return an HTTP 301 redirect to the corresponding HTTPS resources.
-
The API returns request responses in JSON format. When an API request returns an error, it is sent in the JSON response as an error key or with details in the message key.
๐ Need some help?
In case you have questions or need clarity with interacting with some endpoints feel free to create a support ticket on your account or you can send an email (developers@segnivo.com) directly and we would be happy to help.
Authentication
As noted earlier, this API uses API keys for authentication. You can generate a Segnivo API key in the API section of your account settings.
You must include an API key in each request to this API with the X-API-KEY request header.
Authentication error response
If an API key is missing, malformed, or invalid, you will receive an HTTP 401 Unauthorized response code.
Rate and usage limits
API access rate limits apply on a per-API endpoint basis in unit time. The limit is 10k requests per hour for most endpoints and 1m requests per hour for transactional/relay email-sending endpoints. Also, depending on your plan, you may have usage limits. If you exceed either limit, your request will return an HTTP 429 Too Many Requests status code or HTTP 403 if sending credits have been exhausted.
503 response
An HTTP 503 response from our servers may indicate there is an unexpected spike in API access traffic, while this rarely happens, we ensure the server is usually operational within the next two to five minutes. If the outage persists or you receive any other form of an HTTP 5XX error, contact support (developers@segnivo.com).
Request headers
To make a successful request, some or all of the following headers must be passed with the request.
| Header | Description |
|---|---|
| Content-Type | Required and should be application/json in most cases. |
| Accept | Required and should be application/json in most cases |
| Content-Length | Required for POST, PATCH, and PUT requests containing a request body. The value must be the number of bytes rather than the number of characters in the request body. |
| X-API-KEY | Required. Specifies the API key used for authorization. |
๐ Note with example requests and code snippets
If/when you use the code snippets used as example requests, remember to calculate and add the Content-Length header. Some request libraries, frameworks, and tools automatically add this header for you while a few do not. Kindly check and ensure yours does or add it yourself.
Table of Contents
- Requirements
- Installation
- Getting Started
- Async
- Raw HTTP Response
- Reference
segnivo.email_address_verification.email_postsegnivo.email_campaigns.messages_getsegnivo.email_campaigns.messages_postsegnivo.email_campaigns.messages_uid_delete_postsegnivo.email_campaigns.messages_uid_getsegnivo.email_campaigns.messages_uid_patchsegnivo.email_campaigns.messages_uid_pause_postsegnivo.email_campaigns.messages_uid_resume_postsegnivo.mailing_lists.lists_getsegnivo.mailing_lists.lists_postsegnivo.mailing_lists.lists_uid_add_field_postsegnivo.mailing_lists.lists_uid_delete_postsegnivo.mailing_lists.lists_uid_getsegnivo.mailing_lists.lists_uid_patchsegnivo.relay.relay_emails_id_getsegnivo.relay.relay_raw_postsegnivo.relay_transactional_emails.relay_send_postsegnivo.subscribers_contacts.contacts_getsegnivo.subscribers_contacts.contacts_postsegnivo.subscribers_contacts.contacts_uid_add_tag_postsegnivo.subscribers_contacts.contacts_uid_delete_postsegnivo.subscribers_contacts.contacts_uid_getsegnivo.subscribers_contacts.contacts_uid_patchsegnivo.subscribers_contacts.contacts_uid_subscribe_patchsegnivo.subscribers_contacts.contacts_uid_unsubscribe_patch
Requirements
Python >=3.7
Installation
pip install segnivo-python-sdk==1.7.1
Getting Started
from pprint import pprint
from segnivo import Segnivo, ApiException
segnivo = Segnivo(
api_key_auth="YOUR_API_KEY",
)
try:
# Email Address Verification Validation
email_post_response = segnivo.email_address_verification.email_post()
except ApiException as e:
print("Exception when calling EmailAddressVerificationApi.email_post: %s\n" % e)
pprint(e.body)
pprint(e.headers)
pprint(e.status)
pprint(e.reason)
pprint(e.round_trip_time)
Async
async support is available by prepending a to any method.
import asyncio
from pprint import pprint
from segnivo import Segnivo, ApiException
segnivo = Segnivo(
api_key_auth="YOUR_API_KEY",
)
async def main():
try:
# Email Address Verification Validation
email_post_response = await segnivo.email_address_verification.aemail_post()
except ApiException as e:
print("Exception when calling EmailAddressVerificationApi.email_post: %s\n" % e)
pprint(e.body)
pprint(e.headers)
pprint(e.status)
pprint(e.reason)
pprint(e.round_trip_time)
asyncio.run(main())
Raw HTTP Response
To access raw HTTP response values, use the .raw namespace.
from pprint import pprint
from segnivo import Segnivo, ApiException
segnivo = Segnivo(
api_key_auth="YOUR_API_KEY",
)
try:
# Email Address Verification Validation
email_post_response = segnivo.email_address_verification.raw.email_post()
pprint(email_post_response.headers)
pprint(email_post_response.status)
pprint(email_post_response.round_trip_time)
except ApiException as e:
print("Exception when calling EmailAddressVerificationApi.email_post: %s\n" % e)
pprint(e.body)
pprint(e.headers)
pprint(e.status)
pprint(e.reason)
pprint(e.round_trip_time)
Reference
segnivo.email_address_verification.email_post
The /validate-email endpoint allows you to pass the email addresses you wish to verify and get a response on each of their status.
The following data should be passed in JSON format in the request body
- emails - An array/collection containing a minimum of one and maximum of fifty email addresses for verification/validation.
๐ ๏ธ Usage
email_post_response = segnivo.email_address_verification.email_post()
โ๏ธ Request Body
Dict[str, Union[bool, date, datetime, dict, float, int, list, str, None]]
๐ Endpoint
/validate-email post
๐ Back to Table of Contents
segnivo.email_campaigns.messages_get
Returns a collection of all your campaigns
๐ ๏ธ Usage
messages_get_response = segnivo.email_campaigns.messages_get(
accept="application/json",
)
โ๏ธ Parameters
accept: str
๐ Endpoint
/messages get
๐ Back to Table of Contents
segnivo.email_campaigns.messages_post
Creat an email campaign for processing
๐ ๏ธ Usage
messages_post_response = segnivo.email_campaigns.messages_post(
content_type="application/json",
accept="application/json",
)
โ๏ธ Parameters
content_type: str
accept: str
โ๏ธ Request Body
Dict[str, Union[bool, date, datetime, dict, float, int, list, str, None]]
๐ Endpoint
/messages post
๐ Back to Table of Contents
segnivo.email_campaigns.messages_uid_delete_post
Delete the specified campaign
๐ ๏ธ Usage
messages_uid_delete_post_response = segnivo.email_campaigns.messages_uid_delete_post(
uid="<string>",
accept="application/json",
)
โ๏ธ Parameters
uid: str
(Required) The uid of the campaign to delete
accept: str
โ๏ธ Request Body
Dict[str, Union[bool, date, datetime, dict, float, int, list, str, None]]
๐ Endpoint
/messages/{uid}/delete post
๐ Back to Table of Contents
segnivo.email_campaigns.messages_uid_get
Returns the specified campaign details
๐ ๏ธ Usage
messages_uid_get_response = segnivo.email_campaigns.messages_uid_get(
uid="<string>",
accept="application/json",
)
โ๏ธ Parameters
uid: str
(Required) The uid of the campaign to fetch
accept: str
๐ Endpoint
/messages/{uid} get
๐ Back to Table of Contents
segnivo.email_campaigns.messages_uid_patch
Updates a previously added campaign. Only Active and Paused campaigns can be updated.
๐ ๏ธ Usage
messages_uid_patch_response = segnivo.email_campaigns.messages_uid_patch(
uid="<string>",
content_type="application/json",
accept="application/json",
)
โ๏ธ Parameters
uid: str
(Required) The uid of the campaign to update
content_type: str
accept: str
โ๏ธ Request Body
Dict[str, Union[bool, date, datetime, dict, float, int, list, str, None]]
๐ Endpoint
/messages/{uid} patch
๐ Back to Table of Contents
segnivo.email_campaigns.messages_uid_pause_post
Pause the specified campaign
๐ ๏ธ Usage
messages_uid_pause_post_response = segnivo.email_campaigns.messages_uid_pause_post(
uid="<string>",
accept="application/json",
)
โ๏ธ Parameters
uid: str
(Required) The uid of the campaign to pause
accept: str
โ๏ธ Request Body
Dict[str, Union[bool, date, datetime, dict, float, int, list, str, None]]
๐ Endpoint
/messages/{uid}/pause post
๐ Back to Table of Contents
segnivo.email_campaigns.messages_uid_resume_post
Resume delivery of the specified campaign
๐ ๏ธ Usage
messages_uid_resume_post_response = segnivo.email_campaigns.messages_uid_resume_post(
uid="<string>",
accept="application/json",
)
โ๏ธ Parameters
uid: str
(Required) The uid of the campaign to resume
accept: str
โ๏ธ Request Body
Dict[str, Union[bool, date, datetime, dict, float, int, list, str, None]]
๐ Endpoint
/messages/{uid}/resume post
๐ Back to Table of Contents
segnivo.mailing_lists.lists_get
Returns all your existing lists
๐ ๏ธ Usage
lists_get_response = segnivo.mailing_lists.lists_get(
accept="application/json",
)
โ๏ธ Parameters
accept: str
๐ Endpoint
/lists get
๐ Back to Table of Contents
segnivo.mailing_lists.lists_post
Create a new mailing list
๐ ๏ธ Usage
lists_post_response = segnivo.mailing_lists.lists_post(
content_type="application/json",
accept="application/json",
)
โ๏ธ Parameters
content_type: str
accept: str
โ๏ธ Request Body
Dict[str, Union[bool, date, datetime, dict, float, int, list, str, None]]
๐ Endpoint
/lists post
๐ Back to Table of Contents
segnivo.mailing_lists.lists_uid_add_field_post
Add a field to an existing list
๐ ๏ธ Usage
lists_uid_add_field_post_response = segnivo.mailing_lists.lists_uid_add_field_post(
uid="<string>",
content_type="application/json",
accept="application/json",
)
โ๏ธ Parameters
uid: str
(Required) The uid of the list to add a field to.
content_type: str
accept: str
โ๏ธ Request Body
Dict[str, Union[bool, date, datetime, dict, float, int, list, str, None]]
๐ Endpoint
/lists/{uid}/add-field post
๐ Back to Table of Contents
segnivo.mailing_lists.lists_uid_delete_post
Delete an existing list
๐ ๏ธ Usage
lists_uid_delete_post_response = segnivo.mailing_lists.lists_uid_delete_post(
uid="<string>",
accept="application/json",
)
โ๏ธ Parameters
uid: str
(Required) The uid of the list to delete.
accept: str
โ๏ธ Request Body
Dict[str, Union[bool, date, datetime, dict, float, int, list, str, None]]
๐ Endpoint
/lists/{uid}/delete post
๐ Back to Table of Contents
segnivo.mailing_lists.lists_uid_get
Returns detailed information about a specified list
๐ ๏ธ Usage
lists_uid_get_response = segnivo.mailing_lists.lists_uid_get(
uid="<string>",
accept="application/json",
)
โ๏ธ Parameters
uid: str
(Required) The uid of the mailing list to fetch.
accept: str
๐ Endpoint
/lists/{uid} get
๐ Back to Table of Contents
segnivo.mailing_lists.lists_uid_patch
Update an existing mailing list
๐ ๏ธ Usage
lists_uid_patch_response = segnivo.mailing_lists.lists_uid_patch(
uid="<string>",
content_type="application/json",
accept="application/json",
)
โ๏ธ Parameters
uid: str
(Required) The uid of the list to update.
content_type: str
accept: str
โ๏ธ Request Body
Dict[str, Union[bool, date, datetime, dict, float, int, list, str, None]]
๐ Endpoint
/lists/{uid} patch
๐ Back to Table of Contents
segnivo.relay.relay_emails_id_get
The /emails endpoint lets you fetch one or more marketing/transactional email(s) from your Segnivo Messaging account and it accepts two optional parameters.
-
The
idstring of the email to fetch provided as a path variable -
The
limiton the number of records to fetch (if email id is not provided) as a query string parameter. This value defaults to 100 if not provided.
๐ ๏ธ Usage
relay_emails_id_get_response = segnivo.relay.relay_emails_id_get(
id="<string>",
limit=100,
)
โ๏ธ Parameters
id: str
The ID of the email to fetch
limit: int
The number of records to fetch
๐ Endpoint
/relay/emails/{id} get
๐ Back to Table of Contents
segnivo.relay.relay_raw_post
The /raw endpoint lets you send marketing and transactional emails from your Segnivo Messaging account by passing a raw RFC822 message to the message attribute in the request body.
The following parameters should be passed as a form data to the endpoint
-
message - A raw RFC822 message
-
sign_dkim (optional, defaults to
true) - A boolean value on if a DKIM signature should be included in this message -
track_click (optional, defaults to
true) - A boolean value on if email clicks should be tracked. Iftruelinks in the email will be rewritten to enable tracking -
track_open (optional, defaults to
true) - A boolean value on if the email opens should be tracked -
is_transactional (optional, defaults to
false) - A boolean value to flag this email as a transactional email
๐ ๏ธ Usage
relay_raw_post_response = segnivo.relay.relay_raw_post(
message="A raw RFC822 message string",
is_transactional=True,
track_click=False,
track_open=False,
sign_dkim=True,
)
โ๏ธ Parameters
message: str
is_transactional: bool
track_click: bool
track_open: bool
sign_dkim: bool
โ๏ธ Request Body
๐ Endpoint
/relay/raw post
๐ Back to Table of Contents
segnivo.relay_transactional_emails.relay_send_post
The /send endpoint lets you send marketing and transactional emails from your Segnivo Messaging account.
The following data should be passed in JSON format in the request body
-
subject - The subject of the email
-
from_name (optional) - The full name of the sender
-
from_email - The email of the sender
-
reply_to (optional) - The email to which replies should be sent
-
content_type (optional, defaults to
html) - The content type of the email body. Accepts eithertextorhtml -
recipients - An array/collection of email addresses to deliver this message, max. 50
-
content - The HTML or plain text content of the email
-
preheader (optional) - The email preheader
-
custom_headers (optional) - An object of custom headers to add to the email
-
delivery_at (optional) - The 10-digit unix timestamp of the date/time at which this email should be delivered
-
attachments (optional) - An array/collection of the URLs of files to attach to the email
-
sign_dkim (optional, defaults to
true) - A boolean value on if a DKIM signature should be included in this message -
track_click (optional, defaults to
true) - A boolean value on if email clicks should be tracked. Iftruelinks in the email will be rewritten to enable tracking -
track_open (optional, defaults to
true) - A boolean value on if the email opens should be tracked -
is_transactional (optional, defaults to
false) - A boolean value to flag this email as a transactional email
๐ Important
is_transactional must only be set to true for transactional emails. Setting this to true for marketing emails will result in your API access being revoked and your account disabled.
๐ ๏ธ Usage
relay_send_post_response = segnivo.relay_transactional_emails.relay_send_post()
โ๏ธ Request Body
Dict[str, Union[bool, date, datetime, dict, float, int, list, str, None]]
๐ Endpoint
/relay/send post
๐ Back to Table of Contents
segnivo.subscribers_contacts.contacts_get
Returns a list of contacts/subscribers on your account
This endpoint accepts three optional query parameters
-
emailโ An email address to search for. If set, the endpoint only returns subscribers that have an identical email address. -
per_pageโ A limit on the number of records to return. -
pageโ The parameter serves as an offset on the number of records returned.
๐ ๏ธ Usage
contacts_get_response = segnivo.subscribers_contacts.contacts_get(
accept="application/json",
email="<string>",
per_page=20,
page=1,
)
โ๏ธ Parameters
accept: str
email: str
An email address to search for.
per_page: int
How many items should be returned ahead.
page: int
The offset for the items to be returned, helps in pagination.
๐ Endpoint
/contacts get
๐ Back to Table of Contents
segnivo.subscribers_contacts.contacts_post
Add a new contact/subscriber to your mailing list
๐ ๏ธ Usage
contacts_post_response = segnivo.subscribers_contacts.contacts_post(
content_type="application/json",
accept="application/json",
)
โ๏ธ Parameters
content_type: str
accept: str
โ๏ธ Request Body
Dict[str, Union[bool, date, datetime, dict, float, int, list, str, None]]
๐ Endpoint
/contacts post
๐ Back to Table of Contents
segnivo.subscribers_contacts.contacts_uid_add_tag_post
Add tags to an existing contact
๐ ๏ธ Usage
contacts_uid_add_tag_post_response = (
segnivo.subscribers_contacts.contacts_uid_add_tag_post(
uid="<string>",
content_type="application/json",
accept="application/json",
)
)
โ๏ธ Parameters
uid: str
(Required) The uid of the contact to update with the tags.
content_type: str
accept: str
โ๏ธ Request Body
Dict[str, Union[bool, date, datetime, dict, float, int, list, str, None]]
๐ Endpoint
/contacts/{uid}/add-tag post
๐ Back to Table of Contents
segnivo.subscribers_contacts.contacts_uid_delete_post
Delete an existing contact
๐ ๏ธ Usage
contacts_uid_delete_post_response = (
segnivo.subscribers_contacts.contacts_uid_delete_post(
uid="<string>",
accept="application/json",
)
)
โ๏ธ Parameters
uid: str
(Required) The uid of the contact to delete.
accept: str
โ๏ธ Request Body
Dict[str, Union[bool, date, datetime, dict, float, int, list, str, None]]
๐ Endpoint
/contacts/{uid}/delete post
๐ Back to Table of Contents
segnivo.subscribers_contacts.contacts_uid_get
Fetch detailed contact information for specified a contact
๐ ๏ธ Usage
contacts_uid_get_response = segnivo.subscribers_contacts.contacts_uid_get(
uid="<string>",
accept="application/json",
)
โ๏ธ Parameters
uid: str
(Required) The uid of the contact to get.
accept: str
๐ Endpoint
/contacts/{uid} get
๐ Back to Table of Contents
segnivo.subscribers_contacts.contacts_uid_patch
Update the specified subscriber/contact
๐ ๏ธ Usage
contacts_uid_patch_response = segnivo.subscribers_contacts.contacts_uid_patch(
uid="<string>",
content_type="application/json",
accept="application/json",
)
โ๏ธ Parameters
uid: str
(Required) The uid of the contact to update.
content_type: str
accept: str
โ๏ธ Request Body
Dict[str, Union[bool, date, datetime, dict, float, int, list, str, None]]
๐ Endpoint
/contacts/{uid} patch
๐ Back to Table of Contents
segnivo.subscribers_contacts.contacts_uid_subscribe_patch
Subscribe a contact to a list
๐ ๏ธ Usage
contacts_uid_subscribe_patch_response = (
segnivo.subscribers_contacts.contacts_uid_subscribe_patch(
uid="<string>",
accept="application/json",
list_uid="<string>",
)
)
โ๏ธ Parameters
uid: str
(Required) The uid of the contact to subscribe.
accept: str
list_uid: str
(Required) The uid of the mail list to subscribe the contact.
โ๏ธ Request Body
Dict[str, Union[bool, date, datetime, dict, float, int, list, str, None]]
๐ Endpoint
/contacts/{uid}/subscribe patch
๐ Back to Table of Contents
segnivo.subscribers_contacts.contacts_uid_unsubscribe_patch
Unsubscribe a contact from a list
๐ ๏ธ Usage
contacts_uid_unsubscribe_patch_response = (
segnivo.subscribers_contacts.contacts_uid_unsubscribe_patch(
uid="<string>",
accept="application/json",
list_uid="<string>",
)
)
โ๏ธ Parameters
uid: str
(Required) The uid of the contact to unsubscribe.
accept: str
list_uid: str
(Required) The uid of the mail list to unsubscribe the contact.
โ๏ธ Request Body
Dict[str, Union[bool, date, datetime, dict, float, int, list, str, None]]
๐ Endpoint
/contacts/{uid}/unsubscribe patch
๐ Back to Table of Contents
Author
This Python package is automatically generated by Konfig
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 segnivo_python_sdk-1.7.1.tar.gz.
File metadata
- Download URL: segnivo_python_sdk-1.7.1.tar.gz
- Upload date:
- Size: 90.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.10.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7bd65fc0705604a319b36140d48392a0625035d6370e183594f4d37e5dd6e8bc
|
|
| MD5 |
dcbad514fb9fced0e0312307f56c91c6
|
|
| BLAKE2b-256 |
999566ce6f3fa982311a6652a678bf546ceef458faa8e839841c10fb3c9a7f55
|
File details
Details for the file segnivo_python_sdk-1.7.1-py3-none-any.whl.
File metadata
- Download URL: segnivo_python_sdk-1.7.1-py3-none-any.whl
- Upload date:
- Size: 343.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.10.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d12f2598563cf79b88fba137aaa337c7330f1917905a994919f63001f52a2d3e
|
|
| MD5 |
d306a4afc202de9079c7083b1086c94c
|
|
| BLAKE2b-256 |
a2f6c499e5fa2a3812476fd39b6d450a4a814779abb038794ace0a1f9aba7eb1
|