---
# System prepended metadata

title: Somany Mittr Admin API

---

# Somany Mittr Admin API

Base URL: ```https://somany-mittr-backend.herokuapp.com```

## Log In

### Get OTP

**[POST]:** ```/users/get_otp```

**Body:**

```json=
{
  "user_mobile_number":"9811874801"	
}
```

**Response:**

```json=
{
  "otp": "1572"
}
```

### Log In

**[POST]:** ```/tokens.json```

**Body:**

```json=
{
  "user_mobile_number":"9811874801",
  "otp":"1572"
}
```

**Response:**

```json=
{
	"token": "eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOjJ9.TffSzrDTqFVA-yXUoqiN5SPU65ljZ45HhCPbMjp4ogg",
	"user": {
		"user_first_name": "Shrivatsa",
		"user_last_name": "Somany",
		"user_type": 0
	}
}
```

**Note:** user_type 0 = ASM, 2 = State Head

## Signups

### Get Signups

**[GET]:** ```/signups.json```

**Headers:** ```Authorization: Bearer <token>```

**Response:**

```json=
[
  {
	"id": 3,
	"id_number": "123467AVC",
	"id_image_front": "https://somanymittrapp131119-dev.s3.ap-south-1.amazonaws.com/Capture.PNG",
	"id_image_back": "https://somanymittrapp131119-dev.s3.ap-south-1.amazonaws.com/Capture_Back.PNG",
	"mobile_number": "9818346665"
  }
]
```

### Approve Signup

**[POST]:** ```/signups/approve_signup.json```

**Headers:** ```Authorization: Bearer <token>```

**Body:**

```json=
{
    "id":<signup_id>,
    "first_name":"Shrivatsa",
    "last_name":"Somany",
    "dob":"yyyy-mm-dd",
    "mobile_number":"9811874801",
    "id_number":"1234567AVC",
    "id_image_front":<some_image_url.xyz>,
    "zone_id":<zone_id>
}
```

**Response:**

200 OK:```{"success":"successfully signed up"}```

422 Unprocessible Entity: ```{"error":"error approving signup", "error_details":"<some_details>"}```

404 Not Found: ```{"error":"please check the signup id"}```

### Reject Signup

**[POST]:** ```/signups/reject_signup.json```

**Headers:** ```Authorization: Bearer <token>```

**Body:**

```json=
{
    "id":<signup_id>
}
```

**Response:**

200 OK: ```{"status":"rejection successful"}```

404 Not Found: ```{"error":"please check the signup id"}```

## Transaction Verifications

### Get all unverified transactions

**[GET]:** ```/transactions/unverified_transactions.json```

**Headers:** ```Authorization: Bearer <token>```
    
**Response:**
    
```json=
[
    {
		"id": 1,
		"transaction_points": 1000,
		"transaction_status": 1,
		"user_id": 4,
		"user_name": "Shrivatsa Somany",
		"product_id": 4,
		"product_name": "Thistle Single Lever Faucet",
		"dealer_id": 1,
		"dealer_name": "J.B. Gupta & Sons Pvt. Ltd.",
		"dealer_pin_code": "110003",
		"bill_copies": [
			"https://somanymittrapp131119-dev.s3.ap-south-1.amazonaws.com/public/sign_ups/1630172721987",
			"https://somanymittrapp131119-dev.s3.ap-south-1.amazonaws.com/public/sign_ups/1630172721987"
		],
		"transaction_date": "2021-09-09T12:41:35.275Z"
	},
	{
		"id": 2,
		"transaction_points": 1000,
		"transaction_status": 1,
		"user_id": 4,
		"user_name": "Shrivatsa Somany",
		"product_id": 4,
		"product_name": "Thistle Single Lever Faucet",
		"dealer_id": 1,
		"dealer_name": "J.B. Gupta & Sons Pvt. Ltd.",
		"dealer_pin_code": "110003",
		"bill_copies": [
			"https://somanymittrapp131119-dev.s3.ap-south-1.amazonaws.com/public/sign_ups/1630172721987",
			"https://somanymittrapp131119-dev.s3.ap-south-1.amazonaws.com/public/sign_ups/1630172721987"
		],
		"transaction_date": "2021-09-10T17:14:33.049Z"
	},
	{
		"id": 3,
		"transaction_points": 1000,
		"transaction_status": 1,
		"user_id": 4,
		"user_name": "Shrivatsa Somany",
		"product_id": 4,
		"product_name": "Thistle Single Lever Faucet",
		"dealer_id": 1,
		"dealer_name": "J.B. Gupta & Sons Pvt. Ltd.",
		"dealer_pin_code": "110003",
		"bill_copies": [
			"https://somanymittrapp131119-dev.s3.ap-south-1.amazonaws.com/public/sign_ups/1630172721987",
			"https://somanymittrapp131119-dev.s3.ap-south-1.amazonaws.com/public/sign_ups/1630172721987"
		],
		"transaction_date": "2021-09-10T17:14:40.212Z"
	}
]
```

