Skip to main content

Login & Profile

Logout

Upon completion of this API call, the session will be terminated, rendering the jKey invalid. As a result, the user will be required to log in again to establish a new session and obtain a new access token.

Method: POST

https://connect.thefirstock.com/api/V4/logout

Request details

API Parameters
Parameter Description Example
userId
String
Identifier for the user upon login, unique
to each user in the system.
AA0013
jKey
String
Authentication token obtained from
the login API
d9b4e1b1c79042476fd9611eed81003b

Libraries and SDKs

Tabbed Interface
from thefirstock import thefirstock

logout = thefirstock.firstock_logout(userId="{{userId}}")
curl --location --request POST 'https://connect.thefirstock.com/api/V4/logout' \
--header 'Content-Type: application/json' \
--data-raw '{
    "jKey": "{{jKey}}",
    "userId": "{{userID}}"
}'
const Firstock = require("thefirstock");

const firstock = new Firstock();

firstock.logout({ userId="{{userId}}" }, (err, result) => {
  console.log("Error, ", err);
  console.log("Result: ", result);
});

using thefirstock;

class Program
{
    public static void Main()
    {
      Firstock firstock = new Firstock();
      var logout = firstock.logout( userId="{{userId}}" );
    }
}

Success response details

API Parameters
Parameter Description Example
status
String
Indicates the outcome of the API request success
data
String
Contains a message confirming successful logout Successfully logged
out
{  
  "status": "success", 
  "data": "Successfully logged out"
}

Failure response details

API Error Parameters
Parameter Description Example
status
String
Indicates the result status of the API operation failed
code
String
HTTP status code associated with the error 401
name
String
Specifies the type or category of the error encountered INVALID_JKEY
error.field
String
Field in the request that triggered the error jkey
error.message
String
Detailed message describing the error jKey parameter is invalid
{  
  "status": "failed", 
  "code": "401",
  "name": "INVALID_JKEY", 
  "error": {   
  		"field": "jKey", 
    	"message": "jKey parameter is invalid" 
	}
}