> For the complete documentation index, see [llms.txt](https://tsanet.gitbook.io/connect/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://tsanet.gitbook.io/connect/api-reference/identity.md).

# Identity

Authentication and user management

## POST /v1/login

> Login to the API

```json
{"openapi":"3.0.1","info":{"title":"OpenAPI definition","version":"v0"},"tags":[{"name":"Identity","description":"Authentication and user management"}],"servers":[{"url":"http://connect2.tsanet.org","description":"Generated server url"}],"paths":{"/v1/login":{"post":{"tags":["Identity"],"summary":"Login to the API","operationId":"login","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LoginRequestDTO"}}},"required":true},"responses":{"200":{"description":"Successful login","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TokenDTO"}},"application/problem+json":{"schema":{"$ref":"#/components/schemas/TokenDTO"}}}},"400":{"description":"Bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}},"application/problem+json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}},"application/problem+json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}}},"components":{"schemas":{"LoginRequestDTO":{"required":["password","username"],"type":"object","properties":{"username":{"type":"string","description":"Username for authentication"},"password":{"type":"string","description":"Password for authentication"}}},"TokenDTO":{"type":"object","properties":{"accessToken":{"type":"string","description":"JWT access token"},"tokenType":{"type":"string"},"expiresIn":{"type":"integer","format":"int32"}}},"ErrorResponse":{"type":"object","properties":{"message":{"type":"string"},"validationErrors":{"type":"array","items":{"$ref":"#/components/schemas/ValidationError"}}}},"ValidationError":{"type":"object","properties":{"field":{"type":"string"},"message":{"type":"string"}}}}}}
```

## GET /v1/me

> Get current user information

```json
{"openapi":"3.0.1","info":{"title":"OpenAPI definition","version":"v0"},"tags":[{"name":"Identity","description":"Authentication and user management"}],"servers":[{"url":"http://connect2.tsanet.org","description":"Generated server url"}],"security":[{"bearerAuth":[]}],"paths":{"/v1/me":{"get":{"tags":["Identity"],"summary":"Get current user information","operationId":"getCurrentUser","responses":{"200":{"description":"Current user information","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserContextDTO"}},"application/problem+json":{"schema":{"$ref":"#/components/schemas/UserContextDTO"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}},"application/problem+json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}}},"components":{"schemas":{"UserContextDTO":{"type":"object","properties":{"company":{"$ref":"#/components/schemas/CompanyDTO"},"user":{"$ref":"#/components/schemas/UserDTO"}}},"CompanyDTO":{"type":"object","properties":{"id":{"type":"integer","format":"int64"},"name":{"type":"string"},"description":{"type":"string"},"domain":{"type":"string"}}},"UserDTO":{"type":"object","properties":{"id":{"type":"integer","format":"int64"},"username":{"type":"string"},"firstName":{"type":"string"},"lastName":{"type":"string"},"email":{"type":"string"},"phone":{"type":"string"},"phoneCountryCode":{"type":"string"},"city":{"type":"string"},"emailCheckFailData":{"type":"string"}}},"ErrorResponse":{"type":"object","properties":{"message":{"type":"string"},"validationErrors":{"type":"array","items":{"$ref":"#/components/schemas/ValidationError"}}}},"ValidationError":{"type":"object","properties":{"field":{"type":"string"},"message":{"type":"string"}}}}}}
```
