> For the complete documentation index, see [llms.txt](https://docs.facephi.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.facephi.com/docs.facephi-en/sdks/backend-sdk/ocr/technical_documentation/api_reference/management/api-v1-config-1.md).

# /api/v1/config

Updates the service configuration in memory. The `config_json_string` field contains, serialized as a JSON string, the parameters to modify; those not included keep their value.

Not all the parameters returned by `GET /api/v1/config` can be modified with this endpoint. The following table shows the access level of each one:

| Parameter                               | Access         |
| --------------------------------------- | -------------- |
| `config_path`                           | Read and write |
| `templates_path`                        | Read and write |
| `document_interpreter_version`          | Read and write |
| `document_interpreter_use_universal`    | Read and write |
| `global_threads_pool_size`              | Read and write |
| `max_inference_threads`                 | Read and write |
| `ocr_latin_batch_size`                  | Read and write |
| `metrics_saturation_queue_p95_ms`       | Read and write |
| `metrics_saturation_min_inflight_ratio` | Read and write |
| `metrics_error_rate_warning`            | Read and write |
| `metrics_idle_rps_threshold`            | Read and write |
| `metrics_quality_alert_window_seconds`  | Read and write |
| `port`                                  | Read-only      |
| `number_of_threads`                     | Read-only      |
| `connection_timeout`                    | Read-only      |
| `keep_alive_request_number`             | Read-only      |
| `client_max_body_size`                  | Read-only      |
| `logger_path`                           | Read-only      |
| `logger_file_prefix`                    | Read-only      |
| `logger_level`                          | Read-only      |
| `logger_rotation`                       | Read-only      |
| `logger_max_files`                      | Read-only      |
| `metrics_enabled`                       | Read-only      |
| `processor_threads_pool_size`           | Read-only      |
| `pipeline_threads_pool_size`            | Read-only      |

* Read-write parameters are applied without restarting the service. If the equivalent environment variable is defined (for example, `FACEPHI_OCR_REST_METRICS_ERROR_RATE_WARNING`), its value takes precedence over the one sent.
* `config_path` reloads the models from `<config_path>/models`. `templates_path` changes the templates of the version 1 interpreter and of invoice processing; the version 2 interpreter and `/api/v1/process_multi` keep using the templates loaded at startup.
* Each successful update reloads the processing models, so it is recommended to perform it when the service is not processing documents.
* The `metrics_*` parameters are the thresholds `GET /api/v1/metrics` uses to classify the service status.
* Read-only parameters are only configured at startup, through `config.json` or the `FACEPHI_OCR_REST_*` environment variables. If they are sent to this endpoint, the request responds 200 and `GET` returns the value sent, but the service keeps using the value it started with.
* `GET` returns the values defined in `config.json` and those sent to this endpoint; it does not reflect values set through environment variables.
* Changes are not saved to `config.json` and are lost when the service restarts.
* JWT authentication settings (`auth_*`) are startup-only: `GET` does not return them and this endpoint rejects with 400 the requests that include them.

```json
{"openapi":"3.0.0","info":{"title":"OCR Service Rest API","version":"2.18.2"},"servers":[{"url":"http://127.0.0.1:6982/"}],"security":[{"BearerAuth":[]},{"ApiKeyAuth":[]}],"components":{"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT"},"ApiKeyAuth":{"type":"apiKey","in":"header","name":"x-api-key","description":"Default name of the API key header. It can be overridden at startup with `auth_api_key_header_name`."}},"schemas":{"ConfigBody":{"type":"object","description":"Body for the configuration request. This endpoint does not accept JWT authentication settings.","properties":{"config_json_string":{"type":"string","description":"JSON string with the configuration parameters to modify. Only the read-write parameters listed in `POST /api/v1/config` are applied."}},"required":["config_json_string"]},"BadRequestResult":{"type":"object","description":"Result when incorrect parameters are received in the request.","properties":{"status":{"type":"number"},"error":{"type":"string"},"message":{"type":"string"},"timeStamp":{"$ref":"#/components/schemas/TimeStamp"}}},"TimeStamp":{"type":"string","description":"A date/time value in format \"%Y-%m-%dT%H:%M:%SZ\"."},"ExceptionResult":{"type":"object","description":"An error occurred in the call to the OCR-SDK backend.","properties":{"status":{"type":"number"},"error":{"type":"string"},"exception":{"type":"string"},"timeStamp":{"$ref":"#/components/schemas/TimeStamp"}}}}},"paths":{"/api/v1/config":{"post":{"description":"Updates the service configuration in memory. The `config_json_string` field contains, serialized as a JSON string, the parameters to modify; those not included keep their value.\n\nNot all the parameters returned by `GET /api/v1/config` can be modified with this endpoint. The following table shows the access level of each one:\n\n| Parameter | Access |\n|---|---|\n| `config_path` | Read and write |\n| `templates_path` | Read and write |\n| `document_interpreter_version` | Read and write |\n| `document_interpreter_use_universal` | Read and write |\n| `global_threads_pool_size` | Read and write |\n| `max_inference_threads` | Read and write |\n| `ocr_latin_batch_size` | Read and write |\n| `metrics_saturation_queue_p95_ms` | Read and write |\n| `metrics_saturation_min_inflight_ratio` | Read and write |\n| `metrics_error_rate_warning` | Read and write |\n| `metrics_idle_rps_threshold` | Read and write |\n| `metrics_quality_alert_window_seconds` | Read and write |\n| `port` | Read-only |\n| `number_of_threads` | Read-only |\n| `connection_timeout` | Read-only |\n| `keep_alive_request_number` | Read-only |\n| `client_max_body_size` | Read-only |\n| `logger_path` | Read-only |\n| `logger_file_prefix` | Read-only |\n| `logger_level` | Read-only |\n| `logger_rotation` | Read-only |\n| `logger_max_files` | Read-only |\n| `metrics_enabled` | Read-only |\n| `processor_threads_pool_size` | Read-only |\n| `pipeline_threads_pool_size` | Read-only |\n\n- Read-write parameters are applied without restarting the service. If the equivalent environment variable is defined (for example, `FACEPHI_OCR_REST_METRICS_ERROR_RATE_WARNING`), its value takes precedence over the one sent.\n- `config_path` reloads the models from `<config_path>/models`. `templates_path` changes the templates of the version 1 interpreter and of invoice processing; the version 2 interpreter and `/api/v1/process_multi` keep using the templates loaded at startup.\n- Each successful update reloads the processing models, so it is recommended to perform it when the service is not processing documents.\n- The `metrics_*` parameters are the thresholds `GET /api/v1/metrics` uses to classify the service status.\n- Read-only parameters are only configured at startup, through `config.json` or the `FACEPHI_OCR_REST_*` environment variables. If they are sent to this endpoint, the request responds 200 and `GET` returns the value sent, but the service keeps using the value it started with.\n- `GET` returns the values defined in `config.json` and those sent to this endpoint; it does not reflect values set through environment variables.\n- Changes are not saved to `config.json` and are lost when the service restarts.\n- JWT authentication settings (`auth_*`) are startup-only: `GET` does not return them and this endpoint rejects with 400 the requests that include them.\n","tags":["Management"],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConfigBody"}}},"required":true},"responses":{"200":{"description":"Message with the result of the operation.","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}}}}}},"400":{"description":"Incorrect parameters were received in the request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BadRequestResult"}}}},"500":{"description":"An error occurred in the call to the OCR-SDK backend.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExceptionResult"}}}}}}}}}
```
