# Create NetBox API Token for Airflow

### Introduction

This task will provision an API key in NetBox to allow Netos Pod (Airflow) to pull and push data into NetBox. The playbook will perform the following steps:

1. Create a NetBox user called `airflow_api` with a `superuser` role.
2. Generate an API key for the airflow\_api user (meaning that any updates from Airflow are clearly attributed to Airflow, i.e. Netos Pod).
3. Configure the `NETBOX_API_KEY` variable in Airflow.

<p class="callout info">This solution assumes that Airflow is running on the local server. For remotely connected **NetBox &lt;&gt; Netos Pod** configurations, please set the API manually in Airflow.</p>

#### The Playbook

The "Create API User" task failed because the user exists. In this case it will refresh the token used by Airflow.

[![image.png](https://docs.netos.io/uploads/images/gallery/2024-10/scaled-1680-/9vNXNE36YcfV2sTI-image.png)](https://docs.netos.io/uploads/images/gallery/2024-10/9vNXNE36YcfV2sTI-image.png)

#### Airflow

The NetBox API key is created. If the key is wrong, the Global Orchestration DAG will not start and will show an authentication error in the logs.

[![image.png](https://docs.netos.io/uploads/images/gallery/2024-10/scaled-1680-/780s9ZPg6OWOmeO2-image.png)](https://docs.netos.io/uploads/images/gallery/2024-10/780s9ZPg6OWOmeO2-image.png)