---
title: "Segment Update"
method: PUT
path: "/api/segment/{id}"
tags: ["Segment"]
---

# Segment Update

`PUT /api/segment/{id}`

## Request

- Base URL: `https://api.lytics.io`
- URL: `https://api.lytics.io/api/segment/{id}`
- Auth: API key in header `Authorization`

Update A segment.

```
# You can upsert (insert if new, update if exists)
# by POSTing to api and the ALIAS will be used to lookup
# the existing one and update it.
curl -s -XPOST "https://api.lytics.io/api/segment" \
    -H "Content-type: text/plain" \
    -H "Authorization: $LIOKEY" \
    -d'

FILTER AND (
    visits > 5,
    last_visit >= "now-30d",
    scores.momentum >  10
)
ALIAS our_test_activelist

' | jq '.'


# Json Api Allows a few more fields such as description
curl -s -XPUT "https://api.lytics.io/api/segment/123456id" \
    -H "Authorization: $LIOKEY" \
    -H "Content-type: application/json" \
    -d'
{
    "name":"Most Active Users",
    "segment_ql": "FILTER AND (visits > 5,last_visit >= \"now-30d\", scores.momentum >  10)",
    "slug_name":"our_test_activelist",
    "is_public": true,
    "description":"a description of what this is for"
}
' | jq '.'

```

## Path parameters

- `id` string, required

## Query parameters

- `account_id` string

## Response `200`

OK

- SegmentModel
  - `data` object
    - `id` string
    - `account_id` string
    - `author_id` string
    - `kind` string
    - `segment_ql` string
    - `created` string
    - `updated` string
    - `description` string
    - `name` string
    - `slug_name` string
    - `tags` string[]

---

[API](https://skmtc.dev/lytics/apis/v1-lytics-api.md) - [All operations](https://skmtc.dev/lytics/apis/v1-lytics-api/llms.txt) - [OpenAPI document](https://skmtc.dev/lytics/apis/v1-lytics-api/revisions/339fd1d88486?raw)
