Segments
Update Segment
Updates a saved segment. Admins and owners can edit any segment; members can edit segments they created. Only the fields you send change.
PUT /api/sites/:site/segments/:segmentIdUpdates a saved segment. Admins and owners can edit any segment; members can edit segments they created. Only the fields you send change.
Path Parameters
Prop
Type
Request Body
Prop
Type
Response
Returns the updated segment.
Prop
Type
curl -X PUT "https://app.onyxmetric.com/api/sites/1/segments/12" \
-H "Authorization: Bearer your_api_key_here" \
-H "Content-Type: application/json" \
-d '{"name": "Mobile organic (DE)", "isPublic": true}'const response = await fetch(
'https://app.onyxmetric.com/api/sites/1/segments/12',
{
method: 'PUT',
headers: {
'Authorization': 'Bearer your_api_key_here',
'Content-Type': 'application/json'
},
body: JSON.stringify({"name": "Mobile organic (DE)", "isPublic": true})
}
);
const data = await response.json();import requests
response = requests.put(
'https://app.onyxmetric.com/api/sites/1/segments/12',
json={"name": "Mobile organic (DE)", "isPublic": true},
headers={'Authorization': 'Bearer your_api_key_here'}
)
data = response.json(){
"segmentId": 12,
"siteId": 1,
"organizationId": "org_abc123",
"userId": "user_xyz",
"name": "Mobile organic (DE)",
"description": null,
"filters": [
{ "parameter": "device_type", "type": "equals", "value": ["Mobile"] },
{ "parameter": "channel", "type": "equals", "value": ["Organic Search"] },
{ "parameter": "country", "type": "equals", "value": ["DE"] }
],
"isPublic": true,
"type": "segment",
"canEdit": true,
"createdAt": "2026-09-02T10:15:00.000Z",
"updatedAt": "2026-09-02T10:15:00.000Z"
}Create SegmentPOST
Creates a saved segment. Members create site segments they own; admins and owners can also create organization-wide segments.
Delete SegmentDELETE
Deletes a saved segment. Admins and owners can delete any segment; members can delete segments they created. Links that already expanded the segment's filters keep working.