--- title: "CreateSegmentModel" slug: "createsegmentmodel" updated: 2025-07-18T11:52:58Z published: 2025-07-18T11:52:58Z canonical: "docs.datajet.app/createsegmentmodel" --- > ## Documentation Index > Fetch the complete documentation index at: https://docs.datajet.app/llms.txt > Use this file to discover all available pages before exploring further. # CreateSegmentModel Creates a table of segment IDs, counts and filtered counts from the current campaign segment list. (Note: This is a pre-cursor to [AnalyseSegments](/v1/docs/analysesegments) which should generally be used as it has a greater set of functionality) | Key | Value(s) | Description | | --- | --- | --- | | method | "CreateSegmentModel" | Creates a table of segment IDs, counts and filtered counts from the current campaign segment list | | segments[] | | Optional. If not present, all segments in the system will be analysed (i.e., all segments listed in the [Audiences](https://portal.document360.io/v1/docs/audience-overview) or Campaigns interface) Provide a list of segments IDs to include in the analysis: [ 10001, 10002, 10003 ] **NOTE**: A list of segment IDs can be obtained from the Campaign \| Audiences report. Filter the grid to show the required segments, and then use the Copy/Paste functionality to transfer segment IDs into the AnalyseSegments API. **NOTE**: Only one of segments or segmentFilter can be used. ```json "segments": [ 10846, 10847, 10848, 10849, 10850, 10851, 10852, 10853, 10854, 10855 ], ``` | | segmentFilter{} | | Optional. Only includes segments that meet criteria. Required input: - field: full name of field containing segment IDs (Note: This table can be created from another AnalyseSegments call or from CreateSegmentModel) - dataSet{} : dataSet JSON for the query that will select the Ids. **NOTE**: Only one of segments or segmentFilter can be used. ```json "segmentFilter": { "field": "DailyLoad.Id", "dataSet": { "logic": "or", "name": "DataSet", "strict": true, "set": [ { "logic": "and", "stype": "FIELD", "entity": { "type": "field", "name": "DailyLoad.records", "table": "DailyLoad", "valueFilter": [] }, "op": ">=", "values": [ "200000" ] } ] } }, ``` | | table | "tablename" | Required. Target table for output results. Table must not already exist | | targetDataSets[] | [ {Dataset1Definition}, {Dataset2Definition}, {Dataset3Definition} ] | Required. Target datasets to use when calculating overlaps. A minimum of 1 target dataset must be included. Target datasets can be added either by dragging and dropping a dataset [collection](/v1/docs/dataset-collections) onto the JSON window, or by dragging and dropping a dataset. **NOTE:** All target datasets must be on the primary contact table. (The Primary Contact Table is a DataJet table containing at minimum Hash-Keys and their matching Integer-Keys. It is created by loading the Master Hash-Key File generated by [ProcessSegments](/v1/docs/processsegments). See [Campaign Prototype: How to make a system campaign enabled](/v1/docs/campaign-prototype-how-to-make-a-system-campaign-enabled) for further details). To use data from other tables, first copy the required fields to the primary contact table using either [CopyUp](/v1/docs/copyup) or [CopyDown](/v1/docs/copy-down-p-f). A maximum of 16 target datasets can be processed in each call to Analyse Segments | | project | | | #### Output ![](https://cdn.document360.io/73b6469b-c1e4-47e9-aa65-986c8ebd17ca/Images/Documentation/image-1739470104450.png) #### Example ```json { "method": ";CreateSegmentModel", "table": "MySegmentSelectorTable", "targetDataSets": [ { "logic": "or", "name": "Alaska", "strict": true, "set": [ { "logic": "or", "stype": "FIELD", "entity": { "type": "field", "name": "DATA_EYE_FULL.address_region", "table": "DATA_EYE_FULL", "valueFilter": [] }, "op": "=", "values": [ "Alaska" ] } ] }, { "logic": "or", "name": "California", "strict": true, "set": [ { "logic": "or", "stype": "FIELD", "entity": { "type": "field", "name": "DATA_EYE_FULL.address_region", "table": "DATA_EYE_FULL", "valueFilter": [] }, "op": "=", "values": [ "California" ] } ] }, { "logic": "or", "name": "Connecticut", "strict": true, "set": [ { "logic": "or", "stype": "FIELD", "entity": { "type": "field", "name": "DATA_EYE_FULL.address_region", "table": "DATA_EYE_FULL", "valueFilter": [] }, "op": "=", "values": [ "Connecticut" ] } ] }, { "logic": "or", "name": "Delaware", "strict": true, "set": [ { "logic": "or", "stype": "FIELD", "entity": { "type": "field", "name": "DATA_EYE_FULL.address_region", "table": "DATA_EYE_FULL", "valueFilter": [] }, "op": "=", "values": [ "Delaware" ] } ] }, { "logic": "or", "name": "Florida", "strict": true, "set": [ { "logic": "or", "stype": "FIELD", "entity": { "type": "field", "name": "DATA_EYE_FULL.address_region", "table": "DATA_EYE_FULL", "valueFilter": [] }, "op": "=", "values": [ "Florida" ] } ] }, { "logic": "or", "name": "North Carolina", "strict": true, "set": [ { "logic": "or", "stype": "FIELD", "entity": { "type": "field", "name": "DATA_EYE_FULL.address_region", "table": "DATA_EYE_FULL", "valueFilter": [] }, "op": "=", "values": [ "North Carolina" ] } ] }, { "logic": "or", "name": "North Dakota", "strict": true, "set": [ { "logic": "or", "stype": "FIELD", "entity": { "type": "field", "name": "DATA_EYE_FULL.address_region", "table": "DATA_EYE_FULL", "valueFilter": [] }, "op": "=", "values": [ "North Dakota" ] } ] } ], "project": "SBM_AnalyseSegments_Demo", "description": "Create simple data - All segments, with targeDataSets" } ```