> ## 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. # User login (user credentials) > Authenticates the user in the DPS by using personal credentials (username and password), and opens a new session.
The tenant is identified by the X-Servitly-Tenant header, while the apiKey query parameter identifies the client application performing the request.

On success the response provides the JWT token to be sent as bearer token on every subsequent authenticated call, its expiration timestamp, and the refreshToken, userId and tenantId required to renew the token once expired.
The optional devices node allows mobile clients to register the device that will receive push notifications.

For security reasons unknown users and wrong passwords are reported with the same 401 error. ## OpenAPI ````json POST /identity/users/login { "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/login": { "post": { "summary": "User login (user credentials)", "description": "Authenticates the user in the DPS by using personal credentials (username and password), and opens a new session.
The tenant is identified by the X-Servitly-Tenant header, while the apiKey query parameter identifies the client application performing the request.

On success the response provides the JWT token to be sent as bearer token on every subsequent authenticated call, its expiration timestamp, and the refreshToken, userId and tenantId required to renew the token once expired.
The optional devices node allows mobile clients to register the device that will receive push notifications.

For security reasons unknown users and wrong passwords are reported with the same 401 error.", "tags": [ "AUTHENTICATION" ], "parameters": [ { "$ref": "#/components/parameters/tenantNameHeader" }, { "$ref": "#/components/parameters/apiKey" } ], "requestBody": { "description": "The login credentials and optional device details.", "required": "true", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/LoginRequest" } } } }, "security": [ {} ], "responses": { "401": { "$ref": "#/components/responses/InvalidCredentials" }, "200": { "description": "Authentication succeeded.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/LoginResponse" } } } }, "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)." }, "apiKey": { "in": "query", "name": "apiKey", "required": "true", "schema": { "type": "string", "example": "{{apiKey}}" }, "description": "The API KEY identifying the client." } }, "schemas": { "LoginRequest": { "type": "object", "description": "The payload message for login requests.", "properties": { "email": { "type": "string", "description": "The user registration email address.", "example": "{{userEmail}}" }, "password": { "type": "string", "description": "The user private password.", "example": "{{userPassword}}" }, "devices": { "type": "array", "nullable": "true", "items": { "$ref": "#/components/schemas/Device" } } } }, "LoginResponse": { "type": "object", "description": "The response message for login requests.", "properties": { "token": { "type": "string", "description": "The JWT token to include as the bearer token in 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 used to request a new JWT token when the current one expires.", "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" } } }, "Device": { "type": "object", "description": "Details about the device on which the API client is currently running (e.g., PC, Mobile Device).
When created/updated, you need to provide the mandatory properties. Please note that, for mobile apps, you must specify all properties, as they are required for managing push notifications. ", "properties": { "deviceId": { "type": "string", "description": "The unique identifier which is used to match the device among different logins.", "mandatory": "true", "example": "4c60d031f4d07c01" }, "appId": { "type": "string", "description": "The identifier/package-name of the mobile app used to log in.", "example": "com.acme.dps-mobile" }, "os": { "type": "string", "description": "The device operating system.", "example": "Android_9, iOS_11" }, "model": { "type": "string", "description": "The mobile device model.", "example": "Pixel 10" }, "platform": { "type": "string", "enum": [ "Android", "iOS" ], "description": "The mobile platform name.", "example": "Android" }, "browser": { "type": "string", "description": "The information of the browser (navigator.userAgent) used to access the DPS.
An optional property useful for debugging purposes. " }, "notificationDeviceId": { "type": "string", "description": "The device notification identifier obtained from the platform provider during the device registration for notifications.", "example": "4w3rY1qRd8:APA91bCue8jas2h64ENFiTePAB5GZ1tK....." }, "token": { "type": "string", "description": "The refresh token associated to this decice.", "readOnly": "true", "example": "61cae9d2-704c-3cc7-a030-32b24a367a9e" } } } }, "responses": { "InvalidCredentials": { "description": "Invalid credentials, user not authenticated.", "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string", "description": "The error response.", "example": "Invalid credentials" } } } } } }, "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" } } } } ````