---
title: "Get all segments"
slug: "get-all-segments"
abstract: "Describes the request and response details of this Sitecore Send API endpoint to get all segments created in a mailing list."
---
# Get all segments

`GET /lists/{MailingListID}/segments.{Format}`

Retrieves a list of all segments including their criteria for a specific email list in your Sitecore Send account.

## Request

| Parameter | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| MailingListID | path | string | true | The ID of the email list that contains the segments. |
| Format | path | string | true | The supported file format for getting a response.Possible values: json and xml. |
| apikey | query | string | true | The API key of your account. |

```http
GET https://{hostname}/v3/lists/{MailingListID}/segments.{Format}?apikey=
```

```curl
curl --include \\
     --header "Content-Type: application/json" \\
     --header "Accept: application/json" \\
     'https://{hostname}/v3/lists/{MailingListID}/segments.{Format}?apikey='
```

## Response

| Status | Description | Headers | Schema |
| --- | --- | --- | --- |
| 200 OK | The request is successful. | Content-Type:application/jsonAccept:application/json | N/A |

```json
{
  "Code": 0,
  "Error": null,
  "Context": {
    "Paging": {
      "PageSize": 100,
      "CurrentPage": 1,
      "TotalResults": 1,
      "TotalPageCount": 1,
      "SortExpression": "CreatedOn",
      "SortIsAscending": false
    },
    "Segments": \[
      {
        "ID": 7314,
        "Name": "City",
        "MatchType": 1,
        "Criteria": \[
          {
            "ID": 12244,
            "SegmentID": 7314,
            "Field": 2,
            "CustomFieldID": null,
            "Comparer": 0,
            "Value": "test",
            "DateFrom": null,
            "DateTo": null,
            "Properties": null,
            "Subscriteria": null
          },
          {
            "ID": 12348,
            "SegmentID": 7314,
            "Field": 99,
            "CustomFieldID": "e4823107-d02d-48af-8190-d8694a33401e",
            "Comparer": 0,
            "Value": "UK",
            "DateFrom": null,
            "DateTo": null,
            "Properties": null,
            "Subscriteria": null
          }
        \],
        "CreatedBy": "211.11.111.11",
        "CreatedOn": "/Date(1451490040010+0000)/",
        "UpdatedBy": "211.11.111.11",
        "UpdatedOn": "/Date(1451490040010+0000)/",
        "FetchType": 0,
        "FetchValue": 0,
        "Description": "Fetch all where \\"City\\" is \\"UK\\" or \\"Recipient Name\\" is \\"Test\\"",
        "SegmentType": 1
      }
    \]
  }
}
```

-   `Code` - the response code. This is `0` if successful.
    
-   `Error` - the response error message. This is `null` if successful.
    
