# Any way to edit Orthanc config file programmatically?

**URL:** https://discourse.orthanc-server.org/t/any-way-to-edit-orthanc-config-file-programmatically/3433
**Category:** General
**Created:** [April 21, 2023, 2:46pm UTC](https://discourse.orthanc-server.org/t/any-way-to-edit-orthanc-config-file-programmatically/3433 "2023-04-21T14:46:25Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![ranasrule](https://discourse.orthanc-server.org/letter_avatar_proxy/v4/letter/r/3e96dc/32.png) [@ranasrule](https://discourse.orthanc-server.org/u/ranasrule)
#### Post date: [April 21, 2023, 2:46pm UTC](https://discourse.orthanc-server.org/t/any-way-to-edit-orthanc-config-file-programmatically/3433/1 "2023-04-21T14:46:25Z")

</div>

Hello,

Does anyone know of a way to edit the Orthanc config file programmatically specially things like adding/editing/deleting modalities and other things like this ?

---

<div class="post-metadata">

### Author: ![benjamin.golinvaux](https://discourse.orthanc-server.org/user_avatar/discourse.orthanc-server.org/benjamin.golinvaux/32/1508_2.png) [@benjamin.golinvaux](https://discourse.orthanc-server.org/u/benjamin.golinvaux)
#### Post date: [April 21, 2023, 3:45pm UTC](https://discourse.orthanc-server.org/t/any-way-to-edit-orthanc-config-file-programmatically/3433/2 "2023-04-21T15:45:11Z")

</div>

Modalities can be dynamically configured. Please see `DicomModalitiesInDatabase` in the configuration and [the relevant REST API doc](https://api.orthanc-server.com/#tag/Networking/paths/~1modalities~1%7Bid%7D/put)

Also, there is a generic example that shows how to download and modify the configuration file and instruct Orthanc to restart to start using the new file [in the Orthanc Setup Samples](https://bitbucket.org/osimis/orthanc-setup-samples/src/97f391dee960dac71738d998759cd08c6cf7e588/docker/lua-download-config-and-restart/)

HTH
