# API

## Overview

An API, or Application Programming Interface, is a set of rules that allows different software entities to communicate with each other. It acts like a bridge that lets two applications talk to each other and request or send data.&#x20;

By integrating with various APIs, the app can securely fetch real-time weather updates, news articles, and other live data without the need to rebuild these services from scratch.

To see what public APIs are available, we recommend [this list from Todd Motto](https://github.com/toddmotto/public-apis).

### Video Tutorial <a href="#video-tutorial" id="video-tutorial"></a>

#### How to Connect Your Thunkable App to an API <a href="#how-to-connect-your-thunkable-app-to-a-web-api" id="how-to-connect-your-thunkable-app-to-a-web-api"></a>

{% embed url="<https://youtu.be/OFdxD5h_nIE>" %}

In this video, we will demonstrate how to add and utilize an API to connect with Firebase's API for user authentication. We'll guide you through the process of setting up the Firebase project and integrating it with your app to enable secure user login and registration functionalities.

#### Steps to Add an API to Your Thunkable App

1. **Identify an API**: First, choose an API you want to integrate with your app. Make sure it fits your app's requirements.

**Caution:** Never input your API key directly into the code or the chat. This is crucial for maintaining security.

## Add an API to Your App

The AI in Thunkable can connect your app to any third-party API. Follow the steps below to get started.

#### Step 1: Find an API

Locate the API you want to use and gather the relevant documentation. Most APIs provide a base URL, required headers, and sample code — collect these before moving on.

#### Step 2: Ask the AI to Add the API

In the AI chat, describe the API you want to connect to. For best results, include the sample code from the API's documentation in your prompt so the AI has a reference to work from.

{% hint style="warning" %}
**Never paste your API keys into the chat or directly into your code.**&#x20;

Your credentials should only be entered through the form that appears after the AI adds the integration. This form will always appear automatically.&#x20;
{% endhint %}

#### Step 3: Enter Your API Keys

Once the AI adds the integration code, a form will appear prompting you to enter your API credentials.

<figure><img src="/files/pneAK8q8Uj2MMqfehQuW" alt=""><figcaption></figcaption></figure>

#### Step 4: Save Your Credentials

Paste your API key into the form and click **Save**. Your app is now connected to the API.

## How to Edit Your API Keys

#### Step 1: Click the App Secrets Icon

To open the panel containing all the app keys for your app, click the App Secrets icon at the top of your screen.

<figure><img src="/files/xChcL4hqeTGpZQ1Z6x2r" alt=""><figcaption></figcaption></figure>

#### Step 2: Modify the Keys in the Panel

<figure><img src="/files/Vm4puy0Wiwu3R5uYm2Ef" alt=""><figcaption></figcaption></figure>


---

# 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://aidocs.thunkable.com/features/api.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.
