> ## Documentation Index > Fetch the complete documentation index at: https://learn.servitly.com/llms.txt > Use this file to discover all available pages before exploring further. # Renew JWT token > Renews the JWT token using the Refresh token, User and Tenant Id obtained from the initial login.
Since the JWT token has a limited lifetime (generally one hour, see tokenExpirationTimestamp in the login response), this endpoint keeps the session alive without asking the user for the credentials again.

The response provides a new token together with a new refresh token, which replaces the previous one and must be stored for the next renewal.
A 400 error is returned when the current token has not expired yet. ## OpenAPI ````json POST /identity/users/me/renewToken { "openapi": "3.1.0", "info": { "title": "Servitly DPS API", "version": "1.0.0" }, "servers": [ { "url": "https://api.servitly-sandbox.com", "description": "[AWS SANDBOX]" }, { "url": "https://api.servitly.com", "description": "[AWS PRODUCTION Ireland]" }, { "url": "https://api-ap.servitly.com", "description": "[AWS Hong Kong]" }, { "url": "https://azapi.servitly-dev.com", "description": "[AZURE DEV Frankfurt]" }, { "url": "https://azapi.servitly-staging.com", "description": "[AZURE STAGING Frankfurt]" }, { "url": "https://azapi.servitly.com", "description": "[AZURE PRODUCTION Frankfurt]" } ], "security": [ { "bearerAuth": [] } ], "tags": [ { "name": "ACTIONS" }, { "name": "ALERTS" }, { "name": "API GATEWAY" }, { "name": "AUTHENTICATION" }, { "name": "AUTHORIZATIONS" }, { "name": "CUSTOMERS" }, { "name": "DATA IMPORT / EXPORT" }, { "name": "EVENTS" }, { "name": "LOCATIONS" }, { "name": "MAINTENANCE" }, { "name": "MAPPING" }, { "name": "METRIC DATA" }, { "name": "MOBILE APP" }, { "name": "ORGANIZATION" }, { "name": "PARTNERS" }, { "name": "PRODUCT MODELS" }, { "name": "SPARE PARTS" }, { "name": "STATISTICS" }, { "name": "STORE ORDERS" }, { "name": "SUBSCRIPTIONS" }, { "name": "SUBSCRIPTIONS (OLD)" }, { "name": "THING CONTROL" }, { "name": "THING DEFINITIONS" }, { "name": "THING MANAGEMENT" }, { "name": "THINGS" }, { "name": "TICKETS" }, { "name": "USER TYPES" }, { "name": "USERS" }, { "name": "WORK SESSIONS" } ], "paths": { "/identity/users/me/renewToken": { "post": { "summary": "Renew JWT token", "description": "Renews the JWT token using the Refresh token, User and Tenant Id obtained from the initial login.
Since the JWT token has a limited lifetime (generally one hour, see tokenExpirationTimestamp in the login response), this endpoint keeps the session alive without asking the user for the credentials again.

The response provides a new token together with a new refresh token, which replaces the previous one and must be stored for the next renewal.
A 400 error is returned when the current token has not expired yet.", "tags": [ "AUTHENTICATION" ], "parameters": [ { "$ref": "#/components/parameters/tenantNameHeader" } ], "requestBody": { "description": "The renew token body.", "required": "true", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/RenewTokenRequest" } } } }, "responses": { "200": { "description": "Renew succeeded.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/RenewTokenResponse" } } } }, "400": { "description": "Token cannot be renewed because not yet expired." }, "401": { "$ref": "#/components/responses/NotAuthenticated" }, "403": { "$ref": "#/components/responses/NotAuthorized" }, "404": { "$ref": "#/components/responses/NotFound" }, "429": { "$ref": "#/components/responses/ApiLimit" }, "500": { "$ref": "#/components/responses/IntError" } } } } }, "components": { "parameters": { "tenantNameHeader": { "in": "header", "name": "X-Servitly-Tenant", "required": "true", "schema": { "type": "string", "example": "{{tenantName}}" }, "description": "The name of the tenant (e.g. acme)." } }, "schemas": { "RenewTokenRequest": { "type": "object", "description": "The payload message for renew token requests.", "properties": { "refreshToken": { "type": "string", "example": "{{refreshToken}}", "description": "The refresh token obtained during the user login." }, "userId": { "type": "string", "example": "{{userId}}", "description": "The identifier of the user who gained the JWT token initially." }, "tenantId": { "type": "string", "example": "{{tenantId}}", "description": "The id of the tenant." } } }, "RenewTokenResponse": { "type": "object", "description": "The response message for renew token request.", "properties": { "token": { "type": "string", "description": "The new JWT token to be used as bearer token in the authenticated requests.", "example": "661fd29342541977c4002ec7..." }, "tokenExpirationTimestamp": { "type": "integer", "format": "int64", "description": "The timestamp when the token will expire and must be refreshed.
Generally one hour after issuance, but this may vary over time.", "example": "1578438000000" }, "refreshToken": { "type": "string", "description": "The Refresh token to be used to obtain a new JWT token.", "example": "cd2bd3a0-861d-4798-8fd6-2a2a99fb92e8" }, "userId": { "type": "string", "description": "The id of the authenticated user.", "example": "6616689a0de6d87b47cd6308" }, "tenantId": { "type": "string", "description": "The id of the tenant.", "example": "661533a57bba156cf6e8d04b" } } } }, "responses": { "NotAuthenticated": { "description": "User not authenticated.", "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string", "description": "The error response.", "example": "User not authenticated" } } } } } }, "NotAuthorized": { "description": "User not authorized.", "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string", "description": "The error response.", "example": "User not authorized" } } } } } }, "NotFound": { "description": "Resource was not found.", "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string", "description": "The error response.", "example": "Resource not found" } } } } } }, "ApiLimit": { "description": "API call rate limit exceeded.", "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string", "description": "The error response.", "example": "API call rate limit exceeded" } } } } } }, "IntError": { "description": "Internal server error.", "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string", "description": "The error response.", "example": "Internal Server Error" } } } } } } }, "securitySchemes": { "bearerAuth": { "type": "http", "scheme": "bearer" } } } } ````