Creating Subaccounts

Subaccount Overview

Subaccounts are how you provision, manage, and report on senders separately. Subaccounts are useful for any type of complex sender, whether you send on behalf of others or want to otherwise separate various mail streams. 

Endpoint

https://api.socketlabs.com/v2/subaccount

Attributes

One of the attributes below must be set to create a subaccount. If neither are set or both attributes are set, the API call will fail.

 

Property Name Data Type Details

name

string Subaccount display name
ipPoolID number Unique ID of each IP address to assign
useRuleEngine boolean IP Pool display name

Example Request with ‘useRuleEngine’ set

 

var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, “https: //api.socketlabs.com/v2/subaccount”);
    request.Headers.Add(“Authorization”, “Bearer < token > ”);
    var content = new StringContent(@” {
      ‘
      name’: ‘Test Name’,
      ‘useRuleEngine’: true
    }”, null, “application / json”); request.Content = content;
    var response = await client.SendAsync(request); response.EnsureSuccessStatusCode(); Console.WriteLine(await response.Content.ReadAsStringAsync());

Example Response with ‘useRuleEngine’ set

{
    "data": {
        "subaccountId": 12345,
        "accountId": 98765,
        "name": "My Subaccount",
        "status": "Active",
        "createdOn": "2022-01-01T07:00:00-05:00",
        "streamScore": 0,
        "avgDailyVolume": 0,
        "useRuleEngine": true
    }
}

Example Request with ‘ipPoolId’ set

var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, “https: //api.socketlabs.com/v2/subaccount”);
    request.Headers.Add(“Authorization”, “Bearer < token > ”);
    var content = new StringContent(@” {
      ‘
      name’: ‘Test Name’,
    "ipPoolId": 12345
    }”, null, “application / json”); request.Content = content;
    var response = await client.SendAsync(request); response.EnsureSuccessStatusCode(); Console.WriteLine(await response.Content.ReadAsStringAsync());

Example Response with ‘ipPoolId’ set

{
    "data": {
        "subaccountId": 12345,
        "accountId": 98765,
        "name": "My Subaccount",
        "status": "Active",
        "createdOn": "2022-01-01T12:00:00+00:00",
        "streamScore": 85,
        "avgDailyVolume": 123456,
        "assignedIPPool": {
            "ipPoolId": 12345,
            "accountId": 98765,
            "name": "My IP Pool",
            "status": "Active",
            "createdOn": "2022-01-01T12:00:00+00:00",
            "isDefault": true,
            "streamScore": 85,
            "avgDailyVolume": 123456,
            "bounceRate": 0,
            "subaccountCount": 0
        },
        "useRuleEngine": false
    }
}

After creating subaccounts, you’ll want security. First, we’ll start with custom bounce domain setup to enable SPF.

Other Resources