Error message

AG8004 - Invalid API Key

Last updated 21 July 2026

Angel One AG8004 - Invalid API Key

In short

AG8004 means Angel One is not accepting the Smart API Key saved for this account. This is your broker's key, not your AutoTrader Web API key. It is confusing because the account can still look connected and may even validate successfully, while every request for orders, positions, holdings and funds is refused. That happens because Angel One checks the key on data requests but not always at sign-in. It is almost never a temporary broker problem, so waiting and re-trying will not clear it. The usual reason is that the Smart API app was removed, expired or had its key regenerated at Angel One's developer portal. To fix it, sign in to that portal, check your app is still active, copy its current API key, then open Accounts -> Trading Accounts in AutoTrader Web, paste the key, click Validate and Save. Also check there is no extra space before or after the key.

When this happens

  1. 1 The Smart API app was deleted or is no longer active at Angel One.
  2. 2 The API key was regenerated at Angel One, so the saved key is now out of date.
  3. 3 The wrong key was pasted, or the key was copied with an extra space before or after it.
  4. 4 The key belongs to a different Angel One app than the one being used for trading.

You see this error while using an Angel One trading account. Our system connects with Angel One through their Smart API product. The code AG8004 comes from Angel One, not from us.

For account setup steps, see the Angel One Setup guide.

Which API key is this?

This is the Smart API Key you get from Angel One. It is not your AutoTrader Web API key, which is a different key used for calling our own APIs from your code. If your problem is with that key instead, see API Key is wrong or user disabled.

Why the account still looks connected

This is the confusing part of AG8004.

Angel One does not always check the API key when the account signs in. It checks it on the requests that follow. So the account can look connected, and validation can even pass, while every request after that is refused.

The result is an account that looks fine but shows nothing useful:

  • Orders do not load.
  • Positions do not load.
  • Holdings do not load.
  • Funds and margins do not load.

If you are seeing all four fail together on one Angel One account while your other accounts are fine, AG8004 is the likely reason.

Why this happens

AG8004 means Angel One received the request but did not accept the API key sent with it.

Unlike AB1004 and AB2001, this is not a temporary problem on Angel One’s side. Re-trying will not help, and it will not clear on its own. Something about the key itself has to change.

The most common reasons are:

  • The Smart API app was removed or is no longer active at Angel One.
  • The API key was regenerated, so the key saved with us is an old one.
  • The wrong key was pasted, or it was copied with an extra space at the start or end.
  • The key belongs to a different app than the one you meant to use.

How to fix it

  1. Sign in to Angel One’s Smart API developer portal, where you created your app.
  2. Check that your app is still there and still active.
  3. Copy the current API key for that app.
  4. In AutoTrader Web, go to the menu (Accounts -> Trading Accounts) and open your Angel One account.
  5. Paste the key into Angel Smart API Key. Make sure there is no space before or after it.
  6. Click Validate, then Save.

Your account should start showing orders, positions, holdings and funds again shortly after the key is correct.

If the app is missing at Angel One, create a new one, then use its key in step 3.

If it still fails

If you have saved a fresh key and AG8004 continues, the problem is with the app at the broker’s end. Contact Angel One’s Smart API support and tell them you are getting AG8004 (Invalid API Key) even with a newly generated key. Their contact details are on the Angel One Setup page.

Did this solve your problem?
Contact support