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

PHP SDK

Composer 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
Python SDKRuby SDK

The PHP SDK (emailguard/emailguard-sdk) wraps /api/v1 with Guzzle-backed API classes generated from OpenAPI (version 1.0.0). Use it in Laravel, Symfony, or plain PHP apps.

Install

composer require emailguard/emailguard-sdk:1.0.0

Require the package in composer.json and run composer update in CI for locked builds.

Configure

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

API_KEY is accepted as an alias in most clients.

Point the client at your API origin when it differs from the default (https://api.emailguard.co):

Configuration::getDefaultConfiguration()->setHost('https://api.emailguard.co');

Quickstart

<?php
 
use emailguardSdk\Api\TeamsApi;
use emailguardSdk\ApiException;
use emailguardSdk\Configuration;
 
require __DIR__ . '/vendor/autoload.php';
 
Configuration::getDefaultConfiguration()
    ->setHost('https://api.emailguard.co')
    ->setApiKey('Authorization', getenv('EMAILGUARD_API_KEY'))
    ->setApiKeyPrefix('Authorization', 'Bearer');
 
$api = new TeamsApi();
 
try {
    $result = $api->apiV1TeamGet();
} catch (ApiException $e) {
    throw new RuntimeException($e->getResponseBody() ?: $e->getMessage(), $e->getCode(), $e);
}

Generated methods return model objects from the HTTP response. Unwrap data from the envelope when code is SUCCESS.

Response envelope

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

Decode the response array or model and read data when code === 'SUCCESS'.

API classes

20 operations are grouped into \emailguardSdk\Api\* classes:

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

Use the PHP SDK tab on any endpoint page for a complete snippet including namespaces and method names.

Authentication pattern

use emailguardSdk\Api\TeamsApi;
use emailguardSdk\Configuration;
 
Configuration::getDefaultConfiguration()
    ->setApiKey('Authorization', getenv('EMAILGUARD_API_KEY'))
    ->setApiKeyPrefix('Authorization', 'Bearer');
 
$api = new TeamsApi();
$team = $api->apiV1TeamGet();

Errors and limits

The SDK throws ApiException on HTTP errors; connection failures surface as Guzzle exceptions. Handle HTTP 401, 403, and 429 explicitly — see API rate limiting.

Related

  • SDK clients — overview and credentials
  • Ruby SDK — same OpenAPI generator family