All URIs are relative to https://api.upstox.com
| Method | HTTP request | Description |
|---|---|---|
| authorize | GET /login/authorization/dialog | Authorize API |
| logout | DELETE /logout | Logout |
| token | POST /login/authorization/token | Get token API |
authorize(clientId, redirectUri, apiVersion, state, scope)
Authorize API
This provides details on the login endpoint.
// Import classes:
//import com.upstox.ApiException;
//import io.swagger.client.api.LoginApi;
LoginApi apiInstance = new LoginApi();
String clientId = "clientId_example"; // String |
String redirectUri = "redirectUri_example"; // String |
String apiVersion = "apiVersion_example"; // String | API Version Header
String state = "state_example"; // String |
String scope = "scope_example"; // String |
try {
apiInstance.authorize(clientId, redirectUri, apiVersion, state, scope);
} catch (ApiException e) {
System.err.println("Exception when calling LoginApi#authorize");
e.printStackTrace();
}
| Name | Type | Description | Notes |
|---|---|---|---|
| clientId | String | ||
| redirectUri | String | ||
| apiVersion | String | API Version Header | |
| state | String | [optional] | |
| scope | String | [optional] |
null (empty response body)
No authorization required
IndieUserInitTokenResponse initTokenRequestForIndieUser(body, clientId)
Init token API
This API provides the initialize the generate token and it's expiry for an indie user
// Import classes:
//import com.upstox.ApiException;
//import io.swagger.client.api.LoginApi;
LoginApi apiInstance = new LoginApi();
IndieUserTokenRequest body = new IndieUserTokenRequest(); // IndieUserTokenRequest |
String clientId = "clientId_example"; // String |
try {
IndieUserInitTokenResponse result = apiInstance.initTokenRequestForIndieUser(body, clientId);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling LoginApi#initTokenRequestForIndieUser");
e.printStackTrace();
}
| Name | Type | Description | Notes |
|---|---|---|---|
| body | IndieUserTokenRequest | ||
| clientId | String |
No authorization required
LogoutResponse logout(apiVersion)
Logout
Logout
// Import classes:
//import com.upstox.ApiClient;
//import com.upstox.ApiException;
//import com.upstox.Configuration;
//import com.upstox.auth.*;
//import io.swagger.client.api.LoginApi;
ApiClient defaultClient = Configuration.getDefaultApiClient();
// Configure OAuth2 access token for authorization: OAUTH2
OAuth OAUTH2 = (OAuth) defaultClient.getAuthentication("OAUTH2");
OAUTH2.setAccessToken("YOUR ACCESS TOKEN");
LoginApi apiInstance = new LoginApi();
String apiVersion = "apiVersion_example"; // String | API Version Header
try {
LogoutResponse result = apiInstance.logout(apiVersion);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling LoginApi#logout");
e.printStackTrace();
}
| Name | Type | Description | Notes |
|---|---|---|---|
| apiVersion | String | API Version Header |
TokenResponse token(apiVersion, code, clientId, clientSecret, redirectUri, grantType)
Get token API
This API provides the functionality to obtain opaque token from authorization_code exchange and also provides the user’s profile in the same response.
// Import classes:
//import com.upstox.ApiException;
//import io.swagger.client.api.LoginApi;
LoginApi apiInstance = new LoginApi();
String apiVersion = "apiVersion_example"; // String | API Version Header
String code = "code_example"; // String |
String clientId = "clientId_example"; // String |
String clientSecret = "clientSecret_example"; // String |
String redirectUri = "redirectUri_example"; // String |
String grantType = "grantType_example"; // String |
try {
TokenResponse result = apiInstance.token(apiVersion, code, clientId, clientSecret, redirectUri, grantType);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling LoginApi#token");
e.printStackTrace();
}
| Name | Type | Description | Notes |
|---|---|---|---|
| apiVersion | String | API Version Header | |
| code | String | [optional] | |
| clientId | String | [optional] | |
| clientSecret | String | [optional] | |
| redirectUri | String | [optional] | |
| grantType | String | [optional] |
No authorization required