> ## 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.

# createSegmentDefinition

> Creates a segment definition for a card definition and returns it. `ConflictError`: the card definition doesn't exist; `ValidationError`: invalid id, icon URL or color.



**mutation** `createSegmentDefinition(input: CreateSegmentDefinitionInput!): CreateSegmentDefinitionPayload!`

## Arguments

**`input`**: `CreateSegmentDefinitionInput!` (required)

## Returns

`CreateSegmentDefinitionPayload!`

**`errors`**: `[CreateSegmentDefinitionError!]`

---

**`segmentDefinition`**: `SegmentDefinition`

## Examples

```graphql Mutation
mutation CreateSegmentDefinition($input: CreateSegmentDefinitionInput!) {
  createSegmentDefinition(input: $input) {
    errors {
      __typename
      ... on GraphQlError {
        code
        details {
          __typename
        }
        message
      }
    }
    segmentDefinition {
      cardDefinitionId
      createdAt
      defaultContentFilterProperties
      description
      iconUrl
      id
    }
  }
}
```

```json Variables
{
  "input": {
    "cardDefinitionId": "id",
    "id": "id",
    "name": "string"
  }
}
```

```json Response
{
  "data": {
    "createSegmentDefinition": {
      "errors": [
        {
          "__typename": "GraphQlError",
          "code": "string",
          "details": [
            {
              "__typename": "KeyValuePairOfStringAndString"
            }
          ],
          "message": "string"
        }
      ],
      "segmentDefinition": {
        "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.