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 Name | Method | Endpoint | Description |
---|---|---|---|
Create Subaccount | POST | /v6/subaccounts | Creates a new subaccount under your master account. |
Update Subaccount | PATCH | /v6/subaccounts/{username} | Updates the status of a subaccount, such as enabling or disabling it. |
Delete Subaccount | DELETE | /v6/subaccounts/{username} | Permanently deletes an existing subaccount. |
List Subaccounts | GET | /v6/subaccounts | Retrieves a list of all subaccounts with optional filters and pagination. |
Common Error Codes
Status Code | Description |
---|---|
400 | Bad Request – Invalid parameters or missing data |
403 | Forbidden – API key not authorized for this action |
404 | Not Found – Subaccount or master account not found |
500 | Internal 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"