Learn how to use Subaccount APIs V6.
Overview
The Subaccounts API enables management of subaccounts under a master account. This includes creating, updating (enable/disable), deleting, and listing subaccounts. It is essential for teams managing multiple clients or business units under a single account.
Important Points to Remember
- All endpoints require authentication via the
Authorization: Bearer <your_api_key>
header.- Subaccount usernames must be unique.
- Supports unlimited and one_time_credit allocation types.
- Deleting a subaccount transfers any remaining credits to the master account.
- Disabled subaccounts retain credits but cannot send emails.
Available Endpoints
Endpoint Name | Method | Endpoint | Description |
---|---|---|---|
Create Subaccount | POST | /v6/subaccounts | Creates a new subaccount under the master account. |
Update Subaccount | PATCH | /v6/subaccounts/{username} | Enables or disables a subaccount. |
Delete Subaccount | DELETE | /v6/subaccounts/{username} | Permanently deletes a subaccount. |
List Subaccounts | GET | /v6/subaccounts | Retrieves subaccounts with optional filters and pagination. |
Authentication
All requests must include a valid API key:
Authorization: Bearer <your_api_key>
Credit Types
Type | Description |
---|---|
unlimited | Subaccount with unlimited credits |
one_time_credit | Subaccount with fixed, one-time credit allocation |
Common Error Codes
Status Code | Description | Example Response |
---|---|---|
400 | Bad Request | { "error": "Invalid Parameters" } |
403 | Forbidden | { "error": "You cannot use this feature" } |
404 | Not Found | { "error": "Subaccount does not exists" } |
500 | Internal Server Error | { "error": "Server error" } |
Example Usage
Create a New Subaccount
curl -X POST https://api.pepipost.com/v6/subaccounts \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"username": "subaccount1",
"email": "[email protected]",
"password": "securepassword123",
"credit_type": "one_time_credit"
}'
Update Subaccount Status
curl -X PATCH https://api.pepipost.com/v6/subaccounts/subaccount1 \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"disabled": true
}'
List Subaccounts with Pagination
curl -X GET "https://api.pepipost.com/v6/subaccounts?limit=10&offset=1" \
-H "Authorization: Bearer YOUR_API_KEY"
Delete a Subaccount
curl -X DELETE https://api.pepipost.com/v6/subaccounts/subaccount1 \
-H "Authorization: Bearer YOUR_API_KEY"
Notes
- The master account must be active to manage subaccounts.
- Subaccount usernames must be unique.
- Passwords must meet minimum security policies.
- Deleted subaccounts cannot be recovered.
- Credits from deleted subaccounts are returned to the master account.
- Rate limiting applies as per your account configuration.