> **Source:** https://knowledge.leegality.com/sign-station/api/login > **Site:** Leegality Knowledge Base — https://knowledge.leegality.com > **About:** Leegality is a document execution platform covering eSigning, stamps, NeSL, workflows, and REST API integration. > **Navigation:** Every article on this site has a plain-text version at `.txt` (this format). To get an index of all articles with their `.txt` links, read: https://knowledge.leegality.com/llms.txt > **AI Guide:** For instructions on how to navigate this knowledge base as an AI agent, read: https://knowledge.leegality.com/ai-readable.txt --- # POST /api/v1/auth/login — User Login This API Authenticates a user using username (email) and password credentials. Upon successful authentication, returns a JWT access token along with complete user profile including roles, permissions (authorities), departments, and organization information. The token must be included in subsequent API requests as a Bearer token in the Authorization header. No additional permissions are required to access this endpoint. **Authentication:** `X-Auth-Token` header required on every request. ## Request URL ``` POST https://app1.leegality.com/api/api/v1/auth/login ``` **Environments:** - Production: `https://app1.leegality.com/api/api/v1/auth/login` - Sandbox: `https://sandbox.leegality.com/api/api/v1/auth/login` --- ## Request Body **Content-Type:** `application/json` | Field | Type | Required | Description | Example | |-------|------|----------|-------------|---------| | `username` | string | Yes | The username of the user trying to log in. | `admin@leegality.com` | | `password` | string | Yes | The password of the user trying to log in. | `Strong@Passw0rd` | ### Sample Request ```json { "username": "admin@leegality.com", "password": "Strong@Passw0rd" } ``` --- ## Responses ### 200 — OK | Field | Type | Required | Description | Example | |-------|------|----------|-------------|---------| | `code` | string | No | Response code indicating success or failure of the login request. | `LE_SS_301` | | `message` | string | No | A message providing additional information about the login request. | `Authentication successful.` | | `data` | LoginUserVO | No | See **LoginUserVO** below. | — | #### LoginUserVO | Field | Type | Required | Description | Example | |-------|------|----------|-------------|---------| | `username` | string | No | The username of the logged-in user. | `admin@leegality.com` | | `name` | string | No | The full name of the logged-in user. | `TestUser123` | | `organization` | OrganizationVO | No | See **OrganizationVO** below. | — | | `accessToken` | string | No | JWT token to use in Authorization header as `Bearer | `eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJhZG1pbkBsZWVnYWxpdHkuY29tIiw` | | `tokenType` | string | No | Type of the token, typically "Bearer" for JWT tokens. | `Bearer` | | `expiresIn` | integer | No | Expiration time of the token in seconds. | `3600` | | `authorities` | array\ | No | List of permissions/entitlements assigned through user's roles. | `writeCertificate,readNotificationRule,updateOAuth2Client,sea` | | `roles` | array\ | No | See **RoleVO** below. | — | | `departments` | array\ | No | See **DepartmentVO** below. | — | ##### OrganizationVO | Field | Type | Required | Description | Example | |-------|------|----------|-------------|---------| | `id` | string | No | Organization unique identifier. | — | | `name` | string | No | Organization name. | `TestOrganization` | | `createdAt` | string | No | The date and time when the organization was created. | — | | `updatedAt` | string | No | The date and time when the organization was last updated. | — | | `enabled` | boolean | No | Indicates whether the organization is active or inactive. | — | ##### RoleVO | Field | Type | Required | Description | Example | |-------|------|----------|-------------|---------| | `id` | string | No | Role ID. This is configured during the role creation. | `b0af5f43-7f34-4ea4-867a-10115642f354` | | `name` | string | No | Role name. E.g., "Admin", "User" etc. | `Admin` | | `createdAt` | string | No | The date and time when the role was created | `2025-12-15T10:20:30Z` | | `entitlements` | array\ | No | See **EntitlementVO** below. | — | ###### EntitlementVO | Field | Type | Required | Description | Example | |-------|------|----------|-------------|---------| | `id` | string | No | Entitlement ID. This is configured in the system and cannot be changed. | `3fa85f64-5717-4562-b3fc-2c963f66afa6` | | `name` | string | No | Entitlement name. E.g., "DOCUMENT_SIGN","USER_MANAGEMENT" | `DOCUMENT_SIGN` | ##### DepartmentVO | Field | Type | Required | Description | Example | |-------|------|----------|-------------|---------| | `id` | string | No | Department unique identifier | `3fa85f64-5717-4562-b3fc-2c963f66afa6` | | `name` | string | No | The department's name (e.g., "Human Resources"). | `Human Resources` | | `enabled` | boolean | No | Indicates whether the department is active or inactive. | `true` | | `createdAt` | string | No | The date and time when the department was created. | `2025-12-15T10:20:30Z` | | `totalUsers` | integer | No | Total number of users in the department. | `25` | ### 401 — Authentication failed - Invalid username or password | Field | Type | Required | Description | Example | |-------|------|----------|-------------|---------| | `code` | string | No | Top-level error code | `LE_ERR_SS_401` | | `errors` | array\ | No | List of error details See **ErrorDetailLogin401VO** below. | — | #### ErrorDetailLogin401VO | Field | Type | Required | Description | Example | |-------|------|----------|-------------|---------| | `message` | string | No | Detailed error message | `Authentication failed. Invalid username or password.` | | `path` | string | No | API path that generated the error | `/api/v1/auth/login` | | `code` | string | No | Specific error code | `LE_ERR_SS_301` | ### 500 — Internal server error | Field | Type | Required | Description | Example | |-------|------|----------|-------------|---------| | `code` | string | No | Top-level error code | `LE_ERR_SS_500` | | `errors` | array\ | No | List of error details See **ErrorDetailToken500VO** below. | — | #### ErrorDetailToken500VO | Field | Type | Required | Description | Example | |-------|------|----------|-------------|---------| | `message` | string | No | Detailed error message | `Internal Server Error` | | `path` | string | No | API path that generated the error | `null` | | `code` | string | No | Specific error code | `null` | ### Sample Response (200) ```json { "code": "LE_SS_301", "message": "Authentication successful.", "data": { "username": "admin@leegality.com", "name": "TestUser123", "organization": { "id": "string", "name": "TestOrganization", "createdAt": "string", "updatedAt": "string", "enabled": false }, "accessToken": "eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJhZG1pbkBsZWVnYWxpdHkuY29tIiwiaWF0IjoxNzY1NTI0NzA1LCJleHAiOjE3NjU1MjgzMDV9.v0dYZq57hlao2eHQY9l4bUxW6JnL3EUIpm21clU45F4", "tokenType": "Bearer", "expiresIn": 3600, "authorities": [ "writeCertificate", "readNotificationRule", "updateOAuth2Client", "searchDocument", "readEntitlement", "writeCertificateNotificationConfig", "deletePasswordPolicy", "writeDepartment", "deleteSettings", "readUser", "writeRoleEntitlement", "readDocument", "admin_deleteUser", "writeNotificationConfig", "readLicense", "writeSettings", "writeOrganization", "writeRole", "writeEmail", "deleteCertificateNotificationConfig", "deleteCertificate", "readSettings", "readOAuth2Client", "deleteRoleEntitlement", "readOrganization", "readCertificateNotificationConfig", "readRole", "readRoleEntitlement", "writeUser", "readPasswordPolicy", "readCertificate", "installLicense", "deleteNotificationConfig", "deleteRole", "readDepartment", "readAuditLog", "writeNotificationRule", "readNotificationConfig", "writePasswordPolicy", "admin_writeUser", "deleteDepartment", "deleteOAuth2Client", "signDocument", "writeOAuth2Client" ], "roles": [ { "id": "b0af5f43-7f34-4ea4-867a-10115642f354", "name": "Admin", "createdAt": "2025-12-15T10:20:30Z", "entitlements": [ { "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "name": "DOCUMENT_SIGN" } ] } ], "departments": [ { "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "name": "Human Resources", "enabled": true, "createdAt": "2025-12-15T10:20:30Z", "totalUsers": 25 } ] } } ```