Skip to main content

How to Change the Port and Host of the Apache Airflow® API Server

· 5 min read
Jagdish Kumawat
Founder @ Dewiride

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:

airflow.cfg
[api]
host = <address>
port = <port>

Or for one terminal, as environment variables:

Syntax
export AIRFLOW__API__HOST=<address>
export AIRFLOW__API__PORT=<port>
PartWhat it means
[api]The section of airflow.cfg for the API server
hostThe 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
portThe port number. The default is 8080
AIRFLOW__API__PORTThe 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_HOME set to the folder that holds your airflow.cfg.

Step 1: See the Current Values​

Terminal
airflow config get-value api host
airflow config get-value api port
Output
0.0.0.0
8080

The terminal: airflow config get-value api host prints 0.0.0.0 and api port prints 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:

airflow.cfg (in the [api] section)
# 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.

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:

Terminal
airflow config get-value api host
airflow config get-value api port
Output
127.0.0.1
8086

Step 3: Start Airflow on the New Address​

Terminal
airflow standalone
Output (excerpt)
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:

Terminal
curl -s http://127.0.0.1:8086/api/v2/version
Output
{"version":"3.4.0","git_version":".release:619a787ac81e8b7c8a9102fc78e3f0b00625d04e"}

The second terminal: curl to /api/v2/version on http://127.0.0.1:8086 returns version 3.4.0.

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:

Terminal
AIRFLOW__API__PORT=8087 airflow config get-value api port
Output
8087

The terminal: with AIRFLOW__API__PORT=8087 in front of the command, airflow config get-value api port prints 8087 instead of the 8086 in the file.

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​

MistakeWhat happensDo this instead
Changing port in [opensearch]The API server stays on 8080Edit the keys in [api]
One underscore in the variable: AIRFLOW_API_PORTAirflow ignores itTwo underscores around the section: AIRFLOW__API__PORT

Troubleshooting​

SymptomLikely causeFix
get-value still prints 8080The edit is in another section, or another airflow.cfg is in useCheck echo $AIRFLOW_HOME and the [api] section
The value isn't what the file saysAn AIRFLOW__API__… variable is set in this terminalenv | 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​

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.