PHPackages                             sendx/sendx-php-sdk - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. sendx/sendx-php-sdk

ActiveLibrary[API Development](/categories/api)

sendx/sendx-php-sdk
===================

\# SendX REST API Documentation ## 🚀 Introduction The SendX API is organized around REST principles. Our API has predictable resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs. \*\*Key Features:\*\* - 🔒 \*\*Security\*\*: Team-based authentication with optional member-level access - 🎯 \*\*Resource-Oriented\*\*: RESTful design with clear resource boundaries - 📊 \*\*Rich Data Models\*\*: Three-layer model system (Input/Output/Internal) - 🔗 \*\*Relationships\*\*: Automatic prefix handling for resource relationships - 📈 \*\*Scalable\*\*: Built for high-volume email marketing operations ## 🏗️ Architecture Overview SendX uses a three-layer model architecture: 1. \*\*Input Models\*\* (`RestE\*`): For API requests 2. \*\*Output Models\*\* (`RestR\*`): For API responses with prefixed IDs 3. \*\*Internal Models\*\*: Core business logic (not exposed in API) ## 🔐 Security &amp; Authentication SendX uses API key authentication: ### Team API Key ```http X-Team-ApiKey: YOUR\_TEAM\_API\_KEY ``` - \*\*Required for all requests\*\* - Team-level access to resources - Available in SendX Settings → Team API Key ## 🆔 Encrypted ID System SendX uses encrypted IDs for security and better developer experience: - \*\*Internal IDs\*\*: Sequential integers (not exposed) - \*\*Encrypted IDs\*\*: 22-character alphanumeric strings - \*\*Prefixed IDs\*\*: Resource-type prefixes in API responses (`contact\_&lt;22-char-id&gt;`) ### ID Format \*\*All resource IDs follow this pattern:\*\* ``` &lt;resource\_prefix&gt;\_&lt;22\_character\_alphanumeric\_string&gt; ``` \*\*Example:\*\* ```json { "id": "contact\_BnKjkbBBS500CoBCP0oChQ", "lists": \["list\_OcuxJHdiAvujmwQVJfd3ss", "list\_0tOFLp5RgV7s3LNiHrjGYs"\], "tags": \["tag\_UhsDkjL772Qbj5lWtT62VK", "tag\_fL7t9lsnZ9swvx2HrtQ9wM"\] } ``` ## 📚 Resource Prefixes | Resource | Prefix | Example | |----------|--------|---------| | Contact | `contact\_` | `contact\_BnKjkbBBS500CoBCP0oChQ` | | Campaign | `campaign\_` | `campaign\_LUE9BTxmksSmqHWbh96zsn` | | List | `list\_` | `list\_OcuxJHdiAvujmwQVJfd3ss` | | Tag | `tag\_` | `tag\_UhsDkjL772Qbj5lWtT62VK` | | Sender | `sender\_` | `sender\_4vK3WFhMgvOwUNyaL4QxCD` | | Template | `template\_` | `template\_f3lJvTEhSjKGVb5Lwc5SWS` | | Custom Field | `field\_` | `field\_MnuqBAG2NPLm7PZMWbjQxt` | | Webhook | `webhook\_` | `webhook\_9l154iiXlZoPo7vngmamee` | | Post | `post\_` | `post\_XyZ123aBc456DeF789GhI` | | Post Category | `post\_category\_` | `post\_category\_YzS1wOU20yw87UUHKxMzwn` | | Post Tag | `post\_tag\_` | `post\_tag\_123XyZ456AbC` | | Member | `member\_` | `member\_JkL012MnO345PqR678` | ## 🎯 Best Practices ### Error Handling - \*\*Always check status codes\*\*: 2xx = success, 4xx = client error, 5xx = server error - \*\*Read error messages\*\*: Descriptive messages help debug issues - \*\*Handle rate limits\*\*: Respect API rate limits for optimal performance ### Data Validation - \*\*Email format\*\*: Must be valid email addresses - \*\*Required fields\*\*: Check documentation for mandatory fields - \*\*Field lengths\*\*: Respect maximum length constraints ### Performance - \*\*Pagination\*\*: Use offset/limit for large datasets - \*\*Batch operations\*\*: Process multiple items when supported - \*\*Caching\*\*: Cache responses when appropriate ## 🛠️ SDKs &amp; Integration Official SDKs available for: - \[Golang\](https://github.com/sendx/sendx-go-sdk) - \[Python\](https://github.com/sendx/sendx-python-sdk) - \[Ruby\](https://github.com/sendx/sendx-ruby-sdk) - \[Java\](https://github.com/sendx/sendx-java-sdk) - \[PHP\](https://github.com/sendx/sendx-php-sdk) - \[JavaScript\](https://github.com/sendx/sendx-javascript-sdk) ## 📞 Support Need help? Contact us: - 💬 \*\*Website Chat\*\*: Available on sendx.io - 📧 \*\*Email\*\*: hello@sendx.io - 📚 \*\*Documentation\*\*: Full guides at help.sendx.io --- \*\*API Endpoint:\*\* `https://api.sendx.io/api/v1/rest` \[&lt;img src="https://run.pstmn.io/button.svg" alt="Run In Postman" style="width: 128px; height: 32px;"&gt;\](https://god.gw.postman.com/run-collection/33476323-44b198b0-5219-4619-a01f-cfc24d573885?action=collection%2Ffork&amp;source=rip\_markdown&amp;collection-url=entityId%3D33476323-44b198b0-5219-4619-a01f-cfc24d573885%26entityType%3Dcollection%26workspaceId%3D6b1e4f65-96a9-4136-9512-6266c852517e)

