Navigation

    SmartAPI Forum
    • Register
    • Login
    • Search
    • Categories
    • Popular
    • Groups
    • FAQs
    • API Docs

    Invalid API key

    Python SDK
    0
    10
    32
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • S
      sunil_modi last edited by

      @Moderator_3 instead of successfull connection, i am getting invalid api error when try to retrieve top gainer and loser
      86ef4aaf-27d9-411d-be84-476ee83af453-image.png

      successfull connection

      f3c46311-857a-4c8d-8b77-a200c916b2c7-image.png

      M 1 Reply Last reply Reply Quote 0
      • M
        Moderator_1 @sunil_modi last edited by

        Hi @sunil_modi,

        Have you checked on the SmartAPI Developer console that your app is active?
        This error usually comes when the is app is set to inactive. Are you able to do other API calls and fetch data from them? Please let us know. then we will be able to troubleshoot your issue.

        Regards
        SmartAPI Team

        S 1 Reply Last reply Reply Quote 0
        • S
          sunil_modi @Moderator_1 last edited by

          @Moderator_1 Yes i have checked APP is active and i am able to retrieve jwt token from data object

          still getting invalid api key error

          M 1 Reply Last reply Reply Quote 0
          • M
            Moderator_1 @sunil_modi last edited by

            Hi @sunil_modi,
            Please pass all the Header Parameters as described in the documentation. As I can see from your request body, you have only passed content-type, x-api-key and Authorization in the headers. please pass the rest of the values as described in this documentation page

            Regards
            SmartAPI Team

            S 1 Reply Last reply Reply Quote 0
            • S
              sunil_modi @Moderator_1 last edited by

              @Moderator_1 would yu please tell me what to give as a value to
              X-publicIP and XClientIP. as i am running this code locallly as of now

              M 1 Reply Last reply Reply Quote 0
              • M
                Moderator_1 @sunil_modi last edited by

                @sunil_modi
                Please open Command Prompt on Windows by typing cmd and then run this command:

                ipconfig\all

                The physical address in the response is your mac address and you should pass the same for X-macaddress in the request header.
                Similarly you'll see IP address in the response as well. Copy and paste this in the request headers for both X-publicIP and X-clientIP.

                Regards
                SmartAPI Team

                S 1 Reply Last reply Reply Quote 0
                • S
                  sunil_modi @Moderator_1 last edited by

                  @Moderator_1 i have this much of headers
                  2f98a352-e0d4-45cb-9248-bd889b7bb4d6-image.png
                  still getting invalid API key error instead of getting 200 status code
                  be68ab24-f606-4351-9266-33b9cc3e01e3-image.png

                  This time i tried to get my holding and i try to retrieve top loser and gainer. In both case getting same issue.

                  M 1 Reply Last reply Reply Quote 0
                  • M
                    Moderator_3 @sunil_modi last edited by

                    Hello @sunil_modi

                    I can see you are missing some of the key in your headers So can you please cross check your headers with the below attached link under the Header Parameters section
                    and please update accordingly
                    Kindly modify the below points too
                    1- Replace "X-API-KEY" with X-PrivateKey
                    2- The value of Autherization key should be Bearer eyJhbGciOiJIUzUxMiJ9........ not f and also both are inside the double quotes
                    https://smartapi.angelbroking.com/docs/ResponseStructure

                    Regards,
                    SmartAPI Team

                    S 1 Reply Last reply Reply Quote 0
                    • S
                      sunil_modi @Moderator_3 last edited by

                      @Moderator_3 said in Invalid API key:

                      Private

                      Greate it works
                      Thanks

                      1 Reply Last reply Reply Quote 0
                      • D
                        D50628473 last edited by

                        his code i am try last 7 day but not work can you give me advice

                        1 Reply Last reply Reply Quote 0
                        • First post
                          Last post