> ## Documentation Index
> Fetch the complete documentation index at: https://developers.redo.com/llms.txt
> Use this file to discover all available pages before exploring further.

# updateDynamicSegment

> Update a dynamic segment. Returns null if no owned segment matches the id.

**Required scopes:** [`segments_write`](/docs/api-reference/v3/reference/scopes#scope-segments_write)

## Arguments

<ResponseField name="id" type="ID!" required>
  The segment's `id`, or its `legacyId` from an earlier version of the Redo API.
</ResponseField>

<ResponseField name="input" type={<a href="/docs/api-reference/v3/reference/marketing/update-dynamic-segment-input">UpdateDynamicSegmentInput!</a>} required>
  The fields to change.

  <Expandable title="fields" lazyRender>
    <ResponseField name="conditions" type={<a href="/docs/api-reference/v3/reference/common/json">JSON</a>}>
      Replacement condition tree matching segmentConditionCatalog.conditionsJsonSchema.
    </ResponseField>

    <ResponseField name="name" type="String">
      The merchant-facing name of the segment.
    </ResponseField>
  </Expandable>
</ResponseField>

## Returns

<ResponseField name="updateDynamicSegment" type={<a href="/docs/api-reference/v3/reference/marketing/segment">Segment</a>}>
  A group of customers that campaigns and automations send to.

  <Expandable title="fields" lazyRender>
    <ResponseField name="conditions" type={<a href="/docs/api-reference/v3/reference/common/json">JSON</a>}>
      Dynamic segment condition tree. Null for static and persona segments.
    </ResponseField>

    <ResponseField name="countsRefreshedAt" type={<a href="/docs/api-reference/v3/reference/common/date-time">DateTime</a>}>
      When the member counts were last recalculated. They are not live.
    </ResponseField>

    <ResponseField name="createdAt" type={<a href="/docs/api-reference/v3/reference/common/date-time">DateTime!</a>} required>
      When the segment was created.
    </ResponseField>

    <ResponseField name="description" type="String">
      The merchant's description of who this segment is for.
    </ResponseField>

    <ResponseField name="emailSubscriberCount" type="Int">
      Members subscribed to email marketing as of `countsRefreshedAt`.
    </ResponseField>

    <ResponseField name="id" type="ID!" required>
      The id of this segment.
    </ResponseField>

    <ResponseField name="legacyId" type="String!" required>
      The segment's legacy Mongo ObjectId (24-char hex) from before the CockroachDB migration.
    </ResponseField>

    <ResponseField name="memberCount" type="Int">
      Customers in the segment as of `countsRefreshedAt`. Null until it has first been counted.
    </ResponseField>

    <ResponseField name="name" type="String!" required>
      The merchant-facing name of the segment.
    </ResponseField>

    <ResponseField name="smsSubscriberCount" type="Int">
      Members subscribed to SMS marketing as of `countsRefreshedAt`.
    </ResponseField>

    <ResponseField name="type" type={<a href="/docs/api-reference/v3/reference/marketing/segment-type">SegmentType!</a>} required>
      How membership of this segment is determined.
    </ResponseField>

    <ResponseField name="updatedAt" type={<a href="/docs/api-reference/v3/reference/common/date-time">DateTime!</a>} required>
      When the segment was last updated.
    </ResponseField>
  </Expandable>
</ResponseField>

## Example

```graphql theme={null}
mutation {
  updateDynamicSegment(id: "...", input: { ... }) {
    conditions
    countsRefreshedAt
    createdAt
    description
    emailSubscriberCount
    id
    legacyId
    memberCount
    # ...
  }
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.