EmailGuard
  • Pricing
Log inRegister
DocumentationAPI ReferenceKnowledge Base

API reference

Download spec

API reference

Guides and endpoint docs

Guides
  • SDK clients
  • TypeScript SDK
  • Go SDK
  • Python SDK
  • PHP SDK
  • Ruby SDK
  • MCP client
Account
  • getGet team
  • patchUpdate team
Team
Members
  • getList team members
  • deleteRemove a team member
  • patchUpdate a team member role
Invites
  • deleteCancel a pending invite
  • postInvite a team member
  • getList pending team invites
Billing
  • getGet billing usage
Notifications
Channels
  • postCreate notification channel
  • deleteDelete notification channel
  • getList notification channels
  • postTest notification channel
  • putUpdate notification channel
Events
  • getList notification events
Rules
  • postCreate notification rule
  • deleteDelete notification rule
  • getList notification rules
  • putUpdate notification rule
email
  • getDetect email characteristics

PHP SDK

Composer package generated from the public OpenAPI spec.

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.2.0). Use it in Laravel, Symfony, or plain PHP apps.

Install

composer require emailguard/emailguard-sdk:1.2.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->getTeam();
} 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.

On timeout, connection errors, 429, or 5xx, fail open for ordinary signup. A 2xx body with disposable true is a verdict. Give Guzzle at least a 2 second timeout on detect.

Signup policy: Confidence, evidence, and fail-open.

Related

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