OnyxMetric
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/:segmentId

Updates 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

Request
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}'
Request
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();
Request
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()
Response
{
  "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"
}