Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Data Days is here! Join us now for 60+ days of learning, challenges, and connection. Learn more

Reply
saritboo
Frequent Visitor

DAGRun via API

Hi, 

 

I am trying to find out how to run Airflow DAG via API call.

 

When I called an API from swagger UI page, it works properly. (using /connection api as example for simplicity)

 

saritboo_0-1732612968057.png

 

However, if I called the same API from shell script or postman, it will always redirect me to microsoft login page.

Is there a way to authenticate using shell script or do I need to change airflow Configuration Overrides to allow basic authentication (if possible)?

 

saritboo_2-1732613126774.png

 

 

Is it currently possible to run a DAG from a REST API call using basic authen or is there a way to authenticate using shell script ?

2 REPLIES 2
saritboo
Frequent Visitor

Hi @Anonymous 

 

It seems like that AIRFLOWAPIAUTH_BACKEND is default to airflow.api.auth.backend.basic_auth (assuming if it is the same config as auth_backend)

 

I also tried to modify configuration overrides with 

AIRFLOW__API__AUTH_BACKENDS : airflow.api.auth.backend.basic_auth

but it doesn't seems to work, I am not sure if I am doing it right.

 

saritboo_0-1732681429480.png

 

I cannot find any document related to API setting for Fabric Airflow. Hope for more tutorial on this soon.

 

reference:

https://learn.microsoft.com/en-us/fabric/data-factory/apache-airflow-jobs-supported-apache-airflow-c...

https://airflow.apache.org/docs/apache-airflow/stable/configurations-ref.html#auth-backends

Anonymous
Not applicable

Hi @saritboo 

 

Modify the 'airflow.cfg' file to enable basic authentication. You need to set the 'auth_backend' to 'airflow.api.auth.backend.basic_auth'. This allows you to use basic authentication for API calls.

[api]
auth_backend = airflow.api.auth.backend.basic_auth

Ensure you have a user created in Airflow with the necessary permissions to trigger DAGs.

When making API calls from a shell script or Postman, include the 'Authorization' header with the base64 encoded username and password. Here’s an example using 'curl'

curl -X POST "http://your-airflow-url/api/v1/dags/your_dag_id/dagRuns" \
-H "Authorization: Basic $(echo -n 'username:password' | base64)" \
-H "Content-Type: application/json" \
-d '{"conf": {"key": "value"}}'

By following these steps, you should be able to authenticate and run Airflow DAGs via API calls without being redirected to the Microsoft login page

 

Here's the link for your reference:

API Authentication — apache-airflow-providers-fab Documentation

API — Airflow Documentation

 

 

Best Regards

Zhengdong Xu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Fabric Data Days is here Carousel

Fabric Data Days 2026

Don't miss out on Data Days, June 15 through August 7. Learn Fabric, Power BI, SQL, AI and more.

June Fabric Update Carousel

Fabric Monthly Update - June 2026

Check out the June 2026 Fabric update to learn about new features.