-   `Context` - an object that contains all the following information for the requested segments:
    
    -   `Paging` - an object that contains the following information:
        
        -   `PageSize` - the page size of the results. This is `0` if not defined.
            
        -   `CurrentPage` - the number of the result page. This is `1` if not defined.
            
        -   `Totalresults` - the number of segments that are included in the response.
            
        -   `TotalPageCount` - the total number of available segment pages for your account.
            
        -   `SortExpression` - the sort expression associated with the column or columns being sorted.
            
        -   `SortIsAscending` - this is `false` if the results are not displayed in ascending order based on the sort expression.

    -   `Segments` - a list of segments in the email list containing the following information for each segment:
        
        -   `ID` - the ID of the segment.
            
        -   `Name` - the name of the segment.
            
        -   `MatchType` - specifies how subscribers are returned by your segment based on the matching criteria. Possible values are:
            
            -   `0` - for All. Returns subscribers that match all the given criteria.
                
            -   `1` - for Any. Returns subscribers that match any of the given criteria.

        -   `Criteria` - contains a list with the following information for each selected criterion selected for the segment:
            
            -   `ID` - the ID of the criteria.
                
            -   `SegmentID` - the ID of the segment.
                
            -   `Field` - the `enum` value of the selected filter.
                
            -   `CustomFieldID` - if the selected filter is a custom field, this is the ID of the custom field.
                
            -   `Comparer` - the operator that defines how to compare `Field` and `Value`. If not specified, `Is` is assumed.
                
                -   `0` - for `Is`. Finds subscribers where the `Field` is exactly equal to the specified `Value`.
                    
                -   `1` - for `IsNot`. Finds subscribers where the `Field` is not equal to the specified `Value`.
                    
                -   `2` - for `Contains`. Finds subscribers where the `Field` contains the specified `Value`.
                    
                -   `3` - for `DoesNotContain`. Finds subscribers where the `Field` does not contain the specified `Value`.
                    
                -   `4` - for `StartsWith`. Finds subscribers where the `Field` starts with the specified `Value`.
                    
                -   `5` - for `DoesNotStartWith`. Finds subscribers where the `Field` does not start with the specified `Value`.
                    
                -   `6` - for `EndsWith`. Finds subscribers where the `Field` ends with the specified `Value`.
                    
                -   `7` - for `DoesNotEndWith`. Finds subscribers where the `Field` does not end with the specified `Value`.
                    
                -   `8` - for `IsGreaterThan`. Finds subscribers where the `Field` is greater than the specified `Value`.
                    
                -   `9` - for `IsGreaterThanOrEqualTo`. Finds subscribers where the `Field` is greater than or equal to the specified `Value`.
                    
                -   `10` - for `IsLessThan`. Finds subscribers where the `Field` is less than the specified `Value`.
                    
                -   `11` - for `IsLessThanOrEqualTo`. Finds subscribers where the `Field` is less than or equal to the specified `Value`.
                    
                -   `12` - for `IsBefore`. Finds subscribers where the `Field` is before the specified `Value`.
                    
                -   `13` - for `IsAfter`. Finds subscribers where the `Field` is after the specified `Value`.
                    
                -   `14` - for `IsEmpty`. Finds subscribers where the `Field` has no `Value`.
                    
                -   `15` - for `IsNotEmpty`. Finds subscribers where the `Field` contains a `Value`.
                    
                -   `16` - for `IsTrue`. Finds subscribers where the condition defined by the `Field` is true.
                    
                -   `17` - for `IsFalse`. Finds subscribers where the condition defined by the `Field` is false.
                    
                -   `24` - for `IsBetween`. Finds subscribers where the numeric value of a criterion is between two defined numbers.
                    
                -   `25` - for `IsNotBetween`. Finds subscribers where the numeric value of a criterion is not between two defined numbers.

            -   `Value` - the search term used to filter the specified `Field`.
                
            -   `DateFrom` - the starting date-time value selected to filter the results. If not selected, this is `null`.
                
            -   `DateTo` - the ending date-time value selected to filter the results. If not selected, this is `null`.
                
            -   `Properties` - this is `null` for this case.
                
            -   `Subscriteria` - this is `null` for this case.

        -   `CreatedBy` - the IP address used to create the requested segment.
            
        -   `CreatedOn` - the date-time the requested segment was created.
            
        -   `UpdatedBy` - the IP address used to update the requested segment.
            
        -   `UpdatedOn` - the date-time the requested segment was updated.
            
        -   `FetchType` - the selected fetch type for the selected segment criteria. Possible values are:
            
            -   `0` - for all segment criteria.
                
            -   `1` - for the top segment criteria.
                
            -   `2` - for the top percent segment criteria.

        -   `FetchValue` - the value used to apply the `FetchType` filter.
            
        -   `Description` - contains a string representation of all the selected filters, `MatchType` and `FetchType` criteria.
            
        -   `SegmentType` - the selected segment type for the selected segment criteria. Possible values are:
            
            -   `1` - for `Custom`
                
            -   `2` - for `SystemGenerated`
                
            -   `4` - for `ReadOnly`