Subaccount API

Learn how to use Subaccount API (V6).

Overview

The Subaccounts API enables the management of subaccounts under your master account. You can create, update, delete, and list subaccounts. This API is essential for organizations that need to manage multiple sub-accounts under one master account.

📘

Notes

  • Subaccount usernames must be unique under the master account.
  • You can manage credit allocation by setting credit_type to unlimited or one_time_credit.
  • Template operations such as updating and deleting subaccounts are permanent and cannot be undone.
  • All timestamps are in ISO 8601 format.

Available Endpoints

Endpoint NameMethodEndpointDescription
Create SubaccountPOST/v6/subaccountsCreates a new subaccount under your master account.
Update SubaccountPATCH/v6/subaccounts/{username}Updates the status of a subaccount, such as enabling or disabling it.
Delete SubaccountDELETE/v6/subaccounts/{username}Permanently deletes an existing subaccount.
List SubaccountsGET/v6/subaccountsRetrieves a list of all subaccounts with optional filters and pagination.

Common Error Codes

Status CodeDescription
400Bad Request – Invalid parameters or missing data
403Forbidden – API key not authorized for this action
404Not Found – Subaccount or master account not found
500Internal Server Error

Example Usage

Creating 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"
  }'

Updating 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
  }'

Listing Subaccounts with Pagination

curl -X GET "https://api.pepipost.com/v6/subaccounts?limit=10&offset=1" \
  -H "Authorization: Bearer YOUR_API_KEY"

Deleting a Subaccount

curl -X DELETE https://api.pepipost.com/v6/subaccounts/subaccount1 \
  -H "Authorization: Bearer YOUR_API_KEY"