Skip to main content

We use cookies to improve Engium and measure marketing. Choose what you're comfortable with.

Manage preferences

We use cookies to improve Engium and measure marketing. Choose what you're comfortable with.

Manage preferences
EngiumEngium Docs
GuidesAPI ReferenceChangelogSupport
person
rocket_launch

Engium Docs

v3.0.0-stable

Core Concepts

rocket_launchGetting Started
lockAuthentication

Messaging API

apiEndpoints
terminalLanguage Guides
webhookWebhooks
analyticsSystem StatushelpDocumentation Help
Guideschevron_rightLanguage Guideschevron_rightPHP

PHP Quickstart

Call the Engium REST API from PHP using cURL or the Guzzle HTTP client — works with Laravel, Symfony, and plain PHP 8+.

info

Prerequisites

  • •PHP 8.0+
  • •cURL extension enabled (default on most hosts)
  • •API key and Tenant ID from Settings → Developer
info

Laravel tip

In Laravel, store ENGIUM_API_KEY and ENGIUM_TENANT_ID in .env and access via env(). Use Http::withHeaders([...]) from the Laravel HTTP facade for a fluent interface.

Implementation

engium.php
<?php

$API_KEY = getenv('ENGIUM_API_KEY');
$TENANT  = getenv('ENGIUM_TENANT_ID');
$BASE    = 'https://api.engium.app/api/v1';

function engium_post(string $path, array $body, string $apiKey, string $tenant): array {
    $ch = curl_init("$BASE/$path");
    curl_setopt_array($ch, [
        CURLOPT_RETURNTRANSFER => true,
        CURLOPT_POST           => true,
        CURLOPT_POSTFIELDS     => json_encode($body),
        CURLOPT_HTTPHEADER     => [
            "Authorization: Bearer $apiKey",
            "X-Tenant-ID: $tenant",
            'Content-Type: application/json',
        ],
        CURLOPT_TIMEOUT        => 30,
    ]);
    $resp = curl_exec($ch);
    $code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
    curl_close($ch);

    if ($code >= 400) throw new RuntimeException("Engium error: HTTP $code");
    return json_decode($resp, true);
}

$session = engium_post('conversations/send', [
    'recipient' => '+15550102999',
    'channel'   => 'whatsapp',
    'message'   => ['text' => 'Hello from PHP! 🐘'],
], $API_KEY, $TENANT);

echo "Session ID: {$session['id']}\n";
echo "Status    : {$session['status']}\n";

Request Parameters

ParameterTypeRequirementDescription
AuthorizationHeader · stringRequiredBearer {api_key}. Generate from Settings → Developer → API Keys.
X-Tenant-IDHeader · UUIDRequiredYour Tenant UUID. All API data is scoped to this tenant.
AuthorizationRequired

Bearer {api_key}. Generate from Settings → Developer → API Keys.

Type:Header · string
X-Tenant-IDRequired

Your Tenant UUID. All API data is scoped to this tenant.

Type:Header · UUID

Was this helpful?

Previousarrow_backTypeScriptNextGoarrow_forward
expand_more

On this page

editEdit on GitHubreportReport Issue
auto_awesomeAI Insight

Consider using Template IDs for better deliverability and localised content management across your 9 supported languages.

© 2026 Engium AI. All systems operational.

Privacy PolicyTerms of ServiceSecurityStatus