Cannot set data_file when creating an export template with the REST API
Author: ylebreCreated Sep 17, 2026Updated Sep 17, 2026
Labelstype: bugstatus: acceptedseverity: lownetbox
NetBox Edition
NetBox Community
NetBox Version
4.6.5 4.7.1
Python Version
3.12
Steps to Reproduce
- Create a data source with data files in it.
- do a REST API call on export-templates with this payload:
{
"name": "billing",
"slug": "billing",
"data_source": 1,
"data_file": 3,
"auto_sync_enabled": true,
"object_types": [
"dcim.device"
],
"mime_type": "application/json",
"file_name": "billing",
"file_extension": "json",
"as_attachment": true,
"template_code": "{# #}"
}Expected Behavior
I expected an export template to be created with the data source, data file configured, that syncs the template_code from the file.
Observed Behavior
An export template was created with the 'dummy' template code. The data source is configured, but the data file is not, and the auto_sync_enabled flag is not turned on.
Suspected Cause
When checking the OPTIONS call to the export-templates endpoint, it seems that the data_file is a read_only field:
... "data_file":{"type":"nested object","required":false,"read_only":true,"label":"Data file", ...Proposed Fix
No response
Source: netbox-community/netbox