# 00-Authentication

# 1 Authentication

# 1.1 Get Access Token(POST)

Token-based authentication, the life of an Access_Token is 15 days, and the life of a Refresh_Token is 180 days. You can request new access tokens with Refresh_Token when Access_Token expires. You need to log in when Refresh_Token expires.

# URL

https://developers.cjdropshipping.com/api2.0/v1/authentication/getAccessToken

# CURL

curl --location --request POST 'https://developers.cjdropshipping.com/api2.0/v1/authentication/getAccessToken' \
                --header 'Content-Type: application/json' \
                --data-raw '{
                    "email": "v0pjsw5t@linshiyouxiang.net",
                    "password": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
                }'
Parameter Definition Type Required Length Note
email email string yes 200 Registered email of CJ account (opens new window)
password password string yes 200 Get API Key (opens new window)

# Return

success

{
    "code": 200,
    "result": true,
    "message": "Success",
    "data": {
        "accessToken": "f59ac98193d64d62a9e887abea830369",
        "accessTokenExpiryDate": "2021-08-18T09:16:33+08:00",
        "refreshToken": "f7edabe65c3b4a198b50ca8f969e36eb",
        "refreshTokenExpiryDate": "2022-02-07T09:16:33+08:00",
        "createDate": "2021-08-11T09:16:33+08:00"
    },
    "requestId": "8b3d9ea1-00c3-4d10-9e2b-d18041d98080"
}
Field Definition Type Length Note
accessToken Access Token string 200
accessTokenExpiryDate Access Token expiry time string 200 Default 7 days
refreshToken Refresh Token string 200
refreshTokenExpiryDate Refresh Token expiry time string 200 Default 180 days
createDate Created date string 200

error

{
    "code": 1601000,
    "result": false,
    "message": "User not find",
    "data": null,
    "requestId": "a18c9793-7c99-42f9-970b-790eecdceba2"
}
Field Definition Type Length Note
code Error code int 20 Return to error codes
result Whether returned boolean 1
message Return message string 200
data Data return
requestId Request ID string 48 For error inquiry

# 1.2 Refresh Access Token(POST)

An API security mechanism with which the expiry date of Access_Token can be refreshed. The life of an Access_Token is 15 days.

# URL

https://developers.cjdropshipping.com/api2.0/v1/authentication/refreshAccessToken

# CURL

curl --location --request POST 'https://developers.cjdropshipping.com/api2.0/v1/authentication/refreshAccessToken' \
                --header 'Content-Type: application/json' \
                --data-raw '{
                    "refreshToken": "3d3b01404da04be8b6795d7e9823cee5"
                }'
Parameter Definition Type Required Length Note
refreshToken Refresh Token string yes 80

# Return

success

{
    "code": 200,
    "result": true,
    "message": "Success",
    "data": {
        "accessToken": "f59ac98193d64d62a9e887abea830369",
        "accessTokenExpiryDate": "2021-08-18T09:16:33+08:00",
        "refreshToken": "f7edabe65c3b4a198b50ca8f969e36eb",
        "refreshTokenExpiryDate": "2022-02-07T09:16:33+08:00",
        "createDate": "2021-08-11T09:16:33+08:00"
    },
    "requestId": "8b3d9ea1-00c3-4d10-9e2b-d18041d98080"
}
Field Definition Type Length Note
accessToken Access Token string 200
accessTokenExpiryDate Access Token Expiry Time string 200 Default 15 days
refreshToken Refresh Token string 200
refreshTokenExpiryDate Refresh Token Expiry Time string 200 Default 180 days
createDate Created Date string 200

error

{
    "code": 1600003,
    "result": false,
    "message": "Refresh token is failure",
    "data": null,
    "requestId": "0b20dc1a-0043-43a7-a7c0-51ca6c61d976"
}
Field Definition Type Length Note
code error code int 20 Reference error code
result Whether or not the return is normal boolean 1
message return message string 200
data return data object interface data return
requestId requestId string 48 Flag request for logging errors

# 1.3 Logout Token(POST)

API security mechanism. After logging out, Access_Token and Refresh_Token will expire.

# URL

https://developers.cjdropshipping.com/api2.0/v1/authentication/logout

# CURL

curl --location --request POST 'https://developers.cjdropshipping.com/api2.0/v1/authentication/logout' \
                --header 'CJ-Access-Token: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'

# Return

success

{
    "code": 200,
    "result": true,
    "message": "Success",
    "data": true,
    "requestId": "b1d3728d-8a29-417e-9983-6df9926aaa49"
}
Field Definition Type Length Note
code error code int 20 Reference error code
result Whether or not the return is normal boolean 1
message return message string 200
data return data object interface data return
requestId requestId string 48 Flag request for logging errors

error

{
    "code": 1600001,
    "result": false,
    "message": "Authentication failed",
    "data": null,
    "requestId": "5aa2bb6e-42fa-4e0a-ae88-1833c2c1c883"
}
Field Definition Type Length Note
code error code int 20 Reference error code
result Whether or not the return is normal boolean 1
message return message string 200
data return data object interface data return
requestId requestId string 48 Flag request for logging errors