---
title: "segmentUpdate"
description: "Updates a segment."
doc_type: graphql
doc_category: adminGraphQL
doc_version: v20270301
source_url:
  html: 'https://developer.shopline.com/docs/admin-graph-ql-api/customers/mutations/segment-update'
  md: 'https://developer.shopline.com/docs/admin-graph-ql-api/customers/mutations/segment-update.md'
---
# segmentUpdate

Updates a segment.

- **Required Scopes:** `write_customers`
- **API Version:** v20270301
- **API Type:** Admin
- **API Protocol:** GraphQL
- **Operation Type:** Mutation

## Type Signature

`SegmentUpdatePayload`

## Required Permissions

* `write_customers`

An access token is required to call this API. Refer to [Authorization](https://developer.shopline.com/docs/apps/api-instructions-for-use/graph-ql-admin-api/overview.md) for more information about how to obtain the token.

## Arguments

* `id`

  [ID!](https://developer.shopline.com/docs/admin-graph-ql-api/common/scalars/id.md)

  Specify the line segment to be updated .

* `name`

  [String!](https://developer.shopline.com/docs/admin-graph-ql-api/common/scalars/string.md)

  New name for segment .

* `query`

  [String!](https://developer.shopline.com/docs/admin-graph-ql-api/common/scalars/string.md)

  Query condition , json string

## Returns

* `segment`

  [Segment](https://developer.shopline.com/docs/admin-graph-ql-api/customers/objects/segment.md)

  The updated segment.

* `userErrors`

  [[BusinessCustomerUserError]](https://developer.shopline.com/docs/admin-graph-ql-api/customers/objects/business-customer-user-error.md)

  Error message

## Code Example

```graphql
mutation segmentUpdate($id: ID! $name: String! $query: String! ) {
	segmentUpdate(id: $id, name: $name, query: $query ) 
		 {
			# SegmentUpdatePayload fields
		}
		
	}

```

## Variables

```json
{
  "id": {},
  "name": {},
  "query": {}
}
```

## Error Handling

For detailed information about common codes, see [Status and error codes](https://developer.shopline.com/docs/apps/api-instructions-for-use/graph-ql-admin-api/overview.md#status-and-error-codes).

