Try:

prometheus:
   container_name: prometheus
   image: "prom/prometheus:latest"
   user: "1000"
   networks:
     - observability
   ports:
     - "9090:9090"
   volumes:
     - ./prometheus:/etc/prometheus
     - /data/prometheus:/var/lib/prometheus
   command:
     - --config.file=/etc/prometheus/prometheus.yml
     - --storage.tsdb.path=/var/lib/prometheus
     - --web.enable-admin-api
   restart: unless-stopped

The command property takes a YAML list of values.

Each value must be indicated using a hyphen (- {value}).

The list values are double-hyphen flags (--web.enable-admin-api).

Alternatively, you can use the JSON variant which I've spread over multiple lines but can also be presented as a single line:

command: [
  "--config.file=...",
  "--storage.tsdb.path=...",
  "--web.enable-admin-api"
] 
Answer from DazWilkin on Stack Overflow
🌐
Prometheus
prometheus.io › docs › operating › security
Security model | Prometheus
The --web.enable-admin-api flag controls access to the administrative HTTP API, which includes functionality such as wiping all the existing metric groups. This is disabled by default.
Discussions

How to pass '--web.enable-admin-api' flag to prometheus container
I am using Prometheus-Operator release-0.17. In kube-prometheus/manifests/prometheus/prometheus-k8s.yaml , how do i pass the flag '--web.enable-admin-api' to prometheus container. More on github.com
🌐 github.com
1
July 20, 2018
--web.enable-admin-api doesn't exist.
Bug Report What did you do? I tried to use option --web.enable-admin-api What did you expect to see? I expect it to work What did you see instead? Under which circumstances? pushgateway: error: unk... More on github.com
🌐 github.com
3
October 10, 2019
Problem to enable api in Prometheus
In the first step I have to activate the web api function. When I type in the command "prometheus --web.enable-admin-api to the console" I get the attached output. More on github.com
🌐 github.com
4
May 21, 2020
Website --web.enable-admin-api confusion
Thanos, Prometheus and Golang version used: Thanos: v0.15 Prometheus: 2.21 In multiple places, including the sidecar docs, I have seen the following statement. The --web.enable-admin-api flag is en... More on github.com
🌐 github.com
8
October 6, 2020
🌐
Prometheus
prometheus.io › docs › prometheus › latest › querying › api
HTTP API | Prometheus
These are APIs that expose database functionalities for the advanced user. These APIs are not enabled unless the --web.enable-admin-api is set.
🌐
GitHub
github.com › prometheus-operator › prometheus-operator › issues › 1654
How to pass '--web.enable-admin-api' flag to prometheus container · Issue #1654 · prometheus-operator/prometheus-operator
July 20, 2018 - I am using Prometheus-Operator release-0.17. In kube-prometheus/manifests/prometheus/prometheus-k8s.yaml , how do i pass the flag '--web.enable-admin-api' to prometheus container.
Author: prometheus-operator
🌐
Red Hat
access.redhat.com › solutions › 7098987
Enable --web.enable-admin-api for user-workload-monitoring Prometheus in RHOCP 4 - Red Hat Customer Portal
Not able to delete time series in the User Workload Monitoring Prometheus as it's not enabled the flag --web.enable-admin-api that controls access to the administrative HTTP API Returned an "unavailable" message when running administrative tasks against the User Workload Monitoring Prometheus ...
🌐
Red Hat
bugzilla.redhat.com › show_bug.cgi
2026844 – [ceph-dashboard] enable --web.enable-admin-api flag while starting the prometheus service to enable taking snapshots
Red Hat Bugzilla – Bug 2026844 · This site requires JavaScript to be enabled to function correctly, please enable it · Privacy Contact FAQ Legal
🌐
GitHub
github.com › prometheus › pushgateway › issues › 294
--web.enable-admin-api doesn't exist. · Issue #294 · prometheus/pushgateway
October 10, 2019 - pushgateway: error: unknown long flag '--web.enable-admin-api', try --help Environment Linux
Author: prometheus
🌐
Robust Perception
robustperception.io › new-features-in-prometheus-2-0-0
New Features in Prometheus 2.0.0 – Robust Perception | Prometheus Monitoring Experts
For security reasons the admin and lifecycle APIs are now disabled by default. You can reenable them with the --web.enable-admin-api and --web.enable-lifecycle flags. Speaking of flags, Kingpin is now in use so all flags are prefixed with double rather than single hyphens.
Find elsewhere
🌐
JFrog
jfrog.com › blog home › don’t let prometheus steal your fire
Protecting Prometheus: Insecure configuration exposes secrets
May 1, 2026 - Other than the issue of sensitive data exposure due to developers’ and organizations’ non-secure deployments of Prometheus, it is important to mention an even bigger potential security issue – Prometheus provides an optional management API which can be enabled via the command line flags web.enable-admin-api and web.enable-lifecycle.
🌐
Medium
blog.fourninecloud.com › what-is-prometheus-and-how-to-install-and-configure-it-on-linux-server-9b5f88685451
Prometheus — How to install and configure it on a Linux server. | by Arun Kumar Peddapalli | Fournine Cloud
August 30, 2022 - — config.file the directory ... these endpoints are disabled by default for security reasons in Prometheus 2.0. To enable them, set the — web.enable-lifecycle flag — web.enable-admin-api controls access to the administrative HTTP API...
🌐
Ubuntu Manpages
manpages.ubuntu.com › manpages › focal › man1 › prometheus.1.html
Ubuntu Manpage: prometheus - The Prometheus monitoring server
--web.local-assets="/usr/share... --web.enable-lifecycle Enable shutdown and reload via HTTP request. --web.enable-admin-api Enable API endpoints for admin control actions....
🌐
GitHub
github.com › prometheus › prometheus › discussions › 10069
can't enable admin api on docker deployment · prometheus/prometheus · Discussion #10069
What did you do? i've added the ​"--web.enable-admin-api" api in my docker-compose file version: '3.7' services: prometheus: image: prom/prometheus:latest volumes: - /opt/prom...
Author: prometheus
🌐
GitHub
github.com › coreos › prometheus-operator › issues › 3238
Problem to enable api in Prometheus · Issue #3238 · prometheus-operator/prometheus-operator
May 21, 2020 - In the first step I have to activate the web api function. When I type in the command "prometheus --web.enable-admin-api to the console" I get the attached output.
Author: prometheus-operator
🌐
Sungup
sungup.github.io › 2019 › 12 › 25 › Delete-unwanted-time-seriese-on-Prometheus.html
Delete unwanted timeseriese on Prometheus | Sungup’s DevLog
December 25, 2019 - To enable admin api, modify service script file at /etc/systemd/system/prometheus.service. Open and add --web.enable-admin-api argument at the end of ExecStart value.
🌐
GitHub
github.com › thanos-io › thanos › issues › 3278
Website --web.enable-admin-api confusion · Issue #3278 · thanos-io/thanos
October 6, 2020 - The --web.enable-admin-api flag is enabled to support sidecar to get metadata from Prometheus like external labels.
Author: thanos-io
🌐
DevOpsSchool
devopsschool.com › commands › tools › prometheus › prometheus
prometheus's Examples
If the URL has a path portion, it will be used to prefix all HTTP endpoints served by Prometheus. If omitted, relevant URL components will be derived automatically. ... Prefix for the internal routes of web endpoints. Defaults to path of --web.external-url. ... Path to static asset directory, available at /user. ... Enable shutdown and reload via HTTP request. ... Enable API endpoints for admin control actions.
🌐
Google Groups
groups.google.com › g › prometheus-users › c › AVvsuRq5Gbo
delete metrics from prometheus 2.0
Looks like you forgot to enable admin API. Quote from manual (https://prometheus.io/docs/operating/security/): As of Prometheus 2.0, the --web.enable-admin-api flag controls access to the administrative HTTP API which includes functionality such as deleting time series.
🌐
Prometheus
discuss.prometheus.io › general help/support
I want to enable web app admin api from docker file - General Help/Support - Prometheus Monitoring System
November 30, 2022 - I need to use backup and rotation settings for prometheus.I am running prometheus on ecs server using docker file.Any suggestions how can we do that?
🌐
Debian Manpages
manpages.debian.org › stretch-backports › prometheus › prometheus(1)
prometheus(1) — prometheus — Debian stretch-backports — Debian Manpages
August 5, 2018 - If the URL has a path portion, it will be used to prefix all HTTP endpoints served by Prometheus. If omitted, relevant URL components will be derived automatically. ... Prefix for the internal routes of web endpoints. Defaults to path of --web.external-url. ... Path to static asset/templates directory. ... Path to user asset directory, available at /user. ... Enable shutdown and reload via HTTP request. ... Enable API endpoints for admin control actions.
🌐
DevOps.dev
blog.devops.dev › setting-up-configurations-with-the-prometheus-stack-part-2-23f656f15e2b
Setting Up Configurations with the Prometheus Stack (Part 2) | by Anil Raj Rimal | DevOps.dev
February 6, 2025 - The prometheus_api file enables the Prometheus admin API, allowing access to administrative endpoints for configuration and troubleshooting.