Skip to content

Remove customers from a Segment

Delete
bash
https://api.bunce.so/v1/segments/{segment_id}/customers

Removes customers from a segment.

Request

Body Parameters required

customers array requiredAn array containing the customer_ids or emails of customers to be removed from the segment

Example:

json
{
  "customers": [
    "979832rh2",
    "9y39h39bf"
  ]
}
bash
curl --request DELETE \
  --url https://api.bunce.so/v1/segments/{segment_id}/customers \
  --header 'Content-Type: application/json' \
  --header 'X-Authorization: sk_live_************************' \
  --data '{
  "customers": [
    "979832rh2",
    "9y39h39bf"
  ]
}'
go
import (
	"fmt"
	"strings"
	"net/http"
	"io/ioutil"
)

url := "https://api.bunce.so/v1/segments/{segment_id}/customers"

payload := strings.NewReader("{\n  \"customers\": [\n    \"979832rh2\",\n    \"9y39h39bf\"\n  ]\n}")

req, _ := http.NewRequest("DELETE", url, payload)

req.Header.Add("X-Authorization", "sk_live_************************")
req.Header.Add("Content-Type", "application/json")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)

fmt.Println(res)
fmt.Println(string(body))
js
import  from 'node-fetch'

let  = 'https://api.bunce.so/v1/segments/{segment_id}/customers'

let  = {
  : 'DELETE',
  : {
    'X-Authorization': 'sk_live_************************',
    'Content-Type': 'application/json',
  },
  : '{ "customers": ["979832rh2","9y39h39bf"]}',
}

(, )
  .then(() => .json())
  .then(() => .())
  .catch(() => .('error:' + ))
php
<?php

$client = new http\Client;
$request = new http\Client\Request;

$body = new http\Message\Body;
$body->append('{
    "customers": [
        "979832rh2",
        "9y39h39bf"
    ]
}');

$request->setRequestUrl('https://api.bunce.so/v1/segments/{segment_id}/customers');
$request->setRequestMethod('POST');
$request->setBody($body);

$request->setHeaders([
  'X-Authorization' => 'sk_live_************************',
  'Content-Type' => 'application/json'
]);

$client->enqueue($request)->send();
$response = $client->getResponse();

echo $response->getBody();
java
HttpRequest request = HttpRequest.newBuilder()
    .uri(URI.create("https://api.bunce.so/v1/segment/{segment_id}/customers"))
    .header("X-Authorization", "sk_live_************************")
    .header("Content-Type", "application/json")
    .method("DELETE", HttpRequest.BodyPublishers.ofString("{\n  \"customers\": [\n    \"979832rh2\",\n    \"9y39h39bf\"\n  ]\n}"))
    .build();


HttpResponse<String> response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());

System.out.println(response.body());

Response

json
{
    "success": true,
    "data": null,
    "message": "Customers removed from segment successfully"
}