### Get all verified transactions

**[GET]:** ```/transactions/verified_transactions.json```

**Headers:** ```Authorization: Bearer <token>```
    
**Response:**
    
```json=
[
    {
		"id": 1,
		"transaction_points": 1000,
		"transaction_status": 2,
		"user_id": 4,
		"user_name": "Shrivatsa Somany",
		"product_id": 4,
		"product_name": "Thistle Single Lever Faucet",
		"dealer_id": 1,
		"dealer_name": "J.B. Gupta & Sons Pvt. Ltd.",
		"dealer_pin_code": "110003",
		"bill_copies": [
			"https://somanymittrapp131119-dev.s3.ap-south-1.amazonaws.com/public/sign_ups/1630172721987",
			"https://somanymittrapp131119-dev.s3.ap-south-1.amazonaws.com/public/sign_ups/1630172721987"
		],
		"transaction_date": "2021-09-09T12:41:35.275Z"
	},
	{
		"id": 2,
		"transaction_points": 1000,
		"transaction_status": 2,
		"user_id": 4,
		"user_name": "Shrivatsa Somany",
		"product_id": 4,
		"product_name": "Thistle Single Lever Faucet",
		"dealer_id": 1,
		"dealer_name": "J.B. Gupta & Sons Pvt. Ltd.",
		"dealer_pin_code": "110003",
		"bill_copies": [
			"https://somanymittrapp131119-dev.s3.ap-south-1.amazonaws.com/public/sign_ups/1630172721987",
			"https://somanymittrapp131119-dev.s3.ap-south-1.amazonaws.com/public/sign_ups/1630172721987"
		],
		"transaction_date": "2021-09-10T17:14:33.049Z"
	},
	{
		"id": 3,
		"transaction_points": 1000,
		"transaction_status": 2,
		"user_id": 4,
		"user_name": "Shrivatsa Somany",
		"product_id": 4,
		"product_name": "Thistle Single Lever Faucet",
		"dealer_id": 1,
		"dealer_name": "J.B. Gupta & Sons Pvt. Ltd.",
		"dealer_pin_code": "110003",
		"bill_copies": [
			"https://somanymittrapp131119-dev.s3.ap-south-1.amazonaws.com/public/sign_ups/1630172721987",
			"https://somanymittrapp131119-dev.s3.ap-south-1.amazonaws.com/public/sign_ups/1630172721987"
		],
		"transaction_date": "2021-09-10T17:14:40.212Z"
	}
]
```

### Get all rejected transactions

**[GET]:** ```/transactions/rejected_transactions.json```

**Headers:** ```Authorization: Bearer <token>```
    
**Response:**
    
