Subaccount APIs

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 NameMethodEndpointDescription
Create SubaccountPOST/v6/subaccountsCreates a new subaccount under the master account.
Update SubaccountPATCH/v6/subaccounts/{username}Enables or disables a subaccount.
Delete SubaccountDELETE/v6/subaccounts/{username}Permanently deletes a subaccount.
List SubaccountsGET/v6/subaccountsRetrieves subaccounts with optional filters and pagination.

Authentication

All requests must include a valid API key:

Authorization: Bearer <your_api_key>

Credit Types

TypeDescription
unlimitedSubaccount with unlimited credits
one_time_creditSubaccount with fixed, one-time credit allocation

Common Error Codes

Status CodeDescriptionExample Response
400Bad Request{ "error": "Invalid Parameters" }
403Forbidden{ "error": "You cannot use this feature" }
404Not Found{ "error": "Subaccount does not exists" }
500Internal 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.