Clear a segment's membership
POST /v2/marketing/segments/clear_membership_segment
Clears all members from a membership segment. This is an asynchronous operation. To check its progress, poll get clear status.
Security
| Name | In | Description |
|---|---|---|
Authorization | header | The Authorization header with the client bearer token acquired during authentication. |
For more information, see Get a client access token.
Parameters
None.Request
| Field | Type | Required | Description |
|---|---|---|---|
segment_id | string | The ID of the segment to clear. Required. |
Request examples
- cURL
- Java
- Python
- Go
curl --request POST \
--url https://connect.instacart.com/v2/marketing/segments/clear_membership_segment \
--header 'Accept: application/json' \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"segment_id": "string"
}'
HttpResponse<String> response = Unirest.post("https://connect.instacart.com/v2/marketing/segments/clear_membership_segment")
.header("Accept", "application/json")
.header("Content-Type", "application/json")
.header("Authorization", "Bearer <token>")
.body("{\n \"segment_id\": \"string\"\n}")
.asString();
import http.client
conn = http.client.HTTPSConnection("connect.instacart.com")
payload = "{\n \"segment_id\": \"string\"\n}"
headers = {
'Accept': "application/json",
'Content-Type': "application/json",
'Authorization': "Bearer <token>"
}
conn.request("POST", "/v2/marketing/segments/clear_membership_segment", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://connect.instacart.com/v2/marketing/segments/clear_membership_segment"
payload := strings.NewReader("{\n \"segment_id\": \"string\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Accept", "application/json")
req.Header.Add("Content-Type", "application/json")
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
Response
| Field | Type | Required | Description |
|---|---|---|---|
success | boolean | Whether the clear request was accepted. |
Response examples
200 Success
200Success
{
"success": true
}
4XX Errors
Error responses return either a single error or multiple errors.
| HTTP Code | Cause | Error Message | Error Code | Error Meta |
|---|---|---|---|---|
400 | Invalid body | "Invalid request body" | 1001 | Not applicable |
400 | Missing field | "can't be blank" | 1001 | {"key":"segment_id"} |
401 | Unauthorized | "Unauthorized" | null | Not applicable |
403 | Forbidden | "Forbidden" | null | Not applicable |