Skip to main content
PUT
/
datasets
/
{dataset_id}
/
statistics-configuration
Put Statistics Configuration
curl --request PUT \
  --url https://api-dev.narrative.io/datasets/{dataset_id}/statistics-configuration \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "defaults": {
    "enabled_stats": [],
    "stat_options": {
      "histogram": {
        "max_bins": 50,
        "overflow": "none"
      }
    }
  },
  "refresh": {
    "trigger": "cron",
    "cron_expression": "<string>"
  },
  "dataset": {
    "scope": {
      "enabled_stats": [],
      "stat_options": {
        "histogram": {
          "max_bins": 50,
          "overflow": "none"
        }
      }
    },
    "fields": [
      {
        "field_name": "<string>",
        "enabled_stats": [],
        "stat_options": {
          "histogram": {
            "max_bins": 50,
            "overflow": "none"
          }
        },
        "self": {
          "enabled_stats": [],
          "stat_options": {
            "histogram": {
              "max_bins": 50,
              "overflow": "none"
            }
          }
        },
        "properties": [
          {
            "path": "<string>",
            "enabled_stats": [],
            "stat_options": {
              "histogram": {
                "max_bins": 50,
                "overflow": "none"
              }
            },
            "self": {
              "enabled_stats": [],
              "stat_options": {
                "histogram": {
                  "max_bins": 50,
                  "overflow": "none"
                }
              }
            },
            "properties": "<array>",
            "items": {
              "enabled_stats": [],
              "stat_options": {
                "histogram": {
                  "max_bins": 50,
                  "overflow": "none"
                }
              },
              "self": {
                "enabled_stats": [],
                "stat_options": {
                  "histogram": {
                    "max_bins": 50,
                    "overflow": "none"
                  }
                }
              },
              "properties": "<array>",
              "items": "<unknown>"
            }
          }
        ],
        "items": {
          "enabled_stats": [],
          "stat_options": {
            "histogram": {
              "max_bins": 50,
              "overflow": "none"
            }
          },
          "self": {
            "enabled_stats": [],
            "stat_options": {
              "histogram": {
                "max_bins": 50,
                "overflow": "none"
              }
            }
          },
          "properties": "<array>",
          "items": "<unknown>"
        }
      }
    ]
  },
  "rosetta_stone": {
    "scope": {
      "enabled_stats": [],
      "stat_options": {
        "histogram": {
          "max_bins": 50,
          "overflow": "none"
        }
      }
    },
    "fields": [
      {
        "attribute_name": "<string>",
        "enabled_stats": [],
        "stat_options": {
          "histogram": {
            "max_bins": 50,
            "overflow": "none"
          }
        },
        "self": {
          "enabled_stats": [],
          "stat_options": {
            "histogram": {
              "max_bins": 50,
              "overflow": "none"
            }
          }
        },
        "properties": [
          {
            "path": "<string>",
            "enabled_stats": [],
            "stat_options": {
              "histogram": {
                "max_bins": 50,
                "overflow": "none"
              }
            },
            "self": {
              "enabled_stats": [],
              "stat_options": {
                "histogram": {
                  "max_bins": 50,
                  "overflow": "none"
                }
              }
            },
            "properties": "<array>",
            "items": {
              "enabled_stats": [],
              "stat_options": {
                "histogram": {
                  "max_bins": 50,
                  "overflow": "none"
                }
              },
              "self": {
                "enabled_stats": [],
                "stat_options": {
                  "histogram": {
                    "max_bins": 50,
                    "overflow": "none"
                  }
                }
              },
              "properties": "<array>",
              "items": "<unknown>"
            }
          }
        ],
        "items": {
          "enabled_stats": [],
          "stat_options": {
            "histogram": {
              "max_bins": 50,
              "overflow": "none"
            }
          },
          "self": {
            "enabled_stats": [],
            "stat_options": {
              "histogram": {
                "max_bins": 50,
                "overflow": "none"
              }
            }
          },
          "properties": "<array>",
          "items": "<unknown>"
        }
      }
    ]
  }
}
'
import requests

url = "https://api-dev.narrative.io/datasets/{dataset_id}/statistics-configuration"

