Get token

POST /Auth/login — OMS API · Authentication

Generates an access token (JWT) using the provided API username and password. This token is sent to all other endpoints in the Authorization: Bearer <token> header.

  • The token duration is returned in the expire field; obtain a new one before it expires (do not call login on every request).
  • If your user is linked to multiple tenants (companies), send the tenant field; if not sent, the response will be HTTP 200, isSuccess: false, errorMesssage: "please select a tenant", and selectable tenants will be in data.
  • If username/password is incorrect, HTTP 401 is returned.

İstek gövdesi

  • tenant (string): Tenant (company) code. Mandatory if the user is linked to multiple tenants; can be left empty for single-tenant users.
  • password (string, zorunlu): User's password.
  • username (string, zorunlu): API username provided to you.

Yanıtlar

  • 200: Request processed. Token is valid only if isSuccess: true.
  • 400: Body validation failed (missing required field, type mismatch, or malformed JSON). Response is in ASP.NET Core ValidationProblemDetails format; the errors field indicates which fields are invalid.
  • 401: Incorrect username/password or user inactive/without role.
  • 500: Unexpected server error. This response returns fields in PascalCase (unlike other responses) and includes null fields.

200 yanıt alanları

  • data (string[]): Tenant codes selectable by the user in the please select a tenant case. Returned only if not empty.
  • token (string): Access token (JWT). Sent in subsequent requests as Authorization: Bearer <token>. null on failure.
  • expire (string<date-time>): Token expiration time (UTC).
  • isSuccess (boolean, zorunlu): true if token was generated.
  • statusCode (string): Unused; returns null.
  • errorMesssage (string): Reason token was not generated: please select a tenant (multiple tenants, send tenant), user does not have a tenant, or inactive/user without role message. Returned only if not empty.