> For the complete documentation index, see [llms.txt](https://apidocs.akinon.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://apidocs.akinon.com/integrator/authentication.md). Agents can also search and read this documentation through its [MCP server](https://apidocs.akinon.com/~gitbook/mcp).

# Authentication

This page describes how to authenticate to the Integrator via API and obtain an access token. The token is then used to authorize subsequent API calls (for example, sending Outbound flow data for flows set as "Outbound").

## <mark style="color:red;">`POST`</mark> <mark style="color:red;">Login</mark>

This method is used to authenticate a user by e‑mail address and password and to retrieve a **short-lived** access token.

**Path**: `/api/nifi/login`

* Prod Integrator: `https://flow.entegrator.akinon.net:3000/api/nifi/login`
* Dev Integrator: `https://flow-dev.entegrator.akinon.net:3000/api/nifi/login`

#### **Headers**

| Header       | Description          | Required | Value                               |
| ------------ | -------------------- | :------: | ----------------------------------- |
| Content-Type | Request content type |     ✓    | `application/x-www-form-urlencoded` |

#### **Body Parameters**

The login endpoint expects credentials in the request body, encoded as `application/x-www-form-urlencoded`.

| Parameter | In   | Description         | Required | Example           |
| --------- | ---- | ------------------- | :------: | ----------------- |
| username  | body | User e‑mail address |     ✓    | `user@akinon.com` |
| password  | body | User password       |     ✓    | `********`        |

#### **Example Request (cURL)**

```bash
curl --location 'https://flow-dev.entegrator.akinon.net:3000/api/nifi/login' \
	--header 'Content-Type: application/x-www-form-urlencoded' \
	--data-urlencode 'username=<user mail address>' \
	--data-urlencode 'password=<password>'
```

#### **Example Response (200 OK)**

The response body is plain text and contains only the access token string:

```
<token>
```

You must include this token in the `Authorization` header when calling other secured Integrator endpoints:

```http
Authorization: Bearer <token>
```

#### **Example Python Code (Using `requests`)**

The following example shows how to log in, retrieve the token, and prepare headers for subsequent API calls using the `requests` library:

```python
import requests

login_url = "https://flow-dev.entegrator.akinon.net:3000/api/nifi/login"

payload = {
		"username": "user@example.com",
		"password": "<password>",
}

headers = {
		"Content-Type": "application/x-www-form-urlencoded",
}

response = requests.post(login_url, data=payload, headers=headers)

if response.status_code == 200:
		# The response body is plain text token
		token = response.text.strip()
		print("Access token:", token)

		# Use the token for authorized requests
		auth_headers = {
				"Authorization": f"Bearer {token}",
		}

		# Example: send data to an outbound flow using the token
		outbound_url = "https://flow-dev.entegrator.akinon.net:3002/api/p1/akinon/<projectSlug>/<flowSlug>"
		outbound_headers = {
				"Authorization": f"Bearer {token}",
				"Content-Type": "application/json",
		}
		outbound_payload = [
				{
						"stock_list": "1",
						"unit_type": "qty",
						"product_sku": "12345",
						"stock": 123,
				},
				{
						"stock_list": "1",
						"unit_type": "qty",
						"product_sku": "12346",
						"stock": 0,
				},
				{
						"stock_list": "1",
						"unit_type": "qty",
						"product_sku": "12347",
						"stock": 9,
				},
		]
		outbound_response = requests.post(
				outbound_url, headers=outbound_headers, json=outbound_payload
		)
		print("Outbound flow response:", outbound_response.status_code, outbound_response.text)
else:
		print("Login failed:", response.status_code, response.text)
```

#### **Response Errors**

* Status Code 400: Returned when the supplied credentials are invalid. The response body is the plain text message: `The supplied username and password are not valid.`
* Status Code 400: Returned when the `username` and/or `password` are missing. The response body is the plain text message: `The username and password must be specified.`


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://apidocs.akinon.com/integrator/authentication.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
