List all segments
Returns a list of all segments in your account.
Endpoint
Section titled “Endpoint”HTTP method: GET
https://api.sender.net/v2/segments/
Request Examples
Section titled “Request Examples”const url = new URL("https://api.sender.net/v2/segments/");
let headers = { "Authorization": "Bearer [your-token]", "Content-Type": "application/json", "Accept": "application/json",};
fetch(url, { method: "GET", headers,}).then(response => response.json()).then(data => console.log(data)).catch(error => console.error('Error:', error));$client = new \GuzzleHttp\Client();$response = $client->get( 'https://api.sender.net/v2/segments/', [ 'headers' => [ 'Authorization' => 'Bearer [your-token]', 'Content-Type' => 'application/json', 'Accept' => 'application/json', ], ]);
$body = $response->getBody()->getContents();$data = json_decode($body, true);print_r($data);import requestsimport json
url = "https://api.sender.net/v2/segments/"
headers = { "Authorization": "Bearer [your-token]", "Content-Type": "application/json", "Accept": "application/json",}
response = requests.request('GET', url, headers=headers)
print(response.json())curl -X GET \-G "https://api.sender.net/v2/segments/" \-H "Authorization: Bearer [your-token]" \-H "Content-Type: application/json" \-H "Accept: application/json"Response
Section titled “Response”{ "data": [ { "id": "elY9Ma", "account_id": "eEqqve", "name": "First segment", "conditions": [ { "type": "tag", "operator": "have", "operand": [ { "id": "eZVD4w", "title": "Test group", "recipient_count": 2, "active_subscribers": 2, "opens_rate": 0, "click_rate": 0, "unsubscribed_count": 0, "bounced_count": 0, "account_id": "eEqqve", "user_id": "egp79a", "created": "2021-05-11 15:37:45", "modified": null } ], "operators": [ { "id": "have", "operand-view": "tag-select", "title": "Belongs to" }, { "id": "not-have", "operand-view": "tag-select", "title": "Does not belong to" } ], "group": "5ae78738-9412-44db-9026-aee1b92fc92a", "outside_concat": "and", "inside_concat": "and" } ], "created": "2021-04-30 07:04:51", "modified": "2021-05-12 05:24:39", "subscribers": 1, "phone_count": 1, "active_subscribers": 0, "active_phone_count": 0 } ], "links": { "first": "https://api.sender.net/v2/segments?page=1", "last": "https://api.sender.net/v2/segments?page=1", "prev": null, "next": null }, "meta": { "current_page": 1, "from": 1, "last_page": 1, "links": [ { "url": null, "label": "pagination.previous", "active": false }, { "url": "https://api.sender.net/v2/segments?page=1", "label": 1, "active": true }, { "url": null, "label": "pagination.next", "active": false } ], "path": "https://api.sender.net/v2/segments", "per_page": 10, "to": 1, "total": 1 }}