Remove users from segment
POST
/v1/segment/membership/remove-users
const url = 'https://api.foldspace.ai/v1/segment/membership/remove-users';const options = { method: 'POST', headers: { 'X-FOLDSPACE-API-KEY': '<X-FOLDSPACE-API-KEY>', 'Content-Type': 'application/json' }, body: '{"segmentId":"123456","segmentName":"Users last seen in the last 7 days","segmentDescription":"Users who have been active in the last 7 days","executionId":"123456","pageInfo":{"pageNumber":1,"totalPages":10},"userMemberships":{"userId":"123456","firstName":"John","lastName":"Doe","email":"user@company.com","phoneNumber":"+1234567890"}}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api.foldspace.ai/v1/segment/membership/remove-users \ --header 'Content-Type: application/json' \ --header 'X-FOLDSPACE-API-KEY: <X-FOLDSPACE-API-KEY>' \ --data '{ "segmentId": "123456", "segmentName": "Users last seen in the last 7 days", "segmentDescription": "Users who have been active in the last 7 days", "executionId": "123456", "pageInfo": { "pageNumber": 1, "totalPages": 10 }, "userMemberships": { "userId": "123456", "firstName": "John", "lastName": "Doe", "email": "user@company.com", "phoneNumber": "+1234567890" } }'Remove users from a segment. If a segment does not exist, it will be created. If a user does not exist, it will be created.
Authorizations
Section titled “Authorizations ”Request Body required
Section titled “Request Body required ” Media type application/json
Segment membership details
object
segmentId
required
Segment ID
string
Example
123456 segmentName
required
Segment name
string
Example
Users last seen in the last 7 days segmentDescription
Segment description
string
Example
Users who have been active in the last 7 days executionId
required
Execution ID
string
Example
123456 pageInfo
Page information. Pages of same operation should be grouped with the same execution ID
object
pageNumber
Number of current page starting from 1
integer format: int32
Example
1 totalPages
Number of total pages
integer format: int32
Example
10 userMemberships
User details for membership
object
userId
required
User ID
string
Example
123456 firstName
First name
string
Example
John lastName
Last name
string
Example
Doe email
string
Example
user@company.com phoneNumber
Phone number
string
Example
+1234567890Responses
Section titled “ Responses ”Users removed from segment
Media type application/json
string
Example
{ "message": "Users removed from segment"}Unauthorized
Media type application/json
string
Example
{ "error": "Unauthorized"}Rate limit exceeded for subscription
Media type application/json
string
Example
{ "error": "Rate limit exceeded for subscription"}Internal server error
Media type application/json
string
Example
{ "error": "Internal server error"}