010.0k↓35.7%PHPCI passing

Since Sep 8Pushed 8mo ago1 watchersCompare

[ Source](https://github.com/sendx/sendx-php-sdk)[ Packagist](https://packagist.org/packages/sendx/sendx-php-sdk)[ RSS](/packages/sendx-sendx-php-sdk/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)DependenciesVersions (1)Used By (0)

SendX PHP SDK
=============

[](#sendx-php-sdk)

🚀 Introduction
--------------

[](#-introduction)

The SendX API is organized around REST principles. Our API has predictable resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs.

**Key Features:**

- 🔒 **Security**: Team-based authentication with optional member-level access
- 🎯 **Resource-Oriented**: RESTful design with clear resource boundaries
- 📊 **Rich Data Models**: Three-layer model system (Input/Output/Internal)
- 🔗 **Relationships**: Automatic prefix handling for resource relationships
- 📈 **Scalable**: Built for high-volume email marketing operations

🏗️ Architecture Overview
------------------------

[](#️-architecture-overview)

SendX uses a three-layer model architecture:

1. **Input Models** (`RestE*`): For API requests
2. **Output Models** (`RestR*`): For API responses with prefixed IDs
3. **Internal Models**: Core business logic (not exposed in API)

🔐 Security &amp; Authentication
-------------------------------

[](#-security--authentication)

SendX uses API key authentication:

### Team API Key

[](#team-api-key)

```
X-Team-ApiKey: YOUR_TEAM_API_KEY
```

- **Required for all requests**
- Team-level access to resources
- Available in SendX Settings → Team API Key

🆔 Encrypted ID System
---------------------

[](#-encrypted-id-system)

SendX uses encrypted IDs for security and better developer experience:

- **Internal IDs**: Sequential integers (not exposed)
- **Encrypted IDs**: 22-character alphanumeric strings
- **Prefixed IDs**: Resource-type prefixes in API responses (`contact_`)

### ID Format

[](#id-format)

**All resource IDs follow this pattern:**

```
_

```

**Example:**

```
{
  "id": "contact_BnKjkbBBS500CoBCP0oChQ",
  "lists": ["list_OcuxJHdiAvujmwQVJfd3ss", "list_0tOFLp5RgV7s3LNiHrjGYs"],
  "tags": ["tag_UhsDkjL772Qbj5lWtT62VK", "tag_fL7t9lsnZ9swvx2HrtQ9wM"]
}
```

📚 Resource Prefixes
-------------------

[](#-resource-prefixes)

ResourcePrefixExampleContact`contact_``contact_BnKjkbBBS500CoBCP0oChQ`Campaign`campaign_``campaign_LUE9BTxmksSmqHWbh96zsn`List`list_``list_OcuxJHdiAvujmwQVJfd3ss`Tag`tag_``tag_UhsDkjL772Qbj5lWtT62VK`Sender`sender_``sender_4vK3WFhMgvOwUNyaL4QxCD`Template`template_``template_f3lJvTEhSjKGVb5Lwc5SWS`Custom Field`field_``field_MnuqBAG2NPLm7PZMWbjQxt`Webhook`webhook_``webhook_9l154iiXlZoPo7vngmamee`Post`post_``post_XyZ123aBc456DeF789GhI`Post Category`post_category_``post_category_YzS1wOU20yw87UUHKxMzwn`Post Tag`post_tag_``post_tag_123XyZ456AbC`Member`member_``member_JkL012MnO345PqR678`🎯 Best Practices
----------------

[](#-best-practices)

### Error Handling

[](#error-handling)

- **Always check status codes**: 2xx = success, 4xx = client error, 5xx = server error
- **Read error messages**: Descriptive messages help debug issues
- **Handle rate limits**: Respect API rate limits for optimal performance

### Data Validation

[](#data-validation)

- **Email format**: Must be valid email addresses
- **Required fields**: Check documentation for mandatory fields
- **Field lengths**: Respect maximum length constraints

### Performance

[](#performance)

- **Pagination**: Use offset/limit for large datasets
- **Batch operations**: Process multiple items when supported
- **Caching**: Cache responses when appropriate

🛠️ SDKs &amp; Integration
-------------------------

[](#️-sdks--integration)

Official SDKs available for:

- [Golang](https://github.com/sendx/sendx-go-sdk)
- [Python](https://github.com/sendx/sendx-python-sdk)
- [Ruby](https://github.com/sendx/sendx-ruby-sdk)
- [Java](https://github.com/sendx/sendx-java-sdk)
- [PHP](https://github.com/sendx/sendx-php-sdk)
- [JavaScript](https://github.com/sendx/sendx-javascript-sdk)

📞 Support
---------

[](#-support)

Need help? Contact us:

- 💬 **Website Chat**: Available on sendx.io
- 📧 **Email**:
- 📚 **Documentation**: Full guides at help.sendx.io

---

**API Endpoint:** `https://api.sendx.io/api/v1/rest`

For more information, please visit .

Installation &amp; Usage
------------------------

[](#installation--usage)

### Requirements

[](#requirements)

PHP 8.1 and later.

### Composer

[](#composer)

To install the bindings via Composer, use the following command on the command line:

```
 composer require sendx/sendx-php-sdk

```

Or, add the following to `composer.json`:

```
{
  "require": {
    "sendx/sendx-php-sdk": "^2.0.0"
  }
}
```

### Manual Installation

[](#manual-installation)

Download the files and include `autoload.php`:

```
