Accounts and sub-accounts
These methods return your account details and let a main account (reseller, white label) manage its sub-accounts.
They are all called with POST, with a JSON body that contains your api_key. Parameter tables do not repeat it. See the common rules.
Account details
Access point: https://www.mdworks.fr/api_http/account_info
This method returns the details of the account the key belongs to. It is the right first call to check an access: it also returns the caller’s IP as the server sees it, which helps diagnose an Error auth ip error.
Parameters: none apart from api_key.
Example of posted data:
{"api_key": "YOUR_API_KEY"}Response:
{
"user_id": 1234,
"login": "myaccount",
"name": "Example Company",
"email": "contact@example.com",
"credits": 25000,
"ip": "54.75.157.176"
}| Field | Description |
|---|---|
user_id | account number |
login | login name |
name, email | the account’s default sender, as defined in the platform settings. Can be empty |
credits | available email sending credits. For a subscription, this is the remaining monthly quota plus the credit, capped at the daily quota: the same figure as in the interface |
ip | the caller’s IP, as the server sees it |
List sub-accounts
Access point: https://www.mdworks.fr/api_http/user_list
This method returns the list of sub-accounts under your main account.
Parameters: none apart from api_key.
Example of posted data:
{"api_key": "YOUR_API_KEY"}Response: an array of objects.
| Field | Description |
|---|---|
id | unique ID of the sub-account |
log | unique login of the sub-account |
pass | password of the sub-account |
nom | name of the sub-account (optional, used for display) |
email | email of the sub-account’s technical contact (used to send complaint reports and delisting reports) |
quota | sending quota assigned to the sub-account |
classe_domaines | ID of the IP pool assigned to the sub-account (see pools_list) |
[
{
"id": "2123",
"log": "user1",
"pass": "password",
"nom": "Name 1",
"email": "tes@test.com",
"quota": "250000",
"classe_domaines": "7"
},
{
"id": "2124",
"log": "user2",
"pass": "password",
"nom": "Name 2",
"email": "tes@test.com",
"quota": "12354",
"classe_domaines": "8"
}
]Retrieve a sub-account’s API key
Access point: https://www.mdworks.fr/api_http/get_sub_account_api_key
This method returns the API key of a sub-account under your main account. If the sub-account has no key yet, one is created.
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
user_id | integer | yes | ID of the sub-account (see user_list) |
Example of posted data:
{"api_key": "YOUR_API_KEY", "user_id": 33}Response:
| Field | Description |
|---|---|
user_id | unique ID of the sub-account |
api_key | its API key |
{
"user_id": 33,
"api_key": "SUB_ACCOUNT_API_KEY"
}Errors:
| Message | Cause |
|---|---|
Error one argument is missing | user_id is missing |
User_id should be numeric | |
User_id does not exists | the sub-account does not exist or does not belong to your account |
List available IP pools
Access point: https://www.mdworks.fr/api_http/pools_list
This method returns the IP pools assigned to your main account. If you have several IP pools, you can choose which pool to assign to each of your sub-accounts.
Parameters: none apart from api_key.
Example of posted data:
{"api_key": "YOUR_API_KEY"}Response: an array of objects.
| Field | Description |
|---|---|
id | unique ID of the IP pool |
nom | name of the IP pool |
domaine_expediteur | default sender domain name |
domaine_tracking | domain name used for link tracking |
ip_range | range where the IPs are located (for your SPF records) |
nb_ip | number of available IPs |
tracking_ssl | 1 if the SSL certificate is installed on the tracking domain, 0 otherwise |
[
{
"id": "527",
"nom": "Classe 527 - Client XYZ - Premium MTA 101",
"domaine_expediteur": "domaine1.com",
"domaine_tracking": "domaine1.com",
"ip_range": "91.209.225.64/25",
"nb_ip": "2",
"tracking_ssl": "1"
},
{
"id": "545",
"nom": "Classe 545 - Client XYZ - Premium MTA 101",
"domaine_expediteur": "domaine3.com",
"domaine_tracking": "domaine3.com",
"ip_range": "91.209.225.64/25",
"nb_ip": "2",
"tracking_ssl": "1"
}
]Create a sub-account
Access point: https://www.mdworks.fr/api_http/user_create
This method creates a sub-account. The sub-account’s login must be unique in the database.
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
log | text | yes | login of the sub-account, at least 6 characters long and as specific as possible, since it must be unique in the database. No special characters or accents |
pass | text | yes | password, at least 8 characters long |
quota | integer | yes | maximum sending quota, which cannot exceed the main account’s quota |
nom | text | no | default sender name, can be empty |
email | text | no | default sender email, can be empty |
pool_ip | integer | no | ID of the IP pool to assign to the sub-account (see pools_list). If missing, the main account’s IP pool is used |
Example of posted data:
{
"api_key": "YOUR_API_KEY",
"log": "user_test_new",
"pass": "N5tkgGR8gCnsv3Dl7",
"quota": "50"
}Response: the ID of the new sub-account.
{"user_id": "8458"}Errors:
| Message | Cause |
|---|---|
Error one argument is missing | log, pass or quota is missing |
Login should be at least 6 characters long | login too short (the message has two spaces before the 6) |
Login should be at least 8 characters long | password too short (the message mentions the login) |
Error login exists | login already in use |
Quota should be numeric | |
Quota should be less than N | quota higher than the main account’s |
Pool Ip should be numeric | |
Pool Ip is not associated to this account | IP pool that does not belong to your account |
Edit a sub-account
Access point: https://www.mdworks.fr/api_http/user_update
Only the parameters you send are changed, the others stay as they are.
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
user_id | integer | yes | ID of the sub-account to edit |
pass | text | no | password, at least 8 characters long |
quota | integer | no | maximum sending quota, which cannot exceed the main account’s quota |
nom | text | no | name of the sub-account (display only) |
email | text | no | email of the sub-account’s technical contact, who receives complaint and delisting reports |
pool_ip | integer | no | ID of the IP pool to assign to the sub-account (see pools_list) |
email, so that the end customer does not receive messages from Ediware.Example of posted data:
{
"api_key": "YOUR_API_KEY",
"user_id": "335",
"quota": "45"
}Response:
{"result": "ok"}Errors:
| Message | Cause |
|---|---|
Error user_id is missing | |
problem with this user | the sub-account does not exist or does not belong to your account |
Pass should be 8 character long | password too short |
Quota should be numeric | |
Quota should be less than N | quota higher than the main account’s |
Pool Ip should be numeric | |
Pool Ip is not associated to this account | IP pool that does not belong to your account |
Delete a sub-account
Access point: https://www.mdworks.fr/api_http/user_delete
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
user_id | integer | yes | ID of the sub-account to delete (see user_list) |
Example of posted data:
{
"api_key": "YOUR_API_KEY",
"user_id": "4781"
}Response:
{"result": "ok"}Errors:
| Message | Cause |
|---|---|
UID missing | user_id is missing |
problem with this user | the sub-account does not exist or does not belong to your account |
Change an account’s interface language
Access point: https://www.mdworks.fr/api_http/user_lang
This method changes the default language of the platform interface, for your account or for one of your sub-accounts.
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
user_id | integer | no | ID of the account to edit (see user_list). If missing, your main account’s language is changed |
lang | code | yes | fr, en, it, es or de |
language parameter of campaign_create. user_lang sets the language of the account’s interface, with 5 lowercase codes. language sets the language of the email footer of a campaign (unsubscribe link), with 11 two-letter codes, and English is written UK there. The two settings are independent and do not share their codes.Example of posted data:
{
"api_key": "YOUR_API_KEY",
"user_id": "4781",
"lang": "en"
}Response:
{"result": "ok"}Errors:
| Message | Cause |
|---|---|
Problem with this user | the sub-account does not exist or does not belong to your account |
Correct values for lang are fr, en, it, es, de | unknown language code |