payload = {
"defaults": {
"enabled_stats": [],
"stat_options": { "histogram": {
"max_bins": 50,
"overflow": "none"
} }
},
"refresh": {
"trigger": "cron",
"cron_expression": "<string>"
},
"dataset": {
"scope": {
"enabled_stats": [],
"stat_options": { "histogram": {
"max_bins": 50,
"overflow": "none"
} }
},
"fields": [
{
"field_name": "<string>",
"enabled_stats": [],
"stat_options": { "histogram": {
"max_bins": 50,
"overflow": "none"
} },
"self": {
"enabled_stats": [],
"stat_options": { "histogram": {
"max_bins": 50,
"overflow": "none"
} }
},
"properties": [
{
"path": "<string>",
"enabled_stats": [],
"stat_options": { "histogram": {
"max_bins": 50,
"overflow": "none"
} },
"self": {
"enabled_stats": [],
"stat_options": { "histogram": {
"max_bins": 50,
"overflow": "none"
} }
},
"properties": "<array>",
"items": {
"enabled_stats": [],
"stat_options": { "histogram": {
"max_bins": 50,
"overflow": "none"
} },
"self": {
"enabled_stats": [],
"stat_options": { "histogram": {
"max_bins": 50,
"overflow": "none"
} }
},
"properties": "<array>",
"items": "<unknown>"
}
}
],
"items": {
"enabled_stats": [],
"stat_options": { "histogram": {
"max_bins": 50,
"overflow": "none"
} },
"self": {
"enabled_stats": [],
"stat_options": { "histogram": {
"max_bins": 50,
"overflow": "none"
} }
},
"properties": "<array>",
"items": "<unknown>"
}
}
]
},
"rosetta_stone": {
"scope": {
"enabled_stats": [],
"stat_options": { "histogram": {
"max_bins": 50,
"overflow": "none"
} }
},
"fields": [
{
"attribute_name": "<string>",
"enabled_stats": [],
"stat_options": { "histogram": {
"max_bins": 50,
"overflow": "none"
} },
"self": {
"enabled_stats": [],
"stat_options": { "histogram": {
"max_bins": 50,
"overflow": "none"
} }
},
"properties": [
{
"path": "<string>",
"enabled_stats": [],
"stat_options": { "histogram": {
"max_bins": 50,
"overflow": "none"
} },
"self": {
"enabled_stats": [],
"stat_options": { "histogram": {
"max_bins": 50,
"overflow": "none"
} }
},
"properties": "<array>",
"items": {
"enabled_stats": [],
"stat_options": { "histogram": {
"max_bins": 50,
"overflow": "none"
} },
"self": {
"enabled_stats": [],
"stat_options": { "histogram": {
"max_bins": 50,
"overflow": "none"
} }
},
"properties": "<array>",
"items": "<unknown>"
}
}
],
"items": {
"enabled_stats": [],
"stat_options": { "histogram": {
"max_bins": 50,
"overflow": "none"
} },
"self": {
"enabled_stats": [],
"stat_options": { "histogram": {
"max_bins": 50,
"overflow": "none"
} }
},
"properties": "<array>",
"items": "<unknown>"
}
}
]
}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}

response = requests.put(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
defaults: {enabled_stats: [], stat_options: {histogram: {max_bins: 50, overflow: 'none'}}},
refresh: {trigger: 'cron', cron_expression: '<string>'},
dataset: {
scope: {enabled_stats: [], stat_options: {histogram: {max_bins: 50, overflow: 'none'}}},
fields: [
{
field_name: '<string>',
enabled_stats: [],
stat_options: {histogram: {max_bins: 50, overflow: 'none'}},
self: {enabled_stats: [], stat_options: {histogram: {max_bins: 50, overflow: 'none'}}},
properties: [
{
path: '<string>',
enabled_stats: [],
stat_options: {histogram: {max_bins: 50, overflow: 'none'}},
self: {enabled_stats: [], stat_options: {histogram: {max_bins: 50, overflow: 'none'}}},
properties: '<array>',
items: {
enabled_stats: [],
stat_options: {histogram: {max_bins: 50, overflow: 'none'}},
self: {enabled_stats: [], stat_options: {histogram: {max_bins: 50, overflow: 'none'}}},
properties: '<array>',
items: '<unknown>'
}
}
],
items: {
enabled_stats: [],
stat_options: {histogram: {max_bins: 50, overflow: 'none'}},
self: {enabled_stats: [], stat_options: {histogram: {max_bins: 50, overflow: 'none'}}},
properties: '<array>',
items: '<unknown>'
}
}
]
},
rosetta_stone: {
scope: {enabled_stats: [], stat_options: {histogram: {max_bins: 50, overflow: 'none'}}},
fields: [
{
attribute_name: '<string>',
enabled_stats: [],
stat_options: {histogram: {max_bins: 50, overflow: 'none'}},
self: {enabled_stats: [], stat_options: {histogram: {max_bins: 50, overflow: 'none'}}},
properties: [
{
path: '<string>',
enabled_stats: [],
stat_options: {histogram: {max_bins: 50, overflow: 'none'}},
self: {enabled_stats: [], stat_options: {histogram: {max_bins: 50, overflow: 'none'}}},
properties: '<array>',
items: {
enabled_stats: [],
stat_options: {histogram: {max_bins: 50, overflow: 'none'}},
self: {enabled_stats: [], stat_options: {histogram: {max_bins: 50, overflow: 'none'}}},
properties: '<array>',
items: '<unknown>'
}
}
],
items: {
enabled_stats: [],
stat_options: {histogram: {max_bins: 50, overflow: 'none'}},
self: {enabled_stats: [], stat_options: {histogram: {max_bins: 50, overflow: 'none'}}},
properties: '<array>',
items: '<unknown>'
}
}
]
}
})
};

