agentisend / agentisend-php
AgentiSend is a transactional email API for AI agents. PHP client with budgets, a free preflight and refusals that name the fix.
Requires
- php: >=8.0
- ext-curl: *
- ext-json: *
Requires (Dev)
None
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
agentisend-php
Generated from openapi.json. Do not edit src/Client.php — run pnpm sdk:generate.
$client = new AgentiSend\Client(); // reads AGENTISEND_API_KEY $sent = $client->postEmails([ 'from' => 'Acme <hello@acme.com>', 'to' => ['you@example.com'], 'subject' => 'Hi', 'text' => 'Hello', ]);
Install with Composer:
composer require agentisend/agentisend-php
No dependencies beyond curl and json, which every PHP install has. Laravel users can wrap it; nothing here assumes a framework.
Refusals throw AgentiSend\ApiError with code, fix, docsUrl, requestId
and retryAfterSeconds. retryable() returns the API's own retryable field,
so a refusal the API marks as not worth retrying reads false; when the body has
none, it is true for 429 and 5xx.
Idempotency-Key
Every mutating operation takes an optional trailing $idempotencyKey. Pass
one on a call you might retry — a timed-out send, a queue worker that redelivers —
so a repeat with the same key is applied once, not twice:
$key = bin2hex(random_bytes(16)); $sent = $client->postEmails([ 'from' => 'Acme <hello@acme.com>', 'to' => ['you@example.com'], 'subject' => 'Hi', 'text' => 'Hello', ], $key);