Segments

The Segments endpoints allow you to retrieve, create, update, and delete information about Segments in a database.


List all Segments

This query allows you to retrieve a paginated list of all your Segments. By default, a maximum of 25 Segments are shown per page.

Arguments

  • Name
    query
    Type
    String!
    Description

    Supported filter parameters: order_by order_dir

  • Name
    after
    Type
    String
    Description

    Returns the elements that come after the specified cursor.

  • Name
    first
    Type
    String
    Description

    Returns up to the first n elements from the list.

Fields

  • Label
    Segment!
    Description

    The Segment! query type.

Request

POST
https://api.lightfunnels.com/graphql
query SegmentsQuery($first: Int, $after: String, $query: String!){
	segments(query: "order_by:id order_dir:desc", after: "WzVE4OTA5LDEe/4OTA5XQ==", first: 10){
		edges{
			node{
				id
				name
				description
			}
			cursor
		}
		pageInfo{
			endCursor
			hasNextPage
		}
	}
}

Response

{
		"data": {
			"edges": [{
				"node": {
					"id": "U2VnbWVudDozMQ==",
					"name": "Segment test",
					"description": "description ...",
				},
				"cursor": "WzE5MTM1MCwxOTEzNTBd"
			}],
			"pageInfo": {
				"endCursor": "WzE0Njk5MSwxNDY5OTFd",
				"hasNextPage": true
			}
		}
	}

Create a Segment

This query allows you to add a new Segment.

Arguments

Fields

  • Label
    Segment!
    Description

    The Segment! query type.

Request

POST
https://api.lightfunnels.com/graphql
mutation mutationName($node: SegmentInput!) {
	createSegment(node: $node){
		# Segment type fields
	}
}

Response

{
		"data": {
			"createSegment": {
				"id": "U2VnbWVudDozMQ==",
				"name": "Segment test",
				"description": "description ..."
			}
		}
	}

Retrieve a Segment

This query allows you to retrieve a Segment by providing their id.

Arguments

  • Name
    id
    Type
    Int!
    Description

    The Segment id.

Fields

  • Label
    Segment!
    Description

    The Segment! query type.

Request

POST
https://api.lightfunnels.com/graphql
	query SegmentQuery($id: Int!){
		segment(id: $id){
			# Segment type fields
		}
	}

Response

	{
		"data": {
			"node": {
				"id": "U2VnbWVudDozMQ==",
				"name": "Segment test",
				"description": "description ..."
			}
		}
	}

Update a Segment

This query allows you to perform an update on a Segment.

Arguments

  • Name
    id
    Type
    Int!
    Description

    The Segment id.

  • Name
    node
    Label
    SegmentInput!
    Description

    The Segment node.

Fields

  • Label
    Segment!
    Description

    The Segment! query type.

Request

Post
https://api.lightfunnels.com/graphql
mutation updateSegmentMutation($node: SegmentInput!, $id: Int!){
		updateSegment(node: $node, id: $id){
			# Segment type fields
		}
	}

Response

{
		"data": {
			"updateSegment": {
				"id": "U2VnbWVudDozMQ==",
				"name": "Segment test",
				"description": "description ..."
			}
		}
	}

Delete a Segment

This query allows you to delete Segments.

Arguments

  • Name
    items
    Type
    [ID!]!
    Description

    The Segment ids.

Fields

  • Name
    [ID]
    Description

    List of segment ids.

Request

POST
https://api.lightfunnels.com/graphql
	mutation deleteSegmentsMutation($items: [ID!]!){
		deleteSegments(items: $items){
			# [ID] type fields
		}
	}

Response

{
	"data": {
		"deleteSegments": [
			"UHJvZHVjdDoxNTUxMQ==",
			"UHJvZHVjdFKWATUxMQ=="
		]
	}
}