fetch('https://api-dev.narrative.io/datasets/{dataset_id}/statistics-configuration', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => "https://api-dev.narrative.io/datasets/{dataset_id}/statistics-configuration",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "PUT",
  CURLOPT_POSTFIELDS => json_encode([
    'defaults' => [
        'enabled_stats' => [
                
        ],
        'stat_options' => [
                'histogram' => [
                                'max_bins' => 50,
                                'overflow' => 'none'
                ]
        ]
    ],
    'refresh' => [
        'trigger' => 'cron',
        'cron_expression' => '<string>'
    ],
    'dataset' => [
        'scope' => [
                'enabled_stats' => [
                                
                ],
                'stat_options' => [
                                'histogram' => [
                                                                'max_bins' => 50,
                                                                'overflow' => 'none'
                                ]
                ]
        ],
        'fields' => [
                [
                                'field_name' => '<string>',
                                'enabled_stats' => [
                                                                
                                ],
                                'stat_options' => [
                                                                'histogram' => [
                                                                                                                                'max_bins' => 50,
                                                                                                                                'overflow' => 'none'
                                                                ]
                                ],
                                'self' => [
                                                                'enabled_stats' => [
                                                                                                                                
                                                                ],
                                                                'stat_options' => [
                                                                                                                                'histogram' => [
                                                                                                                                                                                                                                                                'max_bins' => 50,
                                                                                                                                                                                                                                                                'overflow' => 'none'
                                                                                                                                ]
                                                                ]
                                ],
                                'properties' => [
                                                                [
                                                                                                                                'path' => '<string>',
                                                                                                                                'enabled_stats' => [
                                                                                                                                                                                                                                                                
                                                                                                                                ],
                                                                                                                                'stat_options' => [
                                                                                                                                                                                                                                                                'histogram' => [
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                'max_bins' => 50,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                'overflow' => 'none'
                                                                                                                                                                                                                                                                ]
                                                                                                                                ],
                                                                                                                                'self' => [
                                                                                                                                                                                                                                                                'enabled_stats' => [
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                
                                                                                                                                                                                                                                                                ],
                                                                                                                                                                                                                                                                'stat_options' => [
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                'histogram' => [
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                'max_bins' => 50,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                'overflow' => 'none'
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                ]
                                                                                                                                                                                                                                                                ]
                                                                                                                                ],
                                                                                                                                'properties' => '<array>',
                                                                                                                                'items' => [
                                                                                                                                                                                                                                                                'enabled_stats' => [
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                
                                                                                                                                                                                                                                                                ],
                                                                                                                                                                                                                                                                'stat_options' => [
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                'histogram' => [
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                'max_bins' => 50,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                'overflow' => 'none'
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                ]
                                                                                                                                                                                                                                                                ],
                                                                                                                                                                                                                                                                'self' => [
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                'enabled_stats' => [
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                ],
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                'stat_options' => [
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                'histogram' => [
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                'max_bins' => 50,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                'overflow' => 'none'
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                ]
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                ]
                                                                                                                                                                                                                                                                ],
                                                                                                                                                                                                                                                                'properties' => '<array>',
                                                                                                                                                                                                                                                                'items' => '<unknown>'
                                                                                                                                ]
                                                                ]
                                ],
                                'items' => [
                                                                'enabled_stats' => [
                                                                                                                                
                                                                ],
                                                                'stat_options' => [
                                                                                                                                'histogram' => [
                                                                                                                                                                                                                                                                'max_bins' => 50,
                                                                                                                                                                                                                                                                'overflow' => 'none'
                                                                                                                                ]
                                                                ],
                                                                'self' => [
                                                                                                                                'enabled_stats' => [
                                                                                                                                                                                                                                                                
                                                                                                                                ],
                                                                                                                                'stat_options' => [
                                                                                                                                                                                                                                                                'histogram' => [
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                'max_bins' => 50,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                'overflow' => 'none'
                                                                                                                                                                                                                                                                ]
                                                                                                                                ]
                                                                ],
                                                                'properties' => '<array>',
                                                                'items' => '<unknown>'
                                ]
                ]
        ]
    ],
    'rosetta_stone' => [
        'scope' => [
                'enabled_stats' => [
                                
                ],
                'stat_options' => [
                                'histogram' => [
                                                                'max_bins' => 50,
                                                                'overflow' => 'none'
                                ]
                ]
        ],
        'fields' => [
                [
                                'attribute_name' => '<string>',
                                'enabled_stats' => [
                                                                
                                ],
                                'stat_options' => [
                                                                'histogram' => [
                                                                                                                                'max_bins' => 50,
                                                                                                                                'overflow' => 'none'
                                                                ]
                                ],
                                'self' => [
                                                                'enabled_stats' => [
                                                                                                                                
                                                                ],
                                                                'stat_options' => [
                                                                                                                                'histogram' => [
                                                                                                                                                                                                                                                                'max_bins' => 50,
                                                                                                                                                                                                                                                                'overflow' => 'none'
                                                                                                                                ]
                                                                ]
                                ],
                                'properties' => [
                                                                [
                                                                                                                                'path' => '<string>',
                                                                                                                                'enabled_stats' => [
                                                                                                                                                                                                                                                                
                                                                                                                                ],
                                                                                                                                'stat_options' => [
                                                                                                                                                                                                                                                                'histogram' => [
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                'max_bins' => 50,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                'overflow' => 'none'
                                                                                                                                                                                                                                                                ]
                                                                                                                                ],
                                                                                                                                'self' => [
                                                                                                                                                                                                                                                                'enabled_stats' => [
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                
                                                                                                                                                                                                                                                                ],
                                                                                                                                                                                                                                                                'stat_options' => [
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                'histogram' => [
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                'max_bins' => 50,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                'overflow' => 'none'
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                ]
                                                                                                                                                                                                                                                                ]
                                                                                                                                ],
                                                                                                                                'properties' => '<array>',
                                                                                                                                'items' => [
                                                                                                                                                                                                                                                                'enabled_stats' => [
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                
                                                                                                                                                                                                                                                                ],
                                                                                                                                                                                                                                                                'stat_options' => [
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                'histogram' => [
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                'max_bins' => 50,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                'overflow' => 'none'
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                ]
                                                                                                                                                                                                                                                                ],
                                                                                                                                                                                                                                                                'self' => [
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                'enabled_stats' => [
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                ],
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                'stat_options' => [
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                'histogram' => [
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                'max_bins' => 50,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                'overflow' => 'none'
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                ]
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                ]
                                                                                                                                                                                                                                                                ],
                                                                                                                                                                                                                                                                'properties' => '<array>',
                                                                                                                                                                                                                                                                'items' => '<unknown>'
                                                                                                                                ]
                                                                ]
                                ],
                                'items' => [
                                                                'enabled_stats' => [
                                                                                                                                
                                                                ],
                                                                'stat_options' => [
                                                                                                                                'histogram' => [
                                                                                                                                                                                                                                                                'max_bins' => 50,
                                                                                                                                                                                                                                                                'overflow' => 'none'
                                                                                                                                ]
                                                                ],
                                                                'self' => [
                                                                                                                                'enabled_stats' => [
                                                                                                                                                                                                                                                                
                                                                                                                                ],
                                                                                                                                'stat_options' => [
                                                                                                                                                                                                                                                                'histogram' => [
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                'max_bins' => 50,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                'overflow' => 'none'
                                                                                                                                                                                                                                                                ]
                                                                                                                                ]
                                                                ],
                                                                'properties' => '<array>',
                                                                'items' => '<unknown>'
                                ]
                ]
        ]
    ]
  ]),
  CURLOPT_HTTPHEADER => [
    "Authorization: Bearer <token>",
    "Content-Type: application/json"
  ],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
package main

import (
"fmt"
"strings"
"net/http"
"io"
)

func main() {

url := "https://api-dev.narrative.io/datasets/{dataset_id}/statistics-configuration"

payload := strings.NewReader("{\n \"defaults\": {\n \"enabled_stats\": [],\n \"stat_options\": {\n \"histogram\": {\n \"max_bins\": 50,\n \"overflow\": \"none\"\n }\n }\n },\n \"refresh\": {\n \"trigger\": \"cron\",\n \"cron_expression\": \"<string>\"\n },\n \"dataset\": {\n \"scope\": {\n \"enabled_stats\": [],\n \"stat_options\": {\n \"histogram\": {\n \"max_bins\": 50,\n \"overflow\": \"none\"\n }\n }\n },\n \"fields\": [\n {\n \"field_name\": \"<string>\",\n \"enabled_stats\": [],\n \"stat_options\": {\n \"histogram\": {\n \"max_bins\": 50,\n \"overflow\": \"none\"\n }\n },\n \"self\": {\n \"enabled_stats\": [],\n \"stat_options\": {\n \"histogram\": {\n \"max_bins\": 50,\n \"overflow\": \"none\"\n }\n }\n },\n \"properties\": [\n {\n \"path\": \"<string>\",\n \"enabled_stats\": [],\n \"stat_options\": {\n \"histogram\": {\n \"max_bins\": 50,\n \"overflow\": \"none\"\n }\n },\n \"self\": {\n \"enabled_stats\": [],\n \"stat_options\": {\n \"histogram\": {\n \"max_bins\": 50,\n \"overflow\": \"none\"\n }\n }\n },\n \"properties\": \"<array>\",\n \"items\": {\n \"enabled_stats\": [],\n \"stat_options\": {\n \"histogram\": {\n \"max_bins\": 50,\n \"overflow\": \"none\"\n }\n },\n \"self\": {\n \"enabled_stats\": [],\n \"stat_options\": {\n \"histogram\": {\n \"max_bins\": 50,\n \"overflow\": \"none\"\n }\n }\n },\n \"properties\": \"<array>\",\n \"items\": \"<unknown>\"\n }\n }\n ],\n \"items\": {\n \"enabled_stats\": [],\n \"stat_options\": {\n \"histogram\": {\n \"max_bins\": 50,\n \"overflow\": \"none\"\n }\n },\n \"self\": {\n \"enabled_stats\": [],\n \"stat_options\": {\n \"histogram\": {\n \"max_bins\": 50,\n \"overflow\": \"none\"\n }\n }\n },\n \"properties\": \"<array>\",\n \"items\": \"<unknown>\"\n }\n }\n ]\n },\n \"rosetta_stone\": {\n \"scope\": {\n \"enabled_stats\": [],\n \"stat_options\": {\n \"histogram\": {\n \"max_bins\": 50,\n \"overflow\": \"none\"\n }\n }\n },\n \"fields\": [\n {\n \"attribute_name\": \"<string>\",\n \"enabled_stats\": [],\n \"stat_options\": {\n \"histogram\": {\n \"max_bins\": 50,\n \"overflow\": \"none\"\n }\n },\n \"self\": {\n \"enabled_stats\": [],\n \"stat_options\": {\n \"histogram\": {\n \"max_bins\": 50,\n \"overflow\": \"none\"\n }\n }\n },\n \"properties\": [\n {\n \"path\": \"<string>\",\n \"enabled_stats\": [],\n \"stat_options\": {\n \"histogram\": {\n \"max_bins\": 50,\n \"overflow\": \"none\"\n }\n },\n \"self\": {\n \"enabled_stats\": [],\n \"stat_options\": {\n \"histogram\": {\n \"max_bins\": 50,\n \"overflow\": \"none\"\n }\n }\n },\n \"properties\": \"<array>\",\n \"items\": {\n \"enabled_stats\": [],\n \"stat_options\": {\n \"histogram\": {\n \"max_bins\": 50,\n \"overflow\": \"none\"\n }\n },\n \"self\": {\n \"enabled_stats\": [],\n \"stat_options\": {\n \"histogram\": {\n \"max_bins\": 50,\n \"overflow\": \"none\"\n }\n }\n },\n \"properties\": \"<array>\",\n \"items\": \"<unknown>\"\n }\n }\n ],\n \"items\": {\n \"enabled_stats\": [],\n \"stat_options\": {\n \"histogram\": {\n \"max_bins\": 50,\n \"overflow\": \"none\"\n }\n },\n \"self\": {\n \"enabled_stats\": [],\n \"stat_options\": {\n \"histogram\": {\n \"max_bins\": 50,\n \"overflow\": \"none\"\n }\n }\n },\n \"properties\": \"<array>\",\n \"items\": \"<unknown>\"\n }\n }\n ]\n }\n}")

req, _ := http.NewRequest("PUT", url, payload)

req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.put("https://api-dev.narrative.io/datasets/{dataset_id}/statistics-configuration")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"defaults\": {\n \"enabled_stats\": [],\n \"stat_options\": {\n \"histogram\": {\n \"max_bins\": 50,\n \"overflow\": \"none\"\n }\n }\n },\n \"refresh\": {\n \"trigger\": \"cron\",\n \"cron_expression\": \"<string>\"\n },\n \"dataset\": {\n \"scope\": {\n \"enabled_stats\": [],\n \"stat_options\": {\n \"histogram\": {\n \"max_bins\": 50,\n \"overflow\": \"none\"\n }\n }\n },\n \"fields\": [\n {\n \"field_name\": \"<string>\",\n \"enabled_stats\": [],\n \"stat_options\": {\n \"histogram\": {\n \"max_bins\": 50,\n \"overflow\": \"none\"\n }\n },\n \"self\": {\n \"enabled_stats\": [],\n \"stat_options\": {\n \"histogram\": {\n \"max_bins\": 50,\n \"overflow\": \"none\"\n }\n }\n },\n \"properties\": [\n {\n \"path\": \"<string>\",\n \"enabled_stats\": [],\n \"stat_options\": {\n \"histogram\": {\n \"max_bins\": 50,\n \"overflow\": \"none\"\n }\n },\n \"self\": {\n \"enabled_stats\": [],\n \"stat_options\": {\n \"histogram\": {\n \"max_bins\": 50,\n \"overflow\": \"none\"\n }\n }\n },\n \"properties\": \"<array>\",\n \"items\": {\n \"enabled_stats\": [],\n \"stat_options\": {\n \"histogram\": {\n \"max_bins\": 50,\n \"overflow\": \"none\"\n }\n },\n \"self\": {\n \"enabled_stats\": [],\n \"stat_options\": {\n \"histogram\": {\n \"max_bins\": 50,\n \"overflow\": \"none\"\n }\n }\n },\n \"properties\": \"<array>\",\n \"items\": \"<unknown>\"\n }\n }\n ],\n \"items\": {\n \"enabled_stats\": [],\n \"stat_options\": {\n \"histogram\": {\n \"max_bins\": 50,\n \"overflow\": \"none\"\n }\n },\n \"self\": {\n \"enabled_stats\": [],\n \"stat_options\": {\n \"histogram\": {\n \"max_bins\": 50,\n \"overflow\": \"none\"\n }\n }\n },\n \"properties\": \"<array>\",\n \"items\": \"<unknown>\"\n }\n }\n ]\n },\n \"rosetta_stone\": {\n \"scope\": {\n \"enabled_stats\": [],\n \"stat_options\": {\n \"histogram\": {\n \"max_bins\": 50,\n \"overflow\": \"none\"\n }\n }\n },\n \"fields\": [\n {\n \"attribute_name\": \"<string>\",\n \"enabled_stats\": [],\n \"stat_options\": {\n \"histogram\": {\n \"max_bins\": 50,\n \"overflow\": \"none\"\n }\n },\n \"self\": {\n \"enabled_stats\": [],\n \"stat_options\": {\n \"histogram\": {\n \"max_bins\": 50,\n \"overflow\": \"none\"\n }\n }\n },\n \"properties\": [\n {\n \"path\": \"<string>\",\n \"enabled_stats\": [],\n \"stat_options\": {\n \"histogram\": {\n \"max_bins\": 50,\n \"overflow\": \"none\"\n }\n },\n \"self\": {\n \"enabled_stats\": [],\n \"stat_options\": {\n \"histogram\": {\n \"max_bins\": 50,\n \"overflow\": \"none\"\n }\n }\n },\n \"properties\": \"<array>\",\n \"items\": {\n \"enabled_stats\": [],\n \"stat_options\": {\n \"histogram\": {\n \"max_bins\": 50,\n \"overflow\": \"none\"\n }\n },\n \"self\": {\n \"enabled_stats\": [],\n \"stat_options\": {\n \"histogram\": {\n \"max_bins\": 50,\n \"overflow\": \"none\"\n }\n }\n },\n \"properties\": \"<array>\",\n \"items\": \"<unknown>\"\n }\n }\n ],\n \"items\": {\n \"enabled_stats\": [],\n \"stat_options\": {\n \"histogram\": {\n \"max_bins\": 50,\n \"overflow\": \"none\"\n }\n },\n \"self\": {\n \"enabled_stats\": [],\n \"stat_options\": {\n \"histogram\": {\n \"max_bins\": 50,\n \"overflow\": \"none\"\n }\n }\n },\n \"properties\": \"<array>\",\n \"items\": \"<unknown>\"\n }\n }\n ]\n }\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api-dev.narrative.io/datasets/{dataset_id}/statistics-configuration")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"defaults\": {\n \"enabled_stats\": [],\n \"stat_options\": {\n \"histogram\": {\n \"max_bins\": 50,\n \"overflow\": \"none\"\n }\n }\n },\n \"refresh\": {\n \"trigger\": \"cron\",\n \"cron_expression\": \"<string>\"\n },\n \"dataset\": {\n \"scope\": {\n \"enabled_stats\": [],\n \"stat_options\": {\n \"histogram\": {\n \"max_bins\": 50,\n \"overflow\": \"none\"\n }\n }\n },\n \"fields\": [\n {\n \"field_name\": \"<string>\",\n \"enabled_stats\": [],\n \"stat_options\": {\n \"histogram\": {\n \"max_bins\": 50,\n \"overflow\": \"none\"\n }\n },\n \"self\": {\n \"enabled_stats\": [],\n \"stat_options\": {\n \"histogram\": {\n \"max_bins\": 50,\n \"overflow\": \"none\"\n }\n }\n },\n \"properties\": [\n {\n \"path\": \"<string>\",\n \"enabled_stats\": [],\n \"stat_options\": {\n \"histogram\": {\n \"max_bins\": 50,\n \"overflow\": \"none\"\n }\n },\n \"self\": {\n \"enabled_stats\": [],\n \"stat_options\": {\n \"histogram\": {\n \"max_bins\": 50,\n \"overflow\": \"none\"\n }\n }\n },\n \"properties\": \"<array>\",\n \"items\": {\n \"enabled_stats\": [],\n \"stat_options\": {\n \"histogram\": {\n \"max_bins\": 50,\n \"overflow\": \"none\"\n }\n },\n \"self\": {\n \"enabled_stats\": [],\n \"stat_options\": {\n \"histogram\": {\n \"max_bins\": 50,\n \"overflow\": \"none\"\n }\n }\n },\n \"properties\": \"<array>\",\n \"items\": \"<unknown>\"\n }\n }\n ],\n \"items\": {\n \"enabled_stats\": [],\n \"stat_options\": {\n \"histogram\": {\n \"max_bins\": 50,\n \"overflow\": \"none\"\n }\n },\n \"self\": {\n \"enabled_stats\": [],\n \"stat_options\": {\n \"histogram\": {\n \"max_bins\": 50,\n \"overflow\": \"none\"\n }\n }\n },\n \"properties\": \"<array>\",\n \"items\": \"<unknown>\"\n }\n }\n ]\n },\n \"rosetta_stone\": {\n \"scope\": {\n \"enabled_stats\": [],\n \"stat_options\": {\n \"histogram\": {\n \"max_bins\": 50,\n \"overflow\": \"none\"\n }\n }\n },\n \"fields\": [\n {\n \"attribute_name\": \"<string>\",\n \"enabled_stats\": [],\n \"stat_options\": {\n \"histogram\": {\n \"max_bins\": 50,\n \"overflow\": \"none\"\n }\n },\n \"self\": {\n \"enabled_stats\": [],\n \"stat_options\": {\n \"histogram\": {\n \"max_bins\": 50,\n \"overflow\": \"none\"\n }\n }\n },\n \"properties\": [\n {\n \"path\": \"<string>\",\n \"enabled_stats\": [],\n \"stat_options\": {\n \"histogram\": {\n \"max_bins\": 50,\n \"overflow\": \"none\"\n }\n },\n \"self\": {\n \"enabled_stats\": [],\n \"stat_options\": {\n \"histogram\": {\n \"max_bins\": 50,\n \"overflow\": \"none\"\n }\n }\n },\n \"properties\": \"<array>\",\n \"items\": {\n \"enabled_stats\": [],\n \"stat_options\": {\n \"histogram\": {\n \"max_bins\": 50,\n \"overflow\": \"none\"\n }\n },\n \"self\": {\n \"enabled_stats\": [],\n \"stat_options\": {\n \"histogram\": {\n \"max_bins\": 50,\n \"overflow\": \"none\"\n }\n }\n },\n \"properties\": \"<array>\",\n \"items\": \"<unknown>\"\n }\n }\n ],\n \"items\": {\n \"enabled_stats\": [],\n \"stat_options\": {\n \"histogram\": {\n \"max_bins\": 50,\n \"overflow\": \"none\"\n }\n },\n \"self\": {\n \"enabled_stats\": [],\n \"stat_options\": {\n \"histogram\": {\n \"max_bins\": 50,\n \"overflow\": \"none\"\n }\n }\n },\n \"properties\": \"<array>\",\n \"items\": \"<unknown>\"\n }\n }\n ]\n }\n}"

response = http.request(request)
puts response.read_body
{
  "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "dataset_id": 123,
  "version": 123,
  "created_at": "2023-11-07T05:31:56Z",
  "created_by": 123,
  "configuration": {
    "defaults": {
      "enabled_stats": [],
      "stat_options": {
        "histogram": {
          "max_bins": 50,
          "overflow": "none"
        }
      }
    },
    "refresh": {
      "trigger": "cron",
      "cron_expression": "<string>"
    },
    "dataset": {
      "scope": {
        "enabled_stats": [],
        "stat_options": {
          "histogram": {
            "max_bins": 50,
            "overflow": "none"
          }
        }
      },
      "fields": [
        {
          "field_name": "<string>",
          "enabled_stats": [],
          "stat_options": {
            "histogram": {
              "max_bins": 50,
              "overflow": "none"
            }
          },
          "self": {
            "enabled_stats": [],
            "stat_options": {
              "histogram": {
                "max_bins": 50,
                "overflow": "none"
              }
            }
          },
          "properties": [
            {
              "path": "<string>",
              "enabled_stats": [],
              "stat_options": {
                "histogram": {
                  "max_bins": 50,
                  "overflow": "none"
                }
              },
              "self": {
                "enabled_stats": [],
                "stat_options": {
                  "histogram": {
                    "max_bins": 50,
                    "overflow": "none"
                  }
                }
              },
              "properties": "<array>",
              "items": {
                "enabled_stats": [],
                "stat_options": {
                  "histogram": {
                    "max_bins": 50,
                    "overflow": "none"
                  }
                },
                "self": {
                  "enabled_stats": [],
                  "stat_options": {
                    "histogram": {
                      "max_bins": 50,
                      "overflow": "none"
                    }
                  }
                },
                "properties": "<array>",
                "items": "<unknown>"
              }
            }
          ],
          "items": {
            "enabled_stats": [],
            "stat_options": {
              "histogram": {
                "max_bins": 50,
                "overflow": "none"
              }
            },
            "self": {
              "enabled_stats": [],
              "stat_options": {
                "histogram": {
                  "max_bins": 50,
                  "overflow": "none"
                }
              }
            },
            "properties": "<array>",
            "items": "<unknown>"
          }
        }
      ]
    },
    "rosetta_stone": {
      "scope": {
        "enabled_stats": [],
        "stat_options": {
          "histogram": {
            "max_bins": 50,
            "overflow": "none"
          }
        }
      },
      "fields": [
        {
          "attribute_name": "<string>",
          "enabled_stats": [],
          "stat_options": {
            "histogram": {
              "max_bins": 50,
              "overflow": "none"
            }
          },
          "self": {
            "enabled_stats": [],
            "stat_options": {
              "histogram": {
                "max_bins": 50,
                "overflow": "none"
              }
            }
          },
          "properties": [
            {
              "path": "<string>",
              "enabled_stats": [],
              "stat_options": {
                "histogram": {
                  "max_bins": 50,
                  "overflow": "none"
                }
              },
              "self": {
                "enabled_stats": [],
                "stat_options": {
                  "histogram": {
                    "max_bins": 50,
                    "overflow": "none"
                  }
                }
              },
              "properties": "<array>",
              "items": {
                "enabled_stats": [],
                "stat_options": {
                  "histogram": {
                    "max_bins": 50,
                    "overflow": "none"
                  }
                },
                "self": {
                  "enabled_stats": [],
                  "stat_options": {
                    "histogram": {
                      "max_bins": 50,
                      "overflow": "none"
                    }
                  }
                },
                "properties": "<array>",
                "items": "<unknown>"
              }
            }
          ],
          "items": {
            "enabled_stats": [],
            "stat_options": {
              "histogram": {
                "max_bins": 50,
                "overflow": "none"
              }
            },
            "self": {
              "enabled_stats": [],
              "stat_options": {
                "histogram": {
                  "max_bins": 50,
                  "overflow": "none"
                }
              }
            },
            "properties": "<array>",
            "items": "<unknown>"
          }
        }
      ]
    }
  }
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Path Parameters

dataset_id
integer
required

Unique identifier for a dataset.

Body

application/json

Configuration payload for computing statistics on dataset fields and Rosetta Stone attributes. Supports recursive nesting for arbitrarily deep schemas.

Inheritance chain

defaults → namespace scope → field override → nested node overrides.

Two distinct inheritance rules apply depending on what is being configured:

1. Stat set (enabled_stats) — all-or-nothing per level

When a level provides enabled_stats, it completely replaces the parent's stat set. There is no merging: the child's list is the final set of stats for that scope. Properties not listed in a parent's properties array receive no stats — they are not inherited from any parent level. Example: an object field address has children city, zip, and state. If the field config lists only city in properties, then zip and state get no stats at all, regardless of what defaults or scope say.

2. Stat options (stat_options) — partial override with per-property inheritance

When a level provides only stat_options (without enabled_stats), it inherits the stat set from its parent and applies option overrides on top. Individual option properties follow a granular rule: only explicitly provided option properties are overridden; unspecified properties keep the value resolved from the parent level. Example: defaults enable histogram with max_bins: 50, overflow: none. A namespace scope provides stat_options: { histogram: { max_bins: 200 } } without enabled_stats. The resolved scope inherits the full stat set from defaults, and the histogram options become max_bins: 200, overflow: noneoverflow was not overridden, so the parent's value (none) is preserved.

Chained stat_options overrides across levels

Per-property inheritance applies at every level of the chain, and each level inherits from its resolved parent — not from the original defaults. This means overrides accumulate. Example — scope overrides max_bins, field overrides overflow:

"defaults": {
"enabled_stats": ["value_count", "histogram"],
"stat_options": { "histogram": { "max_bins": 50 } }
},
"refresh": { "trigger": "manual" },
"dataset": {
"scope": {
"stat_options": { "histogram": { "max_bins": 200 } }
},
"fields": [
{
"field_name": "price",
"stat_options": { "histogram": { "overflow": "truncate" } }
}
]
}
} ```
Resolution for `price`:
1. **defaults** → `histogram(max_bins=50, overflow=none)`
2. **scope** (stat_options only, inherits defaults) → `histogram(max_bins=200, overflow=none)` —
scope overrides `max_bins` to 200; `overflow` is not specified, so it keeps defaults' `none`.

3. **price field** (stat_options only, inherits resolved scope) → `histogram(max_bins=200, overflow=truncate)` —
field overrides `overflow` to `truncate`; `max_bins` is not specified, so it keeps scope's `200` (not
defaults' `50`).

The key point: `price` gets `max_bins=200` from scope, not `max_bins=50` from defaults. Each level inherits from its immediate resolved parent, not from the root.
The same per-property inheritance applies at nested levels (object properties, array items). A deeply nested node that provides only `stat_options` inherits the stat set and unspecified option properties from the effective parent resolved at the namespace level (defaults + scope).
defaults
object
required

Global default stat configuration applied to all eligible fields and properties. The server automatically filters stats incompatible with a field's resolved type and node kind. Note: enabled_stats is required for defaults because there is no parent scope to inherit from. Providing only stat_options without enabled_stats is invalid at this level.

refresh
object
required

When to recompute statistics. Exactly one trigger type must be specified.

dataset
object

Configuration for dataset schema columns. Use 'scope' to override defaults for all dataset fields, or to disable the namespace entirely via enabled_stats: []. Use 'fields' for per-field overrides.

rosetta_stone
object

Configuration for Rosetta Stone attributes. Use 'scope' to override defaults for all Rosetta Stone fields, or to disable the namespace entirely via enabled_stats: []. Use 'fields' for per-field overrides.

Response

200 - application/json

OK

Full statistics configuration entity with metadata. Returned by both PUT (create/update) and GET endpoints.

id
string<uuid>
required

Unique identifier for this configuration version.

dataset_id
integer<int64>
required

The dataset this configuration belongs to.

version
integer<int32>
required

Monotonically increasing version number.

created_at
string<date-time>
required

Timestamp when this configuration version was created.

created_by
integer<int64>
required

User ID of the user who created this configuration version.

configuration
object
required

The full statistics configuration payload.