How to Change the Port and Host of the Apache Airflow® API Server
Apache Airflow® serves its UI and REST API from the API server, on port 8080 and on every network address of your computer by default. Port 8080 is a popular one, so it's often taken by another program, and "every address" is more than a local setup needs. Two settings in the [api] section of airflow.cfg change both. This guide moves the API server to 127.0.0.1:8086 on Airflow 3.4.0.
Syntax
In airflow.cfg:
[api]
host = <address>
port = <port>
Or for one terminal, as environment variables:
export AIRFLOW__API__HOST=<address>
export AIRFLOW__API__PORT=<port>
| Part | What it means |
|---|---|
[api] | The section of airflow.cfg for the API server |
host | The address the server listens on. The default 0.0.0.0 means every address of the computer; 127.0.0.1 means the computer itself only |
port | The port number. The default is 8080 |
AIRFLOW__API__PORT | The same setting as an environment variable: AIRFLOW__, the section, two underscores, the key |
Airflow's configuration guide names the variables AIRFLOW__{SECTION}__{KEY} "(note the double underscores)", and lists an environment variable first in its order of precedence, ahead of airflow.cfg.
Prerequisites
- Apache Airflow® installed, with
AIRFLOW_HOMEset to the folder that holds yourairflow.cfg.
Step 1: See the Current Values
airflow config get-value api host
airflow config get-value api port
0.0.0.0
8080

These are the defaults. (Every airflow command also prints two FileType is deprecated warnings on Python 3.14; I left them out.)
Step 2: Edit airflow.cfg
Open airflow.cfg from your AIRFLOW_HOME folder in an editor and find the line [api]; in mine it's line 1401. Further down in that section are host and port, each under a comment that also names its environment variable. Change them:
# The ip specified when starting the api server
#
# Variable: AIRFLOW__API__HOST
#
host = 127.0.0.1
# The port on which to run the api server
#
# Variable: AIRFLOW__API__PORT
#
port = 8086
![The [api] section of airflow.cfg with host = 127.0.0.1 and port = 8086, each under its comment naming the AIRFLOW__API__HOST and AIRFLOW__API__PORT variables.](https://strdewiridedevblogsprod.blob.core.windows.net/images/blog/data-engineering/apache-airflow/2026/airflow-port-02-cfg.webp)
Change them in [api] only. The [elasticsearch] and [opensearch] sections further down have host and port keys of their own, for sending logs to those services.
Check the result:
airflow config get-value api host
airflow config get-value api port
127.0.0.1
8086
Step 3: Start Airflow on the New Address
airflow standalone
api-server | 2026-12-01T05:15:57.811002Z [info ] Uvicorn running on http://127.0.0.1:8086 (Press CTRL+C to quit) [uvicorn.error] loc=server.py:234
...
standalone | Airflow is ready
In a second terminal, ask the API for its version:
curl -s http://127.0.0.1:8086/api/v2/version
{"version":"3.4.0","git_version":".release:619a787ac81e8b7c8a9102fc78e3f0b00625d04e"}

The API server listens on 127.0.0.1:8086, and the UI is at http://127.0.0.1:8086. You don't have to change anything else for tasks: in Airflow 3.4.0 the address tasks use to reach the API server, [core] execution_api_server_url, is built from [api] port by default.
Step 4: Override It for One Terminal
An environment variable wins over airflow.cfg:
AIRFLOW__API__PORT=8087 airflow config get-value api port
8087

Writing the variable in front of a command sets it for that one command. export sets it for the rest of the terminal session. Either way it beats the file, which is useful for a quick test without editing anything.
Common Mistakes
| Mistake | What happens | Do this instead |
|---|---|---|
Changing port in [opensearch] | The API server stays on 8080 | Edit the keys in [api] |
One underscore in the variable: AIRFLOW_API_PORT | Airflow ignores it | Two underscores around the section: AIRFLOW__API__PORT |
Troubleshooting
| Symptom | Likely cause | Fix |
|---|---|---|
get-value still prints 8080 | The edit is in another section, or another airflow.cfg is in use | Check echo $AIRFLOW_HOME and the [api] section |
| The value isn't what the file says | An AIRFLOW__API__… variable is set in this terminal | env | grep AIRFLOW__ |
FAQ
Which port should I pick?
Any port that no other program on your computer uses, such as 8085 or 8086.
Is 127.0.0.1 enough on my own computer?
Yes, for a browser on the same computer. Keep 0.0.0.0 only if another device has to reach the UI.
Where is airflow.cfg?
In your AIRFLOW_HOME folder, or in ~/airflow if you never set it.
Conclusion
airflow config get-value showed the defaults 0.0.0.0 and 8080. Two edits in the [api] section changed them to 127.0.0.1 and 8086, standalone started its API server on http://127.0.0.1:8086, and curl got the version back from that address. AIRFLOW__API__PORT overrides the file for one terminal.
Additional Resources
- Configuration reference: [api] — every API server setting.
- Setting configuration options — environment variables and their precedence.
Apache®, Apache Airflow and Airflow® are either registered trademarks or trademarks of The Apache Software Foundation in the United States and/or other countries. No endorsement by The Apache Software Foundation is implied by the use of these marks.
