---
title: "Login"
method: POST
path: "/auth/login"
tags: ["Authentication"]
---

# Login

`POST /auth/login`

There is a clean Login and Logout process associated with the Authentication process. Before you can  Login, you need to obtain credentials from ShopBack - provided after registering a set of valid merchant details.

## Headers

- `X-ShopBack-Idempotent-Id` string

## Request body

- LoginRequest
  - `username` string, required — This will be the merchant ID provided by ShopBack
  - `password` string, required — This will be the merchant secret proviced by ShopBack. TK_ for Sandbox, PK_ for Production

## Response `200`

successful operation

- LoginResponse
  - `token` string — Auth token provided by ShopBack to the merchant
  - `expiresAt` string, date-time — Token expiry

## Other responses

- `201` — Created, Entity is created successfully
- `401` — Unauthorized Access, You are providing invalid credentials
- `412` — Precondition Failed, Username/Email is already exists
- `422` — Unprocessable Entity, Could not process the entity as it has invalid data
- `500` — Internal Server Error, Something went wrong on servers's end

---

[API](https://skmtc.net/shopback/apis/online-payments-api.md) · [All operations](https://skmtc.net/shopback/apis/online-payments-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/shopback/online-payments-api/revisions/160fc287769e/schema)
