POST
/api/v3/validate-authcodeValidate Auth Code
This API allows you to exchange an auth code for an access token.
USE CASE
Get the access_token that authenticates every later API request, right after login completes.
Note
FYERS API access tokens expire daily at 6:30 AM. Generate a new token after 6:30 AM for it to remain valid throughout the day.
Details
- Send a POST request with a JSON body containing
grant_type(authorization_code),appIdHashandcode, theauth_codefrom the login redirect. appIdHashis the SHA-256 hash ofapp_id:app_secret; keep theapp_secretprivate and never share it.- Use the returned
access_tokenfor all later requests, sent asapp_id:access_tokenin theAuthorizationheader. - If a token is expired or invalid, API calls return error code -8, -15, -16 or -17. See API Error Codes.
Request Attributes
| Attribute | Data Type | Description |
|---|---|---|
grant_type | string | This value must always be “authorization_code |
appIdHash | string | SHA-256 of api_id + app_secret Eg: SHA-256 of app_id:app_secret is 7c7120d2b5004f8de22d8dc2da0453b4d7e6211e37a4108b8371266ecff00498 You can use this online tool for reference |
code | string | This is the auth_code which is received from the first step |
Response Attributes
| Attribute | Data Type | Description |
|---|---|---|
s | string | ok / error |
code | int | This is the code to identify specific responses |
message | string | This is the message to identify the specific error responses |
access_token | string | This value will be used for all the subsequent requests. |
Last updated on