# 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**](/data-and-state/api-integration/defining-apis.md): Configure your endpoints, headers, and variables in the Dashboard.
2. [**Using APIs**](/data-and-state/api-integration/using-apis.md): Bind them to UI (`FutureBuilder`) or trigger them via Actions (`CallRestAPI`).


---

# Agent Instructions: Querying This Documentation

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

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.digia.tech/data-and-state/api-integration.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
