{
  "info": {
    "_postman_id": "2ec151b0-3b6c-4193-a39d-450fe68f68ce",
    "name": "MiniApp API",
    "description": "KOBIL MiniApp API — Auth, Messages, Notifications, Payments, Transactions.",
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json",
    "_exporter_id": "44493680",
    "_collection_link": "https://go.postman.co/collection/44493680-2ec151b0-3b6c-4193-a39d-450fe68f68ce?source=collection_link"
  },
  "item": [
    {
      "name": "Auth",
      "item": [
        {
          "name": "Get Access Token - Authorization Code",
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "if (pm.response.code === 200) {",
                  "    const json = pm.response.json();",
                  "    pm.collectionVariables.set('access_token', json.access_token);",
                  "}"
                ]
              }
            }
          ],
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/x-www-form-urlencoded",
                "type": "text"
              }
            ],
            "body": {
              "mode": "urlencoded",
              "urlencoded": [
                {
                  "key": "grant_type",
                  "value": "authorization_code",
                  "type": "text"
                },
                {
                  "key": "client_id",
                  "value": "f4fdbd9b-05ad-4028-884c-c6e794eef315",
                  "type": "text"
                },
                {
                  "key": "client_secret",
                  "value": "1126eb74-2e7d-45f2-8b77-5c108a927aa8",
                  "type": "text"
                },
                {
                  "key": "code",
                  "value": "{CODE}",
                  "type": "text"
                },
                {
                  "key": "redirect_uri",
                  "value": "https://myapp.example.com/callback",
                  "type": "text"
                }
              ]
            },
            "url": {
              "raw": "{{base_url}}/v1/auth/tokens/my-tenant",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "v1",
                "auth",
                "tokens",
                "my-tenant"
              ]
            }
          },
          "response": []
        },
        {
          "name": "Get Access Token - Client Credentials",
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "if (pm.response.code === 200) {",
                  "    const json = pm.response.json();",
                  "    pm.collectionVariables.set('access_token', json.access_token);",
                  "}"
                ]
              }
            }
          ],
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/x-www-form-urlencoded",
                "type": "text"
              }
            ],
            "body": {
              "mode": "urlencoded",
              "urlencoded": [
                {
                  "key": "grant_type",
                  "value": "client_credentials",
                  "type": "text"
                },
                {
                  "key": "client_id",
                  "value": "f4fdbd9b-05ad-4028-884c-c6e794eef315",
                  "type": "text"
                },
                {
                  "key": "client_secret",
                  "value": "1126eb74-2e7d-45f2-8b77-5c108a927aa8",
                  "type": "text"
                }
              ]
            },
            "url": {
              "raw": "{{base_url}}/v1/auth/tokens/my-tenant",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "v1",
                "auth",
                "tokens",
                "my-tenant"
              ]
            }
          },
          "response": []
        }
      ]
    },
    {
      "name": "Messages",
      "item": [
        {
          "name": "Send Text",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{access_token}}",
                "type": "text"
              },
              {
                "key": "Content-Type",
                "value": "application/json",
                "type": "text"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"userId\": \"7711c37c-47f1-4d8e-a664-9cdf17ba434a\",\n  \"text\": \"Your order #12345 has been confirmed.\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "url": {
              "raw": "{{base_url}}/v1/messages/sendText",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "v1",
                "messages",
                "sendText"
              ]
            }
          },
          "response": []
        },
        {
          "name": "Send Choice",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{access_token}}",
                "type": "text"
              },
              {
                "key": "Content-Type",
                "value": "application/json",
                "type": "text"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"userId\": \"7711c37c-47f1-4d8e-a664-9cdf17ba434a\",\n  \"text\": \"Your package is ready. How would you like to receive it?\",\n  \"choices\": [\n    {\n      \"choiceId\": \"pickup\",\n      \"label\": \"Pick up in store\"\n    },\n    {\n      \"choiceId\": \"deliver\",\n      \"label\": \"Deliver to my address\"\n    }\n  ],\n  \"callbackUrl\": \"https://miniapp.example.com/messages/callback\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "url": {
              "raw": "{{base_url}}/v1/messages/sendChoice",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "v1",
                "messages",
                "sendChoice"
              ]
            }
          },
          "response": []
        },
        {
          "name": "Send File",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{access_token}}",
                "type": "text"
              }
            ],
            "body": {
              "mode": "formdata",
              "formdata": [
                {
                  "key": "file",
                  "type": "file",
                  "value": null
                },
                {
                  "key": "message",
                  "value": "{\"userId\": \"7711c37c-47f1-4d8e-a664-9cdf17ba434a\", \"text\": \"Here is your invoice\", \"push\": {\"title\": \"Invoice\", \"body\": \"Your invoice is ready\"}}",
                  "type": "text"
                }
              ]
            },
            "url": {
              "raw": "{{base_url}}/v1/messages/sendFile",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "v1",
                "messages",
                "sendFile"
              ]
            }
          },
          "response": []
        },
        {
          "name": "Send Media",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{access_token}}",
                "type": "text"
              }
            ],
            "body": {
              "mode": "formdata",
              "formdata": [
                {
                  "key": "file",
                  "type": "file",
                  "value": null
                },
                {
                  "key": "message",
                  "value": "{\"userId\": \"7711c37c-47f1-4d8e-a664-9cdf17ba434a\", \"text\": \"Check this out\", \"push\": {\"title\": \"New Photo\", \"body\": \"You received a photo\"}}",
                  "type": "text"
                }
              ]
            },
            "url": {
              "raw": "{{base_url}}/v1/messages/sendMedia",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "v1",
                "messages",
                "sendMedia"
              ]
            }
          },
          "response": []
        },
        {
          "name": "Send MiniApp Link",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{access_token}}",
                "type": "text"
              },
              {
                "key": "Content-Type",
                "value": "application/json",
                "type": "text"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"userId\": \"7711c37c-47f1-4d8e-a664-9cdf17ba434a\",\n  \"text\": \"Your appointment is confirmed — tap below to view the details.\",\n  \"miniappId\": \"appointments-app\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "url": {
              "raw": "{{base_url}}/v1/messages/sendMiniAppLink",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "v1",
                "messages",
                "sendMiniAppLink"
              ]
            }
          },
          "response": []
        },
        {
          "name": "PDF Signature",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{access_token}}",
                "type": "text"
              }
            ],
            "body": {
              "mode": "formdata",
              "formdata": [
                {
                  "key": "file",
                  "type": "file",
                  "value": null
                },
                {
                  "key": "message",
                  "value": "{\"userId\": \"7711c37c-47f1-4d8e-a664-9cdf17ba434a\", \"text\": \"Please sign the contract\", \"signature\": [{\"signeeUserId\": \"7711c37c-47f1-4d8e-a664-9cdf17ba434a\", \"position\": {\"page\": 1, \"left\": 0.4, \"top\": 0.47, \"width\": 0.2, \"height\": 0.06}}], \"callbackUrl\": \"https://miniapp.example.com/messages/callback\", \"push\": {\"title\": \"Signature Required\", \"body\": \"Please sign the contract\"}}",
                  "type": "text"
                }
              ]
            },
            "url": {
              "raw": "{{base_url}}/v1/messages/sendPdfSignature",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "v1",
                "messages",
                "sendPdfSignature"
              ]
            }
          },
          "response": []
        },
        {
          "name": "Download Media",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{access_token}}",
                "type": "text"
              }
            ],
            "url": {
              "raw": "{{base_url}}/v1/media/550e8400-e29b-41d4-a716-446655440000",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "v1",
                "media",
                "550e8400-e29b-41d4-a716-446655440000"
              ]
            }
          },
          "response": []
        }
      ]
    },
    {
      "name": "Notifications",
      "item": [
        {
          "name": "Push Notifications",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{access_token}}",
                "type": "text"
              },
              {
                "key": "Content-Type",
                "value": "application/json",
                "type": "text"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"userId\": \"7711c37c-47f1-4d8e-a664-9cdf17ba434a\",\n  \"content\": {\n    \"title\": \"Security Alert\",\n    \"body\": \"New login detected from unknown device\",\n    \"priority\": \"high\",\n    \"ttl\": 3600\n  }\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "url": {
              "raw": "{{base_url}}/v1/notifications/sendPush",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "v1",
                "notifications",
                "sendPush"
              ]
            }
          },
          "response": []
        }
      ]
    },
    {
      "name": "Payments",
      "item": [
        {
          "name": "Start Payment",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{access_token}}",
                "type": "text"
              },
              {
                "key": "Idempotency-Key",
                "value": "{{$guid}}",
                "type": "text"
              },
              {
                "key": "Content-Type",
                "value": "application/json",
                "type": "text"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"userId\": \"7711c37c-47f1-4d8e-a664-9cdf17ba434a\",\n  \"merchantId\": \"87294282-1ff7-4b35-92be-5a7b900732e6\",\n  \"amount\": {\n    \"value\": \"2966.98\",\n    \"currency\": \"USD\"\n  },\n  \"callbackUrl\": \"https://miniapp.example.com/payments/callback\",\n  \"paymentContent\": [\n    [\n      {\n        \"key\": \"1 night, Superior King Room\",\n        \"value\": \"$2,966.98\"\n      }\n    ]\n  ],\n  \"timeoutSeconds\": 900\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "url": {
              "raw": "{{base_url}}/v1/payments/start",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "v1",
                "payments",
                "start"
              ]
            }
          },
          "response": []
        },
        {
          "name": "Start Pre-Auth",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{access_token}}",
                "type": "text"
              },
              {
                "key": "Idempotency-Key",
                "value": "{{$guid}}",
                "type": "text"
              },
              {
                "key": "Content-Type",
                "value": "application/json",
                "type": "text"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"userId\": \"7711c37c-47f1-4d8e-a664-9cdf17ba434a\",\n  \"merchantId\": \"87294282-1ff7-4b35-92be-5a7b900732e6\",\n  \"amount\": {\n    \"value\": \"2966.98\",\n    \"currency\": \"USD\"\n  },\n  \"callbackUrl\": \"https://miniapp.example.com/payments/callback\",\n  \"paymentContent\": [\n    [\n      {\n        \"key\": \"1 night, Superior King Room\",\n        \"value\": \"$2,966.98\"\n      }\n    ]\n  ],\n  \"timeoutSeconds\": 900\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "url": {
              "raw": "{{base_url}}/v1/payments/startPreAuth",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "v1",
                "payments",
                "startPreAuth"
              ]
            }
          },
          "response": []
        },
        {
          "name": "Capture Payment",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{access_token}}",
                "type": "text"
              },
              {
                "key": "Idempotency-Key",
                "value": "{{$guid}}",
                "type": "text"
              },
              {
                "key": "Content-Type",
                "value": "application/json",
                "type": "text"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"amount\": {\n    \"value\": \"2966.98\",\n    \"currency\": \"USD\"\n  },\n  \"callbackUrl\": \"https://miniapp.example.com/payments/callback\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "url": {
              "raw": "{{base_url}}/v1/payments/c052bf87-1cb9-4ae0-aa12-33709a00ea5a/capture",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "v1",
                "payments",
                "c052bf87-1cb9-4ae0-aa12-33709a00ea5a",
                "capture"
              ]
            }
          },
          "response": []
        },
        {
          "name": "Cancel Payment",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{access_token}}",
                "type": "text"
              },
              {
                "key": "Idempotency-Key",
                "value": "{{$guid}}",
                "type": "text"
              },
              {
                "key": "Content-Type",
                "value": "application/json",
                "type": "text"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"userId\": \"7711c37c-47f1-4d8e-a664-9cdf17ba434a\",\n  \"merchantId\": \"87294282-1ff7-4b35-92be-5a7b900732e6\",\n  \"callbackUrl\": \"https://miniapp.example.com/payments/callback\",\n  \"reason\": \"User cancelled at checkout\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "url": {
              "raw": "{{base_url}}/v1/payments/c052bf87-1cb9-4ae0-aa12-33709a00ea5a/cancel",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "v1",
                "payments",
                "c052bf87-1cb9-4ae0-aa12-33709a00ea5a",
                "cancel"
              ]
            }
          },
          "response": []
        },
        {
          "name": "Refund Payment",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{access_token}}",
                "type": "text"
              },
              {
                "key": "Idempotency-Key",
                "value": "{{$guid}}",
                "type": "text"
              },
              {
                "key": "Content-Type",
                "value": "application/json",
                "type": "text"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"userId\": \"7711c37c-47f1-4d8e-a664-9cdf17ba434a\",\n  \"merchantId\": \"87294282-1ff7-4b35-92be-5a7b900732e6\",\n  \"amount\": {\n    \"value\": \"2966.98\",\n    \"currency\": \"USD\"\n  },\n  \"callbackUrl\": \"https://miniapp.example.com/payments/callback\",\n  \"reason\": \"Customer returned item\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "url": {
              "raw": "{{base_url}}/v1/payments/c052bf87-1cb9-4ae0-aa12-33709a00ea5a/refund",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "v1",
                "payments",
                "c052bf87-1cb9-4ae0-aa12-33709a00ea5a",
                "refund"
              ]
            }
          },
          "response": []
        },
        {
          "name": "Check Status",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{access_token}}",
                "type": "text"
              },
              {
                "key": "Content-Type",
                "value": "application/json",
                "type": "text"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"merchantId\": \"87294282-1ff7-4b35-92be-5a7b900732e6\",\n  \"callbackUrl\": \"https://miniapp.example.com/payments/callback\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "url": {
              "raw": "{{base_url}}/v1/payments/c052bf87-1cb9-4ae0-aa12-33709a00ea5a/checkStatus",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "v1",
                "payments",
                "c052bf87-1cb9-4ae0-aa12-33709a00ea5a",
                "checkStatus"
              ]
            }
          },
          "response": []
        }
      ]
    },
    {
      "name": "Transactions",
      "item": [
        {
          "name": "Start TMS",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{access_token}}",
                "type": "text"
              },
              {
                "key": "Content-Type",
                "value": "application/json",
                "type": "text"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"userId\": \"7711c37c-47f1-4d8e-a664-9cdf17ba434a\",\n  \"tmsData\": {\n    \"text\": \"Confirm payment of 100.50 EUR\",\n    \"external\": false,\n    \"data\": {\n      \"orderId\": \"ord_1\"\n    }\n  },\n  \"retrievalTimeout\": 300,\n  \"tmsTimeout\": 600,\n  \"auditMessage\": \"Checkout confirmation\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "url": {
              "raw": "{{base_url}}/v1/transactions/startTms",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "v1",
                "transactions",
                "startTms"
              ]
            }
          },
          "response": []
        },
        {
          "name": "TMS Status",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{access_token}}",
                "type": "text"
              }
            ],
            "url": {
              "raw": "{{base_url}}/v1/transactions/tms/01JKT9ZRZT6Q2M0GC9JC1D6HTX/status",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "v1",
                "transactions",
                "tms",
                "01JKT9ZRZT6Q2M0GC9JC1D6HTX",
                "status"
              ]
            }
          },
          "response": []
        },
        {
          "name": "TMS Result",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{access_token}}",
                "type": "text"
              }
            ],
            "url": {
              "raw": "{{base_url}}/v1/transactions/tms/01JKT9ZRZT6Q2M0GC9JC1D6HTX/result",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "v1",
                "transactions",
                "tms",
                "01JKT9ZRZT6Q2M0GC9JC1D6HTX",
                "result"
              ]
            }
          },
          "response": []
        }
      ]
    }
  ],
  "variable": [
    {
      "key": "base_url",
      "value": ""
    },
    {
      "key": "access_token",
      "value": ""
    }
  ]
}
