Create Sub-account
This request is used to create a sub-account.
URL
POST https://api.smspartner.fr/v1/subaccount/create
Required Parameters
apiKey
type
Type of sub-account: this choice is final and cannot be modified later.
simple: – The sub-account will not receive any emails or SMS. – No phone number is required. – Purchases are not allowed.advanced: – A valid email is required. – Registration process is the same as a standard account. – A mobile phone number will be required at signup.
parameters
See below, depending on the sub-account type:
Simple sub-account parameters:
email(optional): If left empty, an email will be generated automatically (e.g., [email protected])creditToAttribute(optional): Credits in euros added to the sub-account upon creation. These credits will be deducted from your master account.title,firstname,lastname(optional): Sub-account’s title and owner’s names.
Advanced sub-account parameters:
email: Valid email address of the sub-account ownerisBuyer:1or0— if1, the sub-account can buy SMS on its own.Same optional fields as above (
creditToAttribute,title,firstname,lastname)
Requests
<?php
// Prepare data for POST request
$fields = array(
'apiKey'=> 'YOUR API KEY',
'type'=> 'advanced',
'parameters'=>array(
'email':'[email protected]',
'creditToAttribute':10,
'isBuyer':0,
'firstname':'prenom',
'lastname':'nom'
));
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL,'https://api.smspartner.fr/v1/subaccount/create');
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_TIMEOUT, 10);
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS,json_encode($fields));
$result = curl_exec($curl);
curl_close($curl);
// Process your response here
echo $result;
?>Response
Errors
Error Codes
1
API key is required
2
Phone number is required
3
isBuyer is required
4
type is required (simple or advanced)
5
Sub-account type does not exist (must be simple or advanced)
6
Email is required
7
An account with this email already exists
8
creditToAttribute must be greater than 0
9
Master account balance must be greater than 0
200
All good!
Last updated