Customers
Bulk Customers
Applies one action to up to 500 customers at once. Returns how many customers were changed.
POST
/
api
/
v1
/
contacts
/
bulk
Bulk Customers
curl --request POST \
--url https://app.chatflows.io/api/v1/contacts/bulk \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"ids": [
1,
2,
3
],
"action": "change_status",
"contact_status_id": 2
}
'import requests
url = "https://app.chatflows.io/api/v1/contacts/bulk"
payload = {
"ids": [1, 2, 3],
"action": "change_status",
"contact_status_id": 2
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({ids: [1, 2, 3], action: 'change_status', contact_status_id: 2})
};
fetch('https://app.chatflows.io/api/v1/contacts/bulk', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://app.chatflows.io/api/v1/contacts/bulk",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'ids' => [
1,
2,
3
],
'action' => 'change_status',
'contact_status_id' => 2
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://app.chatflows.io/api/v1/contacts/bulk"
payload := strings.NewReader("{\n \"ids\": [\n 1,\n 2,\n 3\n ],\n \"action\": \"change_status\",\n \"contact_status_id\": 2\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://app.chatflows.io/api/v1/contacts/bulk")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"ids\": [\n 1,\n 2,\n 3\n ],\n \"action\": \"change_status\",\n \"contact_status_id\": 2\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.chatflows.io/api/v1/contacts/bulk")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"ids\": [\n 1,\n 2,\n 3\n ],\n \"action\": \"change_status\",\n \"contact_status_id\": 2\n}"
response = http.request(request)
puts response.read_body{
"data": {
"action": "change_status",
"affected": 3
}
}{
"message": "Missing API token.",
"error_code": "unauthenticated",
"status": 401
}{
"message": "Subscription required or expired.",
"error_code": "subscription_required",
"status": 402
}{
"message": "This token is missing the required scope: contacts:write.",
"error_code": "insufficient_scope",
"status": 403
}{
"message": "The given data was invalid.",
"error_code": "validation_failed",
"errors": {
"action": [
"The selected action is invalid."
]
},
"status": 422
}{
"message": "API request quota exhausted for this billing period.",
"error_code": "quota_exhausted",
"status": 429
}action | What it does |
|---|---|
delete | Deletes the customers. |
change_status | Sets a new customer status. Also send contact_status_id. |
change_type | Sets a new type. Also send type. |
activate | Marks the customers active. |
deactivate | Marks the customers inactive. |
Authorizations
Body
application/json
⌘I
Bulk Customers
curl --request POST \
--url https://app.chatflows.io/api/v1/contacts/bulk \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"ids": [
1,
2,
3
],
"action": "change_status",
"contact_status_id": 2
}
'import requests
url = "https://app.chatflows.io/api/v1/contacts/bulk"
payload = {
"ids": [1, 2, 3],
"action": "change_status",
"contact_status_id": 2
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({ids: [1, 2, 3], action: 'change_status', contact_status_id: 2})
};
fetch('https://app.chatflows.io/api/v1/contacts/bulk', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://app.chatflows.io/api/v1/contacts/bulk",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'ids' => [
1,
2,
3
],
'action' => 'change_status',
'contact_status_id' => 2
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://app.chatflows.io/api/v1/contacts/bulk"
payload := strings.NewReader("{\n \"ids\": [\n 1,\n 2,\n 3\n ],\n \"action\": \"change_status\",\n \"contact_status_id\": 2\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://app.chatflows.io/api/v1/contacts/bulk")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"ids\": [\n 1,\n 2,\n 3\n ],\n \"action\": \"change_status\",\n \"contact_status_id\": 2\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.chatflows.io/api/v1/contacts/bulk")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"ids\": [\n 1,\n 2,\n 3\n ],\n \"action\": \"change_status\",\n \"contact_status_id\": 2\n}"
response = http.request(request)
puts response.read_body{
"data": {
"action": "change_status",
"affected": 3
}
}{
"message": "Missing API token.",
"error_code": "unauthenticated",
"status": 401
}{
"message": "Subscription required or expired.",
"error_code": "subscription_required",
"status": 402
}{
"message": "This token is missing the required scope: contacts:write.",
"error_code": "insufficient_scope",
"status": 403
}{
"message": "The given data was invalid.",
"error_code": "validation_failed",
"errors": {
"action": [
"The selected action is invalid."
]
},
"status": 422
}{
"message": "API request quota exhausted for this billing period.",
"error_code": "quota_exhausted",
"status": 429
}
