EmailGuard
  • Pricing
Log inRegister
DocumentationAPI ReferenceKnowledge Base

API reference

Download spec

API reference

Guides and endpoint docs

  • SDK clients
  • TypeScript SDK
  • Go SDK
  • Python SDK
  • PHP SDK
  • Ruby SDK
  • MCP client
  • getGet team
  • patchUpdate team
  • getList team members
  • deleteRemove a team member
  • patchUpdate a team member role
  • deleteCancel a pending invite
  • postInvite a team member
  • getList pending team invites
  • getGet billing usage
  • postCreate notification channel
  • deleteDelete notification channel
  • getList notification channels
  • postTest notification channel
  • putUpdate notification channel
  • getList notification events
  • postCreate notification rule
  • deleteDelete notification rule
  • getList notification rules
  • putUpdate notification rule
  • getDetect email characteristics

Python SDK

PyPI package generated from the public OpenAPI spec.

Loading article…

On this page

  • Install
  • Configure
  • Quickstart
  • Response envelope
  • API classes
    • Billing
    • Channels
    • email
    • Events
    • Invites
    • Members
    • Rules
    • Teams
  • Authentication pattern
  • Errors and limits
  • Related
Go SDKPHP SDK

Install the Python SDK when you prefer pip and generated API classes over hand-written requests calls. The package emailguard_sdk is built from the same OpenAPI spec as this reference (version 1.0.0).

Install

pip install emailguard_sdk==1.0.0

Use a virtual environment and pin the version in requirements.txt for reproducible deploys.

Configure

VariableRequiredDescription
EMAILGUARD_API_KEYYesTeam-scoped live key (egsk_live_...)

API_KEY is accepted as an alias in most clients.

Set the API host on Configuration.host if you are not targeting the default origin (https://api.emailguard.co).

Quickstart

import os
import emailguard_sdk
from emailguard_sdk.rest import ApiException
 
configuration = emailguard_sdk.Configuration(
    host="https://api.emailguard.co",
)
configuration.api_key["Authorization"] = os.environ["EMAILGUARD_API_KEY"]
 
with emailguard_sdk.ApiClient(configuration) as api_client:
    api = emailguard_sdk.TeamsApi(api_client)
    try:
        result = api.api_v1_team_get()
    except ApiException as e:
        raise SystemExit(e)

Responses arrive as generated model objects wrapping HTTP JSON. Your API returns { "code", "data", "message" } — inspect the raw response or deserialize data when code is SUCCESS.

Response envelope

{
  "code": "SUCCESS",
  "data": { "..." : "..." },
  "message": "OK"
}

Check code before using data. On failure, log message and handle HTTP status from ApiException.

API classes

The generator splits 20 operations into resource-specific API classes (for example TeamsApi, MembersApi). Each class method corresponds to one route:

Billing

  • Get billing usage

Channels

  • Create notification channel
  • Delete notification channel
  • List notification channels
  • Test notification channel
  • Update notification channel

email

  • Detect email characteristics

Events

  • List notification events

Invites

  • Cancel a pending invite
  • Invite a team member
  • List pending team invites

Members

  • List team members
  • Remove a team member
  • Update a team member role

Rules

  • Create notification rule
  • Delete notification rule
  • List notification rules
  • Update notification rule

Teams

  • Get team
  • Update team

Open any endpoint in the sidebar and switch to the Python SDK tab for a route-specific sample.

Authentication pattern

import os
import emailguard_sdk
 
configuration = emailguard_sdk.Configuration(host="https://api.emailguard.co")
configuration.api_key["Authorization"] = os.environ["EMAILGUARD_API_KEY"]
configuration.api_key_prefix["Authorization"] = "Bearer"
 
with emailguard_sdk.ApiClient(configuration) as api_client:
    teams = emailguard_sdk.TeamsApi(api_client)
    # teams.api_v1_team_get()

Errors and limits

  • ApiException — carries HTTP status and response body; map 401/403 to credential or scope fixes.
  • 429 — pause and retry using Retry-After; see API rate limiting.

Related

  • SDK clients — overview and credentials
  • TypeScript SDK — same API with envelope unwrapping built in