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

# segmentDefinitionById

> Gets a segment definition by its global id. Fails when no segment definition has it.



**query** `segmentDefinitionById(id: ID!): SegmentDefinition!`

## Arguments

**`id`**: `ID!` (required)

Global id of the segment definition (`SegmentDefinition.id`).

## Returns

`SegmentDefinition!`

**`cardDefinitionId`**: `ID!`

Global id of the card definition whose cards the segments pick (`CardDefinition.id`).

---

**`createdAt`**: `DateTime!`

When the segment definition was created (UTC).

---

**`defaultContentFilterProperties`**: `[String!]!`

Ids stored on the segment definition. Can't be set through this API, and the API doesn't act on them.

---

**`description`**: `String`

Free-text note about the segment definition.

---

**`iconUrl`**: `String`

URL of the icon. Null when not set.

---

**`id`**: `ID!`

Global id of the segment definition: base64 of `SegmentDefinition:<raw id>`. `segmentDefinitionById` and the segment definition mutations take it. Criteria use the raw id (`SegmentsCriteriaInput.segmentDefinitionId`).

---

**`lastModified`**: `DateTime!`

When the segment definition last changed (UTC).

---

**`lastModifiedBy`**: `UUID!`

Id of the user or application that last changed the segment definition.

---

**`name`**: `String!`

Name of the segment definition.

---

**`properties`**: `[SegmentPropertyDefinition!]!`

Custom segment properties each segment can hold a value for, in `Segment.properties`. Can't be set through this API.

---

**`segments`**: `SegmentsConnection`

Segments in the segment definition, archived ones included.

**Arguments:**

- `after`: `String` — Returns the elements in the list that come after the specified cursor.
- `before`: `String` — Returns the elements in the list that come before the specified cursor.
- `first`: `Int` — Returns the first _n_ elements from the list.
- `last`: `Int` — Returns the last _n_ elements from the list.
- `order`: `[SegmentSortInput!]`
- `where`: `SegmentFilterInput`

## Examples

```graphql Query
query SegmentDefinitionById($id: ID!) {
  segmentDefinitionById(id: $id) {
    cardDefinitionId
    createdAt
    defaultContentFilterProperties
    description
    iconUrl
    id
  }
}
```

```json Variables
{
  "id": "id"
}
```

```json Response
{
  "data": {
    "segmentDefinitionById": {
      "cardDefinitionId": "id",
      "createdAt": "value",
      "defaultContentFilterProperties": [
        "string"
      ],
      "description": "string",
      "iconUrl": "string",
      "id": "id"
    }
  }
}
```


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