> For the complete documentation index, see [llms.txt](https://docs.openalgo.in/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.openalgo.in/connect-brokers/brokers/iifl-capital.md).

# IIFL Capital

OpenAlgo connects to IIFL Capital through their Markets' APIs developer portal. You'll need\
an active IIFL Capital trading account and a static public IP before you start, since IIFL whitelists the IP that's allowed to call your app.

**Prerequisites**

* An active IIFL Capital trading account (Client ID / PAN handy)
* A static public IP address — IIFL whitelists this IP and rejects API calls from anywhere else
* OpenAlgo running locally or on a host whose outbound IP matches what you'll register

**Step 1 — Visit the IIFL Markets' APIs portal**

Go to [https://markets.iiflcapital.com](https://developers.iiflcapital.com/)

Click Login / Sign Up at the top right and choose As Individual Trader.

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

**Step 2 — Log in to the Developer Portal**

Sign in with your IIFL credentials — Email, Mobile, Client ID, or PAN works. Use the same\
password you use for the IIFL trading platform.

<figure><img src="/files/5DtCc7P3L9Hl62L8LK5S" alt=""><figcaption></figcaption></figure>

**Step 3 — Open "My Apps"**

After login you land on the My Apps dashboard at developers.iiflcapital.com. Your IIFL\
Client ID is shown in the greeting.

If this is your first time, the apps list will be empty. Click Create App in the top-right.

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

**Step 4 — Create the OpenAlgo App**

Fill the Create App form

<figure><img src="/files/2TRzEf1VQEpGOyFo0MP0" alt=""><figcaption></figcaption></figure>

Click Submit.

**Important:** The Redirect URL must match <http://127.0.0.1:5000/iiflcapital/callback>&#x20;exactly if you're running OpenAlgo locally on the default port. If you've changed&#x20;HOST\_SERVER in your .env, replace 127.0.0.1:5000 with your actual host and port.

The Primary Static IP must match the public IP from which OpenAlgo will call IIFL. Use&#x20;<https://www.whatismyip.com> to check. If your IP is dynamic (typical for home broadband),&#x20;API calls will fail intermittently — you'll need a fixed-IP setup or VPS.

**Step 5 — Locate your App Key and App Secret**

After creation, your app shows up on the My Apps page with status Active. Click the\
three-dot menu (⋮) on the app row and choose View All Details.

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

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

The View Details modal shows everything you need:

* App Name — friendly name only, not used in OpenAlgo
* Redirect URL — should match what you entered
* Primary Static IP — for reference
* Algo Registration Type — for reference
* App Key  — this becomes BROKER\_API\_KEY
* App Secret Key — this becomes BROKER\_API\_SECRET

If you ever lose the App Secret, use Regenerate App Secret from the same ⋮ menu.&#x20;Existing OpenAlgo sessions will need to log in again after rotation.

**Step 6 — Configure OpenAlgo**

Open your OpenAlgo .env file and set:

```
BROKER_API_KEY = 'your_app_key_here'
BROKER_API_SECRET = 'your_app_secret_key_here'
REDIRECT_URL = 'http://127.0.0.1:5000/iiflcapital/callback'
```

Save and restart OpenAlgo.

Integrating OpenAlgo with IIFL Capital's API opens up possibilities for automated trading strategies, providing a powerful tool for traders and developers to exploit market opportunities efficiently. It's essential to follow best practices for API integration, including handling rate limits, managing API keys securely, and ensuring robust error handling and logging mechanisms are in place.


---

# 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 dynamically by asking a question.

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

```
GET https://docs.openalgo.in/connect-brokers/brokers/iifl-capital.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.
