Logout and revoke refresh token
1 min
POST
https://api.upstartcommerce.com/api/v1/auth/logout
Body Parameters
- bodyLogoutRequestrequiredExample
{ "refreshToken": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9..." }Description- refreshTokenstringrequiredExampleDescription
Responses
204
400
- ErrorResponseExample
{ "error": "invalid_request", "message": "Failed to read request body", "code": "BAD_REQUEST" }Description- errorstringrequiredExampleDescription
- messagestringrequiredExampleDescription
- codestring<BAD_REQUEST | UNAUTHORIZED | UNAUTHORIZED_TENANT | TENANT_REQUIRED | FORBIDDEN | RATE_LIMITED | ACCOUNT_LOCKED | INTERNAL_SERVER_ERROR>requiredExampleDescriptionAllowedBAD_REQUESTUNAUTHORIZEDUNAUTHORIZED_TENANTTENANT_REQUIREDFORBIDDENRATE_LIMITEDACCOUNT_LOCKEDINTERNAL_SERVER_ERROR
401
- ErrorResponseExample
{ "error": "unauthorized", "message": "Invalid or revoked refresh token", "code": "UNAUTHORIZED" }Description- errorstringrequiredExampleDescription
- messagestringrequiredExampleDescription
- codestring<BAD_REQUEST | UNAUTHORIZED | UNAUTHORIZED_TENANT | TENANT_REQUIRED | FORBIDDEN | RATE_LIMITED | ACCOUNT_LOCKED | INTERNAL_SERVER_ERROR>requiredExampleDescriptionAllowedBAD_REQUESTUNAUTHORIZEDUNAUTHORIZED_TENANTTENANT_REQUIREDFORBIDDENRATE_LIMITEDACCOUNT_LOCKEDINTERNAL_SERVER_ERROR
500
- ErrorResponseDescription
- errorstringrequiredExampleDescription
- messagestringrequiredExampleDescription
- codestring<BAD_REQUEST | UNAUTHORIZED | UNAUTHORIZED_TENANT | TENANT_REQUIRED | FORBIDDEN | RATE_LIMITED | ACCOUNT_LOCKED | INTERNAL_SERVER_ERROR>requiredExampleDescriptionAllowedBAD_REQUESTUNAUTHORIZEDUNAUTHORIZED_TENANTTENANT_REQUIREDFORBIDDENRATE_LIMITEDACCOUNT_LOCKEDINTERNAL_SERVER_ERROR
curl
curl --request POST \
--url https://api.upstartcommerce.com/api/v1/auth/logout \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data '{
"refreshToken": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9..."
}'javascript
var myHeaders = new Headers();
myHeaders.append("accept", "application/json");
myHeaders.append("content-type", "application/json");
var raw = JSON.stringify({
"refreshToken": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9..."
});
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw,
redirect: 'follow'
};
fetch("https://api.upstartcommerce.com/api/v1/auth/logout", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));ruby
require "uri"
require "json"
require "net/http"
url = URI("https://api.upstartcommerce.com/api/v1/auth/logout")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["accept"] = "application/json"
request["content-type"] = "application/json"
request.body = JSON.dump({
"refreshToken": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9..."
})
response = https.request(request)
puts response.read_body
python
import requests
import json
url = "https://api.upstartcommerce.com/api/v1/auth/logout"
payload = json.dumps({
"refreshToken": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9..."
})
headers = {
'accept': 'application/json',
'content-type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
204
// Logout successful - refresh token revoked
400
// Invalid request body
{
"error": "unauthorized",
"message": "Invalid username or password",
"code": "UNAUTHORIZED"
}401
// Invalid or already revoked refresh token
{
"error": "unauthorized",
"message": "Invalid username or password",
"code": "UNAUTHORIZED"
}500
// Internal server error
{
"error": "unauthorized",
"message": "Invalid username or password",
"code": "UNAUTHORIZED"
}GENERATED
// Internal server error
{
"error": "unauthorized",
"message": "Invalid username or password",
"code": "UNAUTHORIZED"
}tokenGenerationFailed
// Token generation failed
{
"error": "internal_error",
"message": "Token generation failed",
"code": "INTERNAL_SERVER_ERROR"
}serviceError
// Upstream service error
{
"error": "internal_error",
"message": "Failed to communicate with authentication backend",
"code": "INTERNAL_SERVER_ERROR"
}