# Preview a datafeed **POST /_ml/datafeeds/{datafeed_id}/_preview** **All methods and paths for this operation:**
GET /_ml/datafeeds/_preview
POST /_ml/datafeeds/_preview
GET /_ml/datafeeds/{datafeed_id}/_preview
POST /_ml/datafeeds/{datafeed_id}/_preview
This API returns the first "page" of search results from a datafeed. You can preview an existing datafeed or provide configuration details for a datafeed and anomaly detection job in the API. The preview shows the structure of the data that will be passed to the anomaly detection engine. IMPORTANT: When Elasticsearch security features are enabled, the preview uses the credentials of the user that called the API. However, when the datafeed starts it uses the roles of the last user that created or updated the datafeed. To get a preview that accurately reflects the behavior of the datafeed, use the appropriate credentials. You can also use secondary authorization headers to supply the credentials. ## Required authorization * Index privileges: `read` * Cluster privileges: `manage_ml` ## Servers - http://api.example.com: http://api.example.com () ## Authentication methods - Api key auth ## Parameters ### Path parameters - **datafeed_id** (string) A numerical character string that uniquely identifies the datafeed. This identifier can contain lowercase alphanumeric characters (a-z and 0-9), hyphens, and underscores. It must start and end with alphanumeric characters. NOTE: If you use this path parameter, you cannot provide datafeed or anomaly detection job configuration details in the request body. ### Query parameters - **start** (string | number) The start time from where the datafeed preview should begin - **end** (string | number) The end time when the datafeed preview should stop ### Body: application/json (object) - **datafeed_config** (object) The datafeed definition to preview. - **job_config** (object) The configuration details for the anomaly detection job that is associated with the datafeed. If the `datafeed_config` object does not include a `job_id` that references an existing anomaly detection job, you must supply this `job_config` object. If you include both a `job_id` and a `job_config`, the latter information is used. You cannot specify a `job_config` object unless you also supply a `datafeed_config` object. ## Responses ### 200 #### Body: application/json (array[object]) [Powered by Bump.sh](https://bump.sh)