Skip to main content
POST
/
api
/
admin
/
users
/
cURL
curl --request POST \
  --url http://localhost:3001/api/admin/users/ \
  --header 'Authorization: <api-key>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "workspaceId": "<string>",
  "cursor": "<string>",
  "segmentFilter": [
    "<string>"
  ],
  "limit": 123,
  "direction": "after",
  "userIds": [
    "1043"
  ],
  "subscriptionGroupFilter": [
    "<string>"
  ],
  "userPropertyFilter": [
    {
      "id": "<string>",
      "values": [
        "<string>"
      ]
    }
  ],
  "includeSubscriptions": true,
  "sortBy": "<string>",
  "sortOrder": "asc",
  "exclusiveCursor": true
}
'
import requests

url = "http://localhost:3001/api/admin/users/"

payload = {
"workspaceId": "<string>",
"cursor": "<string>",
"segmentFilter": ["<string>"],
"limit": 123,
"direction": "after",
"userIds": ["1043"],
"subscriptionGroupFilter": ["<string>"],
"userPropertyFilter": [
{
"id": "<string>",
"values": ["<string>"]
}
],
"includeSubscriptions": True,
"sortBy": "<string>",
"sortOrder": "asc",
"exclusiveCursor": True
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
workspaceId: '<string>',
cursor: '<string>',
segmentFilter: ['<string>'],
limit: 123,
direction: 'after',
userIds: ['1043'],
subscriptionGroupFilter: ['<string>'],
userPropertyFilter: [{id: '<string>', values: ['<string>']}],
includeSubscriptions: true,
sortBy: '<string>',
sortOrder: 'asc',
exclusiveCursor: true
})
};

fetch('http://localhost:3001/api/admin/users/', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_PORT => "3001",
CURLOPT_URL => "http://localhost:3001/api/admin/users/",
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([
'workspaceId' => '<string>',
'cursor' => '<string>',
'segmentFilter' => [
'<string>'
],
'limit' => 123,
'direction' => 'after',
'userIds' => [
'1043'
],
'subscriptionGroupFilter' => [
'<string>'
],
'userPropertyFilter' => [
[
'id' => '<string>',
'values' => [
'<string>'
]
]
],
'includeSubscriptions' => true,
'sortBy' => '<string>',
'sortOrder' => 'asc',
'exclusiveCursor' => true
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"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 := "http://localhost:3001/api/admin/users/"

payload := strings.NewReader("{\n \"workspaceId\": \"<string>\",\n \"cursor\": \"<string>\",\n \"segmentFilter\": [\n \"<string>\"\n ],\n \"limit\": 123,\n \"direction\": \"after\",\n \"userIds\": [\n \"1043\"\n ],\n \"subscriptionGroupFilter\": [\n \"<string>\"\n ],\n \"userPropertyFilter\": [\n {\n \"id\": \"<string>\",\n \"values\": [\n \"<string>\"\n ]\n }\n ],\n \"includeSubscriptions\": true,\n \"sortBy\": \"<string>\",\n \"sortOrder\": \"asc\",\n \"exclusiveCursor\": true\n}")

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

req.Header.Add("Authorization", "<api-key>")
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("http://localhost:3001/api/admin/users/")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"workspaceId\": \"<string>\",\n \"cursor\": \"<string>\",\n \"segmentFilter\": [\n \"<string>\"\n ],\n \"limit\": 123,\n \"direction\": \"after\",\n \"userIds\": [\n \"1043\"\n ],\n \"subscriptionGroupFilter\": [\n \"<string>\"\n ],\n \"userPropertyFilter\": [\n {\n \"id\": \"<string>\",\n \"values\": [\n \"<string>\"\n ]\n }\n ],\n \"includeSubscriptions\": true,\n \"sortBy\": \"<string>\",\n \"sortOrder\": \"asc\",\n \"exclusiveCursor\": true\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("http://localhost:3001/api/admin/users/")

http = Net::HTTP.new(url.host, url.port)

request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"workspaceId\": \"<string>\",\n \"cursor\": \"<string>\",\n \"segmentFilter\": [\n \"<string>\"\n ],\n \"limit\": 123,\n \"direction\": \"after\",\n \"userIds\": [\n \"1043\"\n ],\n \"subscriptionGroupFilter\": [\n \"<string>\"\n ],\n \"userPropertyFilter\": [\n {\n \"id\": \"<string>\",\n \"values\": [\n \"<string>\"\n ]\n }\n ],\n \"includeSubscriptions\": true,\n \"sortBy\": \"<string>\",\n \"sortOrder\": \"asc\",\n \"exclusiveCursor\": true\n}"

response = http.request(request)
puts response.read_body
{
  "users": [
    {
      "id": "<string>",
      "properties": {},
      "segments": [
        {
          "id": "<string>",
          "name": "<string>"
        }
      ],
      "subscriptions": [
        {
          "id": "<string>",
          "name": "<string>",
          "subscribed": true
        }
      ]
    }
  ],
  "userCount": 0,
  "previousCursor": "<string>",
  "nextCursor": "<string>"
}
{
"message": "<string>"
}

Authorizations

Authorization
string
header
required

Body

application/json
workspaceId
string
required
cursor
string
segmentFilter
string[]
limit
number
direction
Available options:
after
userIds
string[]

Unique identifier for the user. Should be the id of the user in your system. Only applicable to logged in users.

subscriptionGroupFilter
string[]
userPropertyFilter
object[]
includeSubscriptions
boolean
sortBy
string
sortOrder
Available options:
asc
exclusiveCursor
boolean

Response

Default Response

users
object[]
required
userCount
enum<number>
required
Available options:
0
previousCursor
string
nextCursor
string