Skip to main content

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.

PyPI README.md

Table of Contents

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 id string of the email to fetch provided as a path variable

  • The limit on 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. If true links 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

Any

๐ŸŒ 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 either text or html

  • 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. If true links 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

segnivo_python_sdk-1.7.1.tar.gz (90.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

segnivo_python_sdk-1.7.1-py3-none-any.whl (343.5 kB view details)

Uploaded Python 3

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

Hashes for segnivo_python_sdk-1.7.1.tar.gz
Algorithm Hash digest
SHA256 7bd65fc0705604a319b36140d48392a0625035d6370e183594f4d37e5dd6e8bc
MD5 dcbad514fb9fced0e0312307f56c91c6
BLAKE2b-256 999566ce6f3fa982311a6652a678bf546ceef458faa8e839841c10fb3c9a7f55

See more details on using hashes here.

File details

Details for the file segnivo_python_sdk-1.7.1-py3-none-any.whl.

File metadata

File hashes

Hashes for segnivo_python_sdk-1.7.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d12f2598563cf79b88fba137aaa337c7330f1917905a994919f63001f52a2d3e
MD5 d306a4afc202de9079c7083b1086c94c
BLAKE2b-256 a2f6c499e5fa2a3812476fd39b6d450a4a814779abb038794ace0a1f9aba7eb1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page