```json=
[
    {
		"id": 1,
		"transaction_points": 1000,
		"transaction_status": 3,
		"user_id": 4,
		"user_name": "Shrivatsa Somany",
		"product_id": 4,
		"product_name": "Thistle Single Lever Faucet",
		"dealer_id": 1,
		"dealer_name": "J.B. Gupta & Sons Pvt. Ltd.",
		"dealer_pin_code": "110003",
		"bill_copies": [
			"https://somanymittrapp131119-dev.s3.ap-south-1.amazonaws.com/public/sign_ups/1630172721987",
			"https://somanymittrapp131119-dev.s3.ap-south-1.amazonaws.com/public/sign_ups/1630172721987"
		],
		"transaction_date": "2021-09-09T12:41:35.275Z",
        "rejection_reason": "Ate too much gobi"
	},
	{
		"id": 2,
		"transaction_points": 1000,
		"transaction_status": 3,
		"user_id": 4,
		"user_name": "Shrivatsa Somany",
		"product_id": 4,
		"product_name": "Thistle Single Lever Faucet",
		"dealer_id": 1,
		"dealer_name": "J.B. Gupta & Sons Pvt. Ltd.",
		"dealer_pin_code": "110003",
		"bill_copies": [
			"https://somanymittrapp131119-dev.s3.ap-south-1.amazonaws.com/public/sign_ups/1630172721987",
			"https://somanymittrapp131119-dev.s3.ap-south-1.amazonaws.com/public/sign_ups/1630172721987"
		],
		"transaction_date": "2021-09-10T17:14:33.049Z",
        "rejection_reason": "Ate too much aloo"

	},
	{
		"id": 3,
		"transaction_points": 1000,
		"transaction_status": 3,
		"user_id": 4,
		"user_name": "Shrivatsa Somany",
		"product_id": 4,
		"product_name": "Thistle Single Lever Faucet",
		"dealer_id": 1,
		"dealer_name": "J.B. Gupta & Sons Pvt. Ltd.",
		"dealer_pin_code": "110003",
		"bill_copies": [
			"https://somanymittrapp131119-dev.s3.ap-south-1.amazonaws.com/public/sign_ups/1630172721987",
			"https://somanymittrapp131119-dev.s3.ap-south-1.amazonaws.com/public/sign_ups/1630172721987"
		],
		"transaction_date": "2021-09-10T17:14:40.212Z",
        "rejection_reason": "Ate too much mooli, mouth stinks."

	}
]
```

### Verify Transaction

**[POST]:** ```/transactions/verify_transaction.json```

**Headers:** ```Authorization: Bearer <token>```

**Body:**

```json=
{
    "id": <transaction_id>,
}
```

**Response:**

200 OK: ```"status":"successfully verified", "user_verified_balance":500```

404 Not Found: ```{"error":"transaction not found"}```

401 Unauthorized

### Reject Transaction

**[POST]:** ```/transactions/reject_transaction.json```

**Headers:** ```Authorization: Bearer <token>```

**Body:**

```json=
{
    "id": <transaction_id>,
    "rejection_reason":"Ate too much gobi"
}
```

**Response:**

200 OK: ```"status":"successfully rejected", "user_verified_balance":500```

404 Not Found: ```{"error":"transaction not found"}```

401 Unauthorized

### Zones
**[GET]:** ```/zones.json```

**Headers:** ```Authorization: Bearer <token>```

**Response:**

```json=
[
	{
		"id": 4,
		"zone_name": "South II",
		"zone_abbreviation": "STH2",
		"zone_state_head_name": "Arun Kumar"
	},
	{
		"id": 5,
		"zone_name": "South",
		"zone_abbreviation": "STH",
		"zone_state_head_name": null
	},
	{
		"id": 6,
		"zone_name": "EAST",
		"zone_abbreviation": "EST",
		"zone_state_head_name": null
	},
	{
		"id": 7,
		"zone_name": "NORTH",
		"zone_abbreviation": "NTH",
		"zone_state_head_name": null
	}
]
```