# API Integration

In modern application development, **APIs** are the lifeblood of your data flow. Since most logic and data reside on the backend, your app needs a robust way to fetch, display, and manipulate this data.

## Why is this part of "Data & State"?

API responses are the primary source of **External Data** in your app. Once fetched, this data is often stored in **State** (like a list of products in App State) or bound directly to widgets (like a User Profile).

## Client-Side Execution architecture

Crucially, **Digia does not act as a proxy** for your API calls.

1. **Definition**: You define the API structure (Endpoint, Headers, Body) in the Digia Dashboard. This definition is part of the JSON DSL downloaded by the app.
2. **Execution**: The **Mobile App** (Client) reads this definition and executes the network request **directly** to your server.
   * The request goes: `Mobile Device` -> `Your Server`.
   * It does **NOT** go: `Mobile Device` -> `Digia Server` -> `Your Server`.

This ensures:

* **Low Latency**: No middleman adds delay.
* **Security**: Your data never passes through Digia's servers during runtime.
* **Privacy**: We don't see your users' data.

## Supported Protocols

Digia supports the two most common standards:

* **REST**: Standard HTTP methods (GET, POST, PUT, DELETE, PATCH).
* **GraphQL**: Queries and Mutations via HTTP POST.

## Workflow

1. [**Defining APIs**](https://docs.digia.tech/data-and-state/api-integration/defining-apis): Configure your endpoints, headers, and variables in the Dashboard.
2. [**Using APIs**](https://docs.digia.tech/data-and-state/api-integration/using-apis): Bind them to UI (`FutureBuilder`) or trigger them via Actions (`CallRestAPI`).
