{"info":{"_postman_id":"d4e7aacb-9943-4499-8a07-633490ff5cbd","name":"TMS V3","description":"<html><head></head><body><h1 id=\"tms-v3-integration-collection\">TMS V3 (Integration Collection)</h1>\n<p>This collection contains integration endpoints used between external systems (e.g., HIS) and TMS/Odoo.</p>\n<h2 id=\"getting-started\">Getting started</h2>\n<ol>\n<li><p>Select the environment <strong>TMS-DEV</strong>.</p>\n</li>\n<li><p>Ensure the following environment variables are set:</p>\n</li>\n</ol>\n<div class=\"click-to-expand-wrapper is-table-wrapper\"><table>\n<thead>\n<tr>\n<th>Variable</th>\n<th>Description</th>\n<th>Example</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td><code>Base_URL</code></td>\n<td>API host (scheme + hostname [+ port])</td>\n<td><code>https://tms-dev.vgroupth.com</code></td>\n</tr>\n<tr>\n<td><code>Base_PATH</code></td>\n<td>Base path / prefix (often includes versioning)</td>\n<td><code>/api/v3</code></td>\n</tr>\n<tr>\n<td><code>APIKey</code></td>\n<td>API key used for requests (sent as <code>x-api-key</code>)</td>\n<td><code>****</code></td>\n</tr>\n<tr>\n<td><code>Login</code></td>\n<td>Username (used by authentication request if applicable)</td>\n<td><code>integration_user</code></td>\n</tr>\n<tr>\n<td><code>password</code></td>\n<td>Password (used by authentication request if applicable)</td>\n<td><code>****</code></td>\n</tr>\n</tbody>\n</table>\n</div><blockquote>\n<p>Tip: keep <code>Base_URL</code> without a trailing slash and <code>Base_PATH</code> with a leading slash (or vice-versa), but be consistent so <code>{{Base_URL}}{{Base_PATH}}/...</code> resolves correctly. </p>\n</blockquote>\n<h2 id=\"authentication\">Authentication</h2>\n<p>Most requests in this collection expect an API key in the header:</p>\n<ul>\n<li><code>x-api-key:</code></li>\n</ul>\n<p>Some deployments may also require a login/session step (see <strong>IF017 Authentication</strong> folder). If your API returns a token/cookie, you can store it in an environment variable and reference it in subsequent requests.</p>\n<h2 id=\"common-headers\">Common headers</h2>\n<p>Unless stated otherwise per-request:</p>\n<ul>\n<li><p><code>Content-Type: application/json</code></p>\n</li>\n<li><p><code>Accept: application/json</code></p>\n</li>\n<li><p><code>x-api-key:</code></p>\n</li>\n</ul>\n<h2 id=\"common-errors--troubleshooting\">Common errors / troubleshooting</h2>\n<ul>\n<li><p><strong>401 / 403</strong>: missing/invalid <code>x-api-key</code>, or key does not have access to the target database/company.</p>\n</li>\n<li><p><strong>400</strong>: schema validation errors (missing required fields, wrong date formats, invalid codes).</p>\n</li>\n<li><p><strong>404</strong>: wrong <code>Base_URL</code> / <code>Base_PATH</code> or endpoint path.</p>\n</li>\n<li><p><strong>409</strong>: duplicate <code>event_id</code> / idempotency conflicts (implementation-specific).</p>\n</li>\n<li><p><strong>5xx</strong>: server error. Check server logs using <code>meta.correlation_id</code>.</p>\n</li>\n</ul>\n<h2 id=\"running-the-collection\">Running the collection</h2>\n<h3 id=\"collection-runner-manual\">Collection Runner (manual)</h3>\n<ul>\n<li><p>Use <strong>Runner</strong> to execute a folder (e.g., IF008 / IF017) or the entire collection.</p>\n</li>\n<li><p>For event-driven APIs, use a data file (CSV/JSON) and parameterize fields like <code>{{mrn}}</code>, <code>{{encounter_id}}</code>, etc.</p>\n</li>\n</ul>\n<h3 id=\"postman-cli-cicd\">Postman CLI (CI/CD)</h3>\n<ol>\n<li><p>Login:</p>\n<pre class=\"click-to-expand-wrapper is-snippet-wrapper\"><code class=\"language-bash\">              postman login --with-api-key PMAK-xxxxx\n\n</code></pre>\n</li>\n<li><p>Run:</p>\n<pre class=\"click-to-expand-wrapper is-snippet-wrapper\"><code class=\"language-bash\">              postman collection run 50495697-79882afd-5e27-4d92-b8c5-42e64ca12f34 -e 50495697-2308e3a2-6d83-482b-98b5-f3616ab97189\n\n</code></pre>\n</li>\n</ol>\n<h2 id=\"folder-guide\">Folder guide</h2>\n<ul>\n<li><p><strong>IF017 Authentication</strong>: obtain/validate credentials for integrations (if required by your deployment).</p>\n</li>\n<li><p><strong>IF008 Patien Encounter</strong>: patient and encounter upsert flows.</p>\n</li>\n<li><p><strong>IF009 Stock Dispense Create</strong>: stock dispense creation events.</p>\n</li>\n<li><p><strong>IF011 Notify Stock on Hand Change</strong>: stock-on-hand notifications (if implemented).</p>\n</li>\n<li><p><strong>IF017 Transaction Update</strong>: transaction, invoice, payment, deposit, cancel flows.</p>\n</li>\n</ul>\n<h2 id=\"notes-on-request-payloads\">Notes on request payloads</h2>\n<p>Most event-style endpoints follow an envelope pattern:</p>\n<ul>\n<li><p><code>meta</code>: tracking fields such as <code>event_id</code> and <code>correlation_id</code></p>\n</li>\n<li><p><code>payload</code>: business content</p>\n</li>\n</ul>\n<p>When in doubt:</p>\n<ul>\n<li><p>keep <code>meta.event_id</code> unique per submission</p>\n</li>\n<li><p>reuse <code>meta.correlation_id</code> to trace a workflow across multiple related calls</p>\n</li>\n</ul>\n</body></html>","schema":"https://schema.getpostman.com/json/collection/v2.0.0/collection.json","toc":[{"content":"TMS V3 (Integration Collection)","slug":"tms-v3-integration-collection"}],"owner":"50495697","collectionId":"d4e7aacb-9943-4499-8a07-633490ff5cbd","publishedId":"2sBXinGVqR","public":true,"customColor":{"top-bar":"FFFFFF","right-sidebar":"303030","highlight":"0F9ED5"},"publishDate":"2026-03-30T09:01:20.000Z"},"item":[{"name":"IF017 Authentication","item":[{"name":"Session authenticate API","id":"2db38d31-eee5-4657-8e8b-3bf5fea9d4b4","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[],"body":{"mode":"raw","raw":"{\n    \"jsonrpc\": \"2.0\",\n    \"method\": \"call\",\n    \"params\": {\n        \"db\": \"odoo\",\n        \"login\": \"{{Login}}\",\n        \"password\": \"{{password}}\"\n    },\n    \"id\": null\n}","options":{"raw":{"language":"json"}}},"url":"https://tnh-dev.vgroupth.com/web/session/authenticate","urlObject":{"protocol":"https","path":["web","session","authenticate"],"host":["tnh-dev","vgroupth","com"],"query":[],"variable":[]}},"response":[{"id":"867611a6-c1c9-409a-ac31-039a149eaaeb","name":"200 OK","originalRequest":{"method":"POST","header":[],"body":{"mode":"raw","raw":"{\n    \"jsonrpc\": \"2.0\",\n    \"method\": \"call\",\n    \"params\": {\n        \"db\": \"tnh_odoo\",\n        \"login\": \"{{Login}}\",\n        \"password\": \"{{password}}\"\n    },\n    \"id\": null\n}","options":{"raw":{"language":"json"}}},"url":"https://tnh-dev.vgroupth.com/web/session/authenticate"},"status":"OK","code":200,"_postman_previewlanguage":"Text","header":[{"key":"Server","value":"nginx"},{"key":"Date","value":"Fri, 20 Feb 2026 09:24:30 GMT"},{"key":"Content-Type","value":"application/json; charset=utf-8"},{"key":"Content-Length","value":"4613"},{"key":"Connection","value":"keep-alive"},{"key":"Set-Cookie","value":"session_id=HOmdk0sruQxXwwYwedtgwRKDou5oRskQ8vPLWvpqc2tpIcbWFehEq0uGXzqsZ7eqSCrRylYtwZKAxLuPhYAN; Expires=Sat, 20 Feb 2027 09:24:30 GMT; Max-Age=604800; HttpOnly; Path=/"},{"key":"X-Content-Type-Options","value":"nosniff"},{"key":"Strict-Transport-Security","value":"max-age=31536000"}],"cookie":[],"responseTime":null,"body":"{\n    \"jsonrpc\": \"2.0\",\n    \"id\": null,\n    \"result\": {\n        \"uid\": 2,\n        \"is_system\": true,\n        \"is_admin\": true,\n        \"is_public\": false,\n        \"is_internal_user\": true,\n        \"user_context\": {\n            \"lang\": \"en_US\",\n            \"tz\": \"Europe/Brussels\",\n            \"uid\": 2\n        },\n        \"db\": \"tnh_odoo\",\n        \"user_settings\": {\n            \"id\": 1,\n            \"user_id\": {\n                \"id\": 2\n            },\n            \"homemenu_config\": false,\n            \"is_discuss_sidebar_category_channel_open\": true,\n            \"is_discuss_sidebar_category_chat_open\": true,\n            \"push_to_talk_key\": false,\n            \"use_push_to_talk\": false,\n            \"voice_active_duration\": 200,\n            \"channel_notifications\": false,\n            \"mute_until_dt\": false,\n            \"volumes\": [\n                [\n                    \"ADD\",\n                    []\n                ]\n            ]\n        },\n        \"server_version\": \"18.0+e-20260119\",\n        \"server_version_info\": [\n            18,\n            0,\n            0,\n            \"final\",\n            0,\n            \"e\"\n        ],\n        \"support_url\": \"https://www.odoo.com/help\",\n        \"name\": \"Mitchell Admin\",\n        \"username\": \"admin\",\n        \"quick_login\": true,\n        \"partner_write_date\": \"2026-02-20 04:45:59\",\n        \"partner_display_name\": \"YourCompany, Mitchell Admin\",\n        \"partner_id\": 3,\n        \"web.base.url\": \"http://tnh-dev.vgroupth.com\",\n        \"active_ids_limit\": 20000,\n        \"profile_session\": null,\n        \"profile_collectors\": null,\n        \"profile_params\": null,\n        \"max_file_upload_size\": 134217728,\n        \"home_action_id\": false,\n        \"cache_hashes\": {\n            \"translations\": \"91852925b72586102d9b84bcd4000b614c4d117a\",\n            \"load_menus\": \"bae04723286021d3e70c9608115dd1695f4c013c0e73f90346fb50838bfaa391\"\n        },\n        \"currencies\": {\n            \"1\": {\n                \"symbol\": \"$\",\n                \"position\": \"before\",\n                \"digits\": [\n                    69,\n                    2\n                ]\n            }\n        },\n        \"bundle_params\": {\n            \"lang\": \"en_US\"\n        },\n        \"test_mode\": false,\n        \"view_info\": {\n            \"list\": {\n                \"display_name\": \"List\",\n                \"icon\": \"oi oi-view-list\",\n                \"multi_record\": true\n            },\n            \"form\": {\n                \"display_name\": \"Form\",\n                \"icon\": \"fa fa-address-card\",\n                \"multi_record\": false\n            },\n            \"graph\": {\n                \"display_name\": \"Graph\",\n                \"icon\": \"fa fa-area-chart\",\n                \"multi_record\": true\n            },\n            \"pivot\": {\n                \"display_name\": \"Pivot\",\n                \"icon\": \"oi oi-view-pivot\",\n                \"multi_record\": true\n            },\n            \"calendar\": {\n                \"display_name\": \"Calendar\",\n                \"icon\": \"fa fa-calendar\",\n                \"multi_record\": true\n            },\n            \"kanban\": {\n                \"display_name\": \"Kanban\",\n                \"icon\": \"oi oi-view-kanban\",\n                \"multi_record\": true\n            },\n            \"search\": {\n                \"display_name\": \"Search\",\n                \"icon\": \"oi oi-search\",\n                \"multi_record\": true\n            },\n            \"cohort\": {\n                \"display_name\": \"Cohort\",\n                \"icon\": \"oi oi-view-cohort\",\n                \"multi_record\": true\n            },\n            \"gantt\": {\n                \"display_name\": \"Gantt\",\n                \"icon\": \"fa fa-tasks\",\n                \"multi_record\": true\n            },\n            \"grid\": {\n                \"display_name\": \"Grid\",\n                \"icon\": \"fa fa-th\",\n                \"multi_record\": true\n            },\n            \"map\": {\n                \"display_name\": \"Map\",\n                \"icon\": \"fa fa-map-marker\",\n                \"multi_record\": true\n            },\n            \"activity\": {\n                \"display_name\": \"Activity\",\n                \"icon\": \"fa fa-clock-o\",\n                \"multi_record\": true\n            },\n            \"hierarchy\": {\n                \"display_name\": \"Hierarchy\",\n                \"icon\": \"fa fa-share-alt fa-rotate-90\",\n                \"multi_record\": true\n            }\n        },\n        \"user_companies\": {\n            \"current_company\": 1,\n            \"allowed_companies\": {\n                \"1\": {\n                    \"id\": 1,\n                    \"name\": \"My Company (San Francisco)\",\n                    \"sequence\": 0,\n                    \"child_ids\": [],\n                    \"parent_id\": false\n                },\n                \"2\": {\n                    \"id\": 2,\n                    \"name\": \"My Company (Chicago)\",\n                    \"sequence\": 10,\n                    \"child_ids\": [],\n                    \"parent_id\": false\n                }\n            },\n            \"disallowed_ancestor_companies\": {}\n        },\n        \"show_effect\": true,\n        \"display_switch_company_menu\": true,\n        \"max_time_between_keys_in_ms\": 100,\n        \"websocket_worker_version\": \"18.0-7\",\n        \"tour_enabled\": false,\n        \"current_tour\": null,\n        \"warning\": \"admin\",\n        \"expiration_date\": false,\n        \"expiration_reason\": false,\n        \"map_box_token\": false,\n        \"storeData\": {\n            \"Store\": {\n                \"action_discuss_id\": 125,\n                \"channel_types_with_seen_infos\": [\n                    \"chat\",\n                    \"group\"\n                ],\n                \"hasGifPickerFeature\": false,\n                \"hasLinkPreviewFeature\": true,\n                \"hasMessageTranslationFeature\": false,\n                \"internalUserGroupId\": 1,\n                \"mt_comment_id\": 1,\n                \"odoobot\": {\n                    \"id\": 2,\n                    \"type\": \"partner\"\n                },\n                \"self\": {\n                    \"id\": 3,\n                    \"type\": \"partner\"\n                },\n                \"settings\": {\n                    \"id\": 1,\n                    \"user_id\": {\n                        \"id\": 2\n                    },\n                    \"homemenu_config\": false,\n                    \"is_discuss_sidebar_category_channel_open\": true,\n                    \"is_discuss_sidebar_category_chat_open\": true,\n                    \"push_to_talk_key\": false,\n                    \"use_push_to_talk\": false,\n                    \"voice_active_duration\": 200,\n                    \"channel_notifications\": false,\n                    \"mute_until_dt\": false,\n                    \"volumes\": [\n                        [\n                            \"ADD\",\n                            []\n                        ]\n                    ]\n                }\n            },\n            \"res.partner\": [\n                {\n                    \"active\": false,\n                    \"avatar_128_access_token\": \"d64de5d61f38092c0df5d6c5fb481b9e15ee1fcfcc8c0ec49f9499bf5bc73709o0x69be0b51\",\n                    \"email\": \"odoobot@example.com\",\n                    \"id\": 2,\n                    \"im_status\": \"bot\",\n                    \"isInternalUser\": true,\n                    \"is_company\": false,\n                    \"name\": \"OdooBot\",\n                    \"userId\": 1,\n                    \"write_date\": \"2026-02-20 04:45:59\"\n                },\n                {\n                    \"active\": true,\n                    \"avatar_128_access_token\": \"4684443cbd0e6427c994046055beae4dc9cf15690a706662e7b74e3f349887edo0x69be0c78\",\n                    \"id\": 3,\n                    \"isAdmin\": true,\n                    \"isInternalUser\": true,\n                    \"name\": \"Mitchell Admin\",\n                    \"notification_preference\": \"email\",\n                    \"signature\": \"<span data-o-mail-quote=\\\"1\\\">-- <br data-o-mail-quote=\\\"1\\\">Mitchell Admin</span>\",\n                    \"userId\": 2,\n                    \"write_date\": \"2026-02-20 04:45:59\"\n                }\n            ]\n        },\n        \"ocn_token_key\": false,\n        \"fcm_project_id\": false,\n        \"inbox_action\": 125,\n        \"iap_company_enrich\": false,\n        \"can_insert_in_spreadsheet\": false\n    }\n}"},{"id":"a3258c83-f3c9-4dcd-85f6-800ee0114f08","name":"200 Access Deny","originalRequest":{"method":"POST","header":[],"body":{"mode":"raw","raw":"{\n    \"jsonrpc\": \"2.0\",\n    \"method\": \"call\",\n    \"params\": {\n        \"db\": \"tnh_odoo\",\n        \"login\": \"{{Login}}l\",\n        \"password\": \"{{password}}\"\n    },\n    \"id\": null\n}","options":{"raw":{"language":"json"}}},"url":"https://tnh-dev.vgroupth.com/web/session/authenticate"},"status":"OK","code":200,"_postman_previewlanguage":"Text","header":[{"key":"Server","value":"nginx"},{"key":"Date","value":"Fri, 20 Feb 2026 09:28:40 GMT"},{"key":"Content-Type","value":"application/json; charset=utf-8"},{"key":"Content-Length","value":"2538"},{"key":"Connection","value":"keep-alive"},{"key":"Strict-Transport-Security","value":"max-age=31536000"}],"cookie":[],"responseTime":null,"body":"{\n    \"jsonrpc\": \"2.0\",\n    \"id\": null,\n    \"error\": {\n        \"code\": 200,\n        \"message\": \"Odoo Server Error\",\n        \"data\": {\n            \"name\": \"odoo.exceptions.AccessDenied\",\n            \"debug\": \"Traceback (most recent call last):\\n  File \\\"/usr/lib/python3/dist-packages/odoo/http.py\\\", line 2166, in _transactioning\\n    return service_model.retrying(func, env=self.env)\\n           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\\n  File \\\"/usr/lib/python3/dist-packages/odoo/service/model.py\\\", line 156, in retrying\\n    result = func()\\n             ^^^^^^\\n  File \\\"/usr/lib/python3/dist-packages/odoo/http.py\\\", line 2133, in _serve_ir_http\\n    response = self.dispatcher.dispatch(rule.endpoint, args)\\n               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\\n  File \\\"/usr/lib/python3/dist-packages/odoo/http.py\\\", line 2381, in dispatch\\n    result = self.request.registry['ir.http']._dispatch(endpoint)\\n             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\\n  File \\\"/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_http.py\\\", line 333, in _dispatch\\n    result = endpoint(**request.params)\\n             ^^^^^^^^^^^^^^^^^^^^^^^^^^\\n  File \\\"/usr/lib/python3/dist-packages/odoo/http.py\\\", line 754, in route_wrapper\\n    result = endpoint(self, *args, **params_ok)\\n             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\\n  File \\\"/usr/lib/python3/dist-packages/odoo/addons/web/controllers/session.py\\\", line 38, in authenticate\\n    auth_info = request.session.authenticate(db, credential)\\n                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\\n  File \\\"/usr/lib/python3/dist-packages/odoo/http.py\\\", line 1093, in authenticate\\n    auth_info = registry['res.users'].authenticate(dbname, credential, wsgienv)\\n                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\\n  File \\\"/usr/lib/python3/dist-packages/odoo/addons/auth_signup/models/res_users.py\\\", line 120, in authenticate\\n    auth_info = super().authenticate(db, credential, user_agent_env)\\n                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\\n  File \\\"/usr/lib/python3/dist-packages/odoo/addons/base/models/res_users.py\\\", line 967, in authenticate\\n    auth_info = cls._login(db, credential, user_agent_env=user_agent_env)\\n                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\\n  File \\\"/usr/lib/python3/dist-packages/odoo/addons/base/models/res_users.py\\\", line 935, in _login\\n    raise AccessDenied()\\nodoo.exceptions.AccessDenied: Access Denied\\n\",\n            \"message\": \"Access Denied\",\n            \"arguments\": [\n                \"Access Denied\"\n            ],\n            \"context\": {}\n        }\n    }\n}"}],"_postman_id":"2db38d31-eee5-4657-8e8b-3bf5fea9d4b4"},{"name":"Session authenticate API","id":"62abd8af-90fe-4bc3-802b-27070db63a03","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"auth":{"type":"noauth","isInherited":false},"method":"POST","header":[],"body":{"mode":"raw","raw":"{\n    \"jsonrpc\": \"2.0\",\n    \"method\": \"call\",\n    \"params\": {\n        \"db\": \"odoo\",\n        \"login\": \"{{Login}}\",\n        \"password\": \"{{password}}\"\n    },\n    \"id\": null\n}","options":{"raw":{"language":"json"}}},"url":"https://tnh-dev.vgroupth.com/web/session/authenticate","urlObject":{"protocol":"https","path":["web","session","authenticate"],"host":["tnh-dev","vgroupth","com"],"query":[],"variable":[]}},"response":[],"_postman_id":"62abd8af-90fe-4bc3-802b-27070db63a03"}],"id":"74803d2f-6f16-4fd3-b1db-55edaf9f66ab","description":"<p>Authenciation Interface.</p>\n<p>This is required in order to make interfacing call between external system and Odoo.<br />It's necessary as it's foreseeable that there must be more than 1 database per a instance in the future, e.g. On-prem UAT Environment to host both Database for UAT activities and Production Support Activitiy.</p>\n","_postman_id":"74803d2f-6f16-4fd3-b1db-55edaf9f66ab"},{"name":"IF008 Patien Encounter","item":[{"name":"Patient Only","id":"715c23d4-4b6b-4930-8068-72bf589e826b","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[{"key":"x-api-key","value":"{{APIKey}}","type":"text"}],"body":{"mode":"raw","raw":"{\n    \"meta\": {\n        \"event_id\": \"HIS-20260129-093000102\",\n        \"correlation_id\": \"c3a1c2d0-3d5a-4e6c-8e91-8a3c2fd4c9a1\",\n        \"event_type\": \"PatientEncounterUpsert\",\n        \"source_system\": \"HIS\"\n    },\n    \"payload\": {\n        \"patient\": {\n            \"mrn\": \"00998875\",\n            \"title\": \"Mr.\",\n            \"title_th\": \"นาย\",\n            \"first_name\": \"Somsak\",\n            \"last_name\": \"Deejai\",\n            \"first_name_th\": \"สมศักดิ์\",\n            \"last_name_th\": \"ดีใจ\",\n            \"gender\": \"Male\",\n            \"dob\": \"1985-12-31\",\n            \"country_code\": \"TH\",\n            \"phone\": \"081-999-8888\",\n            \"email\": \"somsak.d@email.com\",\n            \"address_full\": \"123 Sukhumvit Road, Watthana, Bangkok 10110\"\n        }\n    }\n}","options":{"raw":{"language":"json"}}},"url":"{{Base_URL}}{{Base_PATH}}/patientencounter-upsert","description":"<h2 id=\"purpose\">Purpose</h2>\n<p>Upsert (create or update) a <strong>Patient Encounter</strong> record, focusing on <strong>patient demographics</strong> within the encounter payload. This request is designed for event-driven integrations where the source system (e.g., HIS) sends an event envelope (<code>meta</code>) and the business data (<code>payload</code>).</p>\n<hr />\n<h2 id=\"endpoint\">Endpoint</h2>\n<p><strong>POST</strong> <code>{{Base_URL}}{{Base_PATH}}/patientencounter-upsert</code></p>\n<hr />\n<h2 id=\"authentication\">Authentication</h2>\n<p>This endpoint uses an API key passed via a custom header:</p>\n<ul>\n<li><code>x-api-key: {{APIKey}}</code></li>\n</ul>\n<blockquote>\n<p>Ensure the active environment has <code>APIKey</code> set. In this workspace, the active environment is <strong>TMS-DEV</strong>.</p>\n</blockquote>\n<hr />\n<h2 id=\"required-variables\">Required Variables</h2>\n<p>This request relies on the following Postman variables:</p>\n<div class=\"click-to-expand-wrapper is-table-wrapper\"><table>\n<thead>\n<tr>\n<th>Variable</th>\n<th>Purpose</th>\n<th>Example</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td><code>Base_URL</code></td>\n<td>API host / base URL</td>\n<td><code>https://api.example.com</code></td>\n</tr>\n<tr>\n<td><code>Base_PATH</code></td>\n<td>Base path / versioning segment</td>\n<td><code>/tms/v3</code></td>\n</tr>\n<tr>\n<td><code>APIKey</code></td>\n<td>API key for <code>x-api-key</code> header</td>\n<td><code>********</code></td>\n</tr>\n</tbody>\n</table>\n</div><hr />\n<h2 id=\"request-body-schema-overview\">Request Body (Schema Overview)</h2>\n<p>The request body is JSON with two top-level objects:</p>\n<ul>\n<li><code>meta</code> — event envelope and tracing metadata</li>\n<li><code>payload</code> — business data being upserted<ul>\n<li><code>payload.patient</code> — patient demographic details</li>\n</ul>\n</li>\n</ul>\n<h3 id=\"meta\"><code>meta</code></h3>\n<div class=\"click-to-expand-wrapper is-table-wrapper\"><table>\n<thead>\n<tr>\n<th>Field</th>\n<th>Type</th>\n<th>Notes</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td><code>event_id</code></td>\n<td>string</td>\n<td><strong>Must be unique</strong> per event from the source system. Recommended to be stable for idempotency.</td>\n</tr>\n<tr>\n<td><code>correlation_id</code></td>\n<td>string (UUID)</td>\n<td>Use a UUID (e.g., <code>xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx</code>) to trace a transaction across systems.</td>\n</tr>\n<tr>\n<td><code>event_type</code></td>\n<td>string</td>\n<td>Expected: <code>PatientEncounterUpsert</code></td>\n</tr>\n<tr>\n<td><code>source_system</code></td>\n<td>string</td>\n<td>Source system identifier (e.g., <code>HIS</code>).</td>\n</tr>\n</tbody>\n</table>\n</div><h3 id=\"payloadpatient\"><code>payload.patient</code></h3>\n<p>Common patient demographic fields include (not exhaustive):</p>\n<div class=\"click-to-expand-wrapper is-table-wrapper\"><table>\n<thead>\n<tr>\n<th>Field</th>\n<th>Type</th>\n<th>Notes</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td><code>mrn</code></td>\n<td>string</td>\n<td>Medical record number.</td>\n</tr>\n<tr>\n<td><code>title</code>, <code>title_th</code></td>\n<td>string</td>\n<td>Titles in English / Thai as applicable.</td>\n</tr>\n<tr>\n<td><code>first_name</code>, <code>last_name</code></td>\n<td>string</td>\n<td>English names.</td>\n</tr>\n<tr>\n<td><code>first_name_th</code>, <code>last_name_th</code></td>\n<td>string</td>\n<td>Thai names.</td>\n</tr>\n<tr>\n<td><code>gender</code></td>\n<td>string</td>\n<td>Typically <code>M</code> / <code>F</code> (confirm allowed values with API spec).</td>\n</tr>\n<tr>\n<td><code>dob</code></td>\n<td>string (date)</td>\n<td>Date of birth in <strong><code>YYYY-MM-DD</code></strong> format.</td>\n</tr>\n<tr>\n<td><code>country_code</code></td>\n<td>string</td>\n<td>ISO country code (e.g., <code>TH</code>).</td>\n</tr>\n<tr>\n<td><code>phone</code></td>\n<td>string</td>\n<td>Phone number format per local conventions.</td>\n</tr>\n<tr>\n<td><code>email</code></td>\n<td>string</td>\n<td>Email address.</td>\n</tr>\n<tr>\n<td><code>address_full</code></td>\n<td>string</td>\n<td>Full address; may be long. Consider truncation rules if any.</td>\n</tr>\n</tbody>\n</table>\n</div><hr />\n<h2 id=\"field-notes--conventions\">Field Notes &amp; Conventions</h2>\n<ul>\n<li><strong><code>meta.event_id</code></strong>: should be <strong>unique</strong> and ideally consistent for retries to support idempotent processing.</li>\n<li><strong><code>meta.correlation_id</code></strong>: should be a <strong>UUID</strong>. Generate a new one per business transaction to enable end-to-end traceability.</li>\n<li><strong>Date formats</strong>: use <strong>ISO-like</strong> formats.<ul>\n<li><code>dob</code>: <code>YYYY-MM-DD</code></li>\n<li>If your broader payload includes timestamps elsewhere, prefer <code>YYYY-MM-DDThh:mm:ss</code> with timezone as required by the API.</li>\n</ul>\n</li>\n</ul>\n<hr />\n<h2 id=\"sample-request-body\">Sample Request Body</h2>\n<p>Based on the current request body (with long address <strong>redacted/truncated</strong>):</p>\n<pre class=\"click-to-expand-wrapper is-snippet-wrapper\"><code class=\"language-json\">{\n  \"meta\": {\n    \"event_id\": \"HIS-20260129-083000101\",\n    \"correlation_id\": \"c3a1c2d0-3d5a-4e6c-8e91-8a3c2fd4c9a1\",\n    \"event_type\": \"PatientEncounterUpsert\",\n    \"source_system\": \"HIS\"\n  },\n  \"payload\": {\n    \"patient\": {\n      \"mrn\": \"00998877\",\n      \"title\": \"Mr.\",\n      \"title_th\": \"นาย\",\n      \"first_name\": \"Somsak\",\n      \"last_name\": \"Deejai\",\n      \"first_name_th\": \"สมศักดิ์\",\n      \"last_name_th\": \"ดีใจ\",\n      \"gender\": \"M\",\n      \"dob\": \"1985-12-31\",\n      \"country_code\": \"TH\",\n      \"phone\": \"081-999-8888\",\n      \"email\": \"somsak.d@email.com\",\n      \"address_full\": \"123 Sukhumvit Road, Watthana, Bangkok ... (truncated)\"\n    }\n  }\n}\n</code></pre>\n<hr />\n<h2 id=\"expected-responses\">Expected Responses</h2>\n<p>Exact response bodies depend on implementation, but typical outcomes include:</p>\n<ul>\n<li><strong>200 OK</strong> — Upsert processed successfully (existing record updated).</li>\n<li><strong>201 Created</strong> — Upsert resulted in a new record being created.</li>\n<li><strong>400 Bad Request</strong> — Validation error (missing/invalid required fields; malformed JSON; invalid formats).</li>\n<li><strong>401 Unauthorized / 403 Forbidden</strong> — Missing/invalid <code>x-api-key</code>, or key lacks permission.</li>\n<li><strong>500 Internal Server Error</strong> — Unexpected server-side error.</li>\n</ul>\n<hr />\n<h2 id=\"suggested-postman-tests-examples\">Suggested Postman Tests (Examples)</h2>\n<p>Add these in the <strong>Tests</strong> tab if you want basic automated checks:</p>\n<pre class=\"click-to-expand-wrapper is-snippet-wrapper\"><code class=\"language-javascript\">pm.test(\"Status code is 200 or 201\", function () {\n  pm.expect([200, 201]).to.include(pm.response.code);\n});\n\npm.test(\"Response is JSON\", function () {\n  pm.response.to.be.json;\n});\n\npm.test(\"Response has expected top-level keys (if JSON)\", function () {\n  const json = pm.response.json();\n  // Adjust keys to match your API's response contract\n  pm.expect(json).to.be.an(\"object\");\n  // Example assertions (enable/modify as appropriate):\n  // pm.expect(json).to.have.any.keys(\"meta\", \"payload\");\n});\n</code></pre>\n<blockquote>\n<p>If your API returns a standard envelope (e.g., <code>success</code>, <code>message</code>, <code>data</code>, <code>errors</code>, <code>timestamp</code>), update the key assertions accordingly.</p>\n</blockquote>\n","urlObject":{"path":["patientencounter-upsert"],"host":["{{Base_URL}}{{Base_PATH}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"715c23d4-4b6b-4930-8068-72bf589e826b"},{"name":"Encounter Only","id":"6b2b1929-c864-41aa-9035-b5bbcb51f217","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"auth":{"type":"noauth","isInherited":false},"method":"POST","header":[{"key":"x-api-key","value":"{{APIKey}}","type":"text"}],"body":{"mode":"raw","raw":"{\n  \"meta\": {\n    \"event_id\": \"HIS-20260129-083000109\",\n    \"correlation_id\": \"c3a1c2d0-3d5a-4e6c-8e91-8a3c2fd4c9a1\",\n    \"event_type\": \"PatientEncounterUpsert\",\n    \"source_system\": \"HIS\"\n  },\n  \"payload\": {\n    \"encounter\": {\n      \"encounter_id\": \"6601290005\",\n      \"type_code\": \"OPD\",\n      \"visit_date\": \"2026-01-29T08:30:00\",\n      \"doctor_code\": \"D0055\",\n      \"clinic_code\": \"TNCSTOCK\"\n    }\n  }\n}","options":{"raw":{"language":"json"}}},"url":"{{Base_URL}}{{Base_PATH}}/patientencounter-upsert","description":"<h2 id=\"purpose\">Purpose</h2>\n<p>Upsert (create or update) <strong>Patient Encounter</strong> data (encounter only) into the TMS backend via an event-style payload.</p>\n<p>This request is typically used by upstream systems (e.g., HIS) to send encounter details. If the encounter already exists, the backend is expected to update it; if it does not exist, the backend is expected to create it.</p>\n<hr />\n<h2 id=\"endpoint\">Endpoint</h2>\n<ul>\n<li><strong>Method:</strong> <code>POST</code></li>\n<li><strong>URL:</strong> <code>{{Base_URL}}{{Base_PATH}}/patientencounter-upsert</code></li>\n</ul>\n<hr />\n<h2 id=\"authentication\">Authentication</h2>\n<p>This endpoint uses an API key passed in a request header.</p>\n<hr />\n<h2 id=\"headers\">Headers</h2>\n<div class=\"click-to-expand-wrapper is-table-wrapper\"><table>\n<thead>\n<tr>\n<th>Header</th>\n<th>Value</th>\n<th>Notes</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td><code>x-api-key</code></td>\n<td><code>{{APIKey}}</code></td>\n<td>API key for the target environment</td>\n</tr>\n</tbody>\n</table>\n</div><hr />\n<h2 id=\"environment-variables-used\">Environment variables used</h2>\n<p>This request relies on the following variables (active environment: <code>TMS-DEV</code>):</p>\n<div class=\"click-to-expand-wrapper is-table-wrapper\"><table>\n<thead>\n<tr>\n<th>Variable</th>\n<th>Purpose</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td><code>{{Base_URL}}</code></td>\n<td>Base host / protocol (e.g., <code>https://...</code>)</td>\n</tr>\n<tr>\n<td><code>{{Base_PATH}}</code></td>\n<td>Base path/prefix for the API (if applicable)</td>\n</tr>\n<tr>\n<td><code>{{APIKey}}</code></td>\n<td>API key used in <code>x-api-key</code> header</td>\n</tr>\n</tbody>\n</table>\n</div><hr />\n<h2 id=\"request-body\">Request body</h2>\n<p><strong>Content-Type:</strong> JSON (raw)</p>\n<h3 id=\"schema\">Schema</h3>\n<pre class=\"click-to-expand-wrapper is-snippet-wrapper\"><code class=\"language-json\">{\n  \"meta\": {\n    \"event_id\": \"string\",\n    \"correlation_id\": \"string\",\n    \"event_type\": \"string\",\n    \"source_system\": \"string\"\n  },\n  \"payload\": {\n    \"encounter\": {\n      \"encounter_id\": \"string\",\n      \"type_code\": \"string\",\n      \"visit_date\": \"string\",\n      \"doctor_code\": \"string\",\n      \"clinic_code\": \"string\"\n    }\n  }\n}\n</code></pre>\n<h3 id=\"field-descriptions\">Field descriptions</h3>\n<h4 id=\"meta\"><code>meta</code></h4>\n<ul>\n<li><code>meta.event_id</code> (string): Unique event identifier from the source system (often time-based). Useful for auditing and replay handling.</li>\n<li><code>meta.correlation_id</code> (string, UUID recommended): Correlates logs/traces across systems for the same business transaction.</li>\n<li><code>meta.event_type</code> (string): Event name for routing/validation (expected: <code>PatientEncounterUpsert</code>).</li>\n<li><code>meta.source_system</code> (string): Source system identifier (e.g., <code>HIS</code>).</li>\n</ul>\n<h4 id=\"payloadencounter\"><code>payload.encounter</code></h4>\n<ul>\n<li><code>payload.encounter.encounter_id</code> (string): Encounter identifier in the source system (primary business key for upsert).</li>\n<li><code>payload.encounter.type_code</code> (string): Encounter type (example: <code>OPD</code>).</li>\n<li><code>payload.encounter.visit_date</code> (string, ISO-8601 datetime): Visit date/time (example: <code>2026-01-29T08:30:00</code>).</li>\n<li><code>payload.encounter.doctor_code</code> (string): Attending doctor code.</li>\n<li><code>payload.encounter.clinic_code</code> (string): Clinic/location code.</li>\n</ul>\n<hr />\n<h2 id=\"example-request\">Example request</h2>\n<pre class=\"click-to-expand-wrapper is-snippet-wrapper\"><code class=\"language-json\">{\"meta\":{\"event_id\":\"HIS-20260129-083000109\",\"correlation_id\":\"c3a1c2d0-3d5a-4e6c-8e91-8a3c2fd4c9a1\",\"event_type\":\"PatientEncounterUpsert\",\"source_system\":\"HIS\"},\"payload\":{\"encounter\":{\"encounter_id\":\"6601290005\",\"type_code\":\"OPD\",\"visit_date\":\"2026-01-29T08:30:00\",\"doctor_code\":\"D0055\",\"clinic_code\":\"TNCSTOCK\"}}}\n</code></pre>\n<hr />\n<h2 id=\"response-expectations-generic\">Response expectations (generic)</h2>\n<p>Actual response payload may vary by environment/version.</p>\n<h3 id=\"success\">Success</h3>\n<ul>\n<li><strong>HTTP 200</strong> or <strong>201</strong>: Encounter accepted/processed.</li>\n<li>Body may include status/message and/or the upserted resource identifiers.</li>\n</ul>\n<h3 id=\"client-errors\">Client errors</h3>\n<ul>\n<li><strong>HTTP 400</strong>: Validation error (missing/invalid fields, invalid date format, etc.).</li>\n<li><strong>HTTP 401/403</strong>: Missing/invalid API key (<code>x-api-key</code>).</li>\n</ul>\n<h3 id=\"server-errors\">Server errors</h3>\n<ul>\n<li><strong>HTTP 500</strong>: Unexpected error while processing the upsert.</li>\n</ul>\n<hr />\n<h2 id=\"notes\">Notes</h2>\n<ul>\n<li><strong>Idempotency / upsert behavior:</strong> Re-sending the same <code>payload.encounter.encounter_id</code> should update the existing encounter rather than create duplicates (exact behavior depends on backend implementation).</li>\n<li><strong>Correlation:</strong> Keep <code>meta.correlation_id</code> consistent across related calls in the same workflow to simplify tracing.</li>\n<li><strong>Event tracking:</strong> <code>meta.event_id</code> should be unique per event submission to support audit and replay protection, if implemented.</li>\n</ul>\n","urlObject":{"path":["patientencounter-upsert"],"host":["{{Base_URL}}{{Base_PATH}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"6b2b1929-c864-41aa-9035-b5bbcb51f217"},{"name":"Both","id":"0ba8910d-8ec3-41b5-a08f-38fae907eb81","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"auth":{"type":"noauth","isInherited":false},"method":"POST","header":[{"key":"x-api-key","value":"{{APIKey}}","type":"text"},{"key":"Base_URL","value":"https://tnh-dev.vgroupth.com","type":"text"},{"key":"Base_PATH","value":"api/v2/his/","type":"text"}],"body":{"mode":"raw","raw":"{\n  \"meta\": {\n    \"event_id\": \"HIS-20260129-083000104\",\n    \"correlation_id\": \"c3a1c2d0-3d5a-4e6c-8e91-8a3c2fd4c9a1\",\n    \"event_type\": \"PatientEncounterUpsert\",\n    \"source_system\": \"HIS\"\n  },\n  \"payload\": {\n    \"patient\": {\n      \"mrn\": \"MRN-001\",\n      \"title\": \"Mr.\",\n      \"title_th\": \"นาย\",\n      \"first_name\": \"Aryan\",\n      \"last_name\": \"Khan\",\n      \"first_name_th\": \"สมศักดิ์\",\n      \"last_name_th\": \"ดีใจ\",\n      \"gender\": \"M\",\n      \"dob\": \"1985-12-31\",\n      \"country_code\": \"TH\",\n      \"phone\": \"081-999-8888\",\n      \"email\": \"somsak.d@email.com\",\n      \"address_full\": \"123 Sukhumvit Road, Watthana, Bangkok 10110\"\n    },\n    \"encounter\": {\n      \"encounter_id\": \"AN-660214-001\",\n      \"type_code\": \"OPD\",\n      \"visit_date\": \"2026-01-29T08:30:00\",\n      \"doctor_code\": \"D0055\",\n      \"clinic_code\": \"TNCSTOCK\"\n    }\n  }\n}","options":{"raw":{"language":"json"}}},"url":"{{Base_URL}}{{Base_PATH}}/patientencounter-upsert","description":"<h2 id=\"purpose\">Purpose</h2>\n<p>Upsert (create or update) a <strong>Patient</strong> record together with a related <strong>Encounter/Visit</strong> in HIS. Use this endpoint when you need to sync patient demographics and the encounter details in a single call.</p>\n<h2 id=\"endpoint\">Endpoint</h2>\n<ul>\n<li><strong>Method:</strong> <code>POST</code></li>\n<li><strong>URL:</strong> <code>{{Base_URL}}{{Base_PATH}}/patientencounter-upsert</code></li>\n</ul>\n<h2 id=\"required-headers\">Required headers</h2>\n<div class=\"click-to-expand-wrapper is-table-wrapper\"><table>\n<thead>\n<tr>\n<th>Header</th>\n<th>Value</th>\n<th>Notes</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td><code>x-api-key</code></td>\n<td><code>{{APIKey}}</code></td>\n<td>Required for authentication/authorization</td>\n</tr>\n</tbody>\n</table>\n</div><h2 id=\"variables-used\">Variables used</h2>\n<p>This request is parameterized using environment variables (recommended: set them in the active environment <code>TMS-DEV</code>).</p>\n<ul>\n<li><code>{{Base_URL}}</code> — Host (example: <code>https://tnh-dev.vgroupth.com</code>)</li>\n<li><code>{{Base_PATH}}</code> — Base API path (example: <code>api/v2/his/</code>)</li>\n<li><code>{{APIKey}}</code> — API key value used in <code>x-api-key</code></li>\n</ul>\n<h2 id=\"request-body-overview-schema\">Request body overview (schema)</h2>\n<p>Body is JSON with two top-level objects: <code>meta</code> and <code>payload</code>.</p>\n<h3 id=\"meta\"><code>meta</code></h3>\n<p>Metadata about the event being submitted.</p>\n<ul>\n<li><code>event_id</code> <em>(string)</em>: Unique event identifier (should be unique per submission)</li>\n<li><code>correlation_id</code> <em>(string, UUID recommended)</em>: Used to trace across systems/logs</li>\n<li><code>event_type</code> <em>(string)</em>: Expected value: <code>PatientEncounterUpsert</code></li>\n<li><code>source_system</code> <em>(string)</em>: Source system identifier (example: <code>HIS</code>)</li>\n</ul>\n<h3 id=\"payload\"><code>payload</code></h3>\n<p>The actual business data.</p>\n<h4 id=\"payloadpatient\"><code>payload.patient</code></h4>\n<p>Patient demographics and contact details.</p>\n<p>Common fields include:</p>\n<ul>\n<li><code>mrn</code> <em>(string)</em>: Medical Record Number (patient identifier)</li>\n<li><code>first_name</code>, <code>last_name</code> <em>(string)</em></li>\n<li><code>first_name_th</code>, <code>last_name_th</code> <em>(string)</em>: Thai names (if applicable)</li>\n<li><code>gender</code> <em>(string)</em>: See <strong>Field notes</strong></li>\n<li><code>dob</code> <em>(string)</em>: See <strong>Field notes</strong></li>\n<li><code>phone</code>, <code>email</code>, <code>address_full</code> <em>(string, optional)</em></li>\n</ul>\n<h4 id=\"payloadencounter\"><code>payload.encounter</code></h4>\n<p>Encounter/visit information.</p>\n<p>Common fields include:</p>\n<ul>\n<li><code>encounter_id</code> <em>(string)</em>: Visit/encounter identifier (often VN)</li>\n<li><code>type_code</code> <em>(string)</em>: Encounter type (example: <code>OPD</code>)</li>\n<li><code>visit_date</code> <em>(string)</em>: See <strong>Field notes</strong></li>\n<li><code>doctor_code</code> <em>(string)</em></li>\n<li><code>clinic_code</code> <em>(string)</em></li>\n</ul>\n<h2 id=\"field-notes--conventions\">Field notes / conventions</h2>\n<ul>\n<li><strong>Date formats</strong><ul>\n<li><code>meta</code> values are free-form strings unless your backend validates them.</li>\n<li><code>patient.dob</code> should be <strong>ISO date</strong>: <code>YYYY-MM-DD</code> (example: <code>1985-12-31</code>).</li>\n<li><code>encounter.visit_date</code> should be <strong>ISO 8601 datetime</strong> (recommended): <code>YYYY-MM-DDTHH:mm:ss</code> (example: <code>2026-01-29T08:30:00</code>).</li>\n</ul>\n</li>\n<li><strong>IDs</strong><ul>\n<li><code>event_id</code> should be unique per event to prevent unintended duplicates.</li>\n<li><code>correlation_id</code> should remain the same for all requests in the same workflow/transaction.</li>\n<li><code>patient.mrn</code> and <code>encounter.encounter_id</code> are key identifiers used for upsert behavior.</li>\n</ul>\n</li>\n<li><strong>Gender values</strong><ul>\n<li>Common values: <code>M</code>, <code>F</code> (follow your HIS validation rules; use consistent casing).</li>\n</ul>\n</li>\n</ul>\n<h2 id=\"sample-request-body\">Sample request body</h2>\n<pre class=\"click-to-expand-wrapper is-snippet-wrapper\"><code class=\"language-json\">{\n  \"meta\": {\n    \"event_id\": \"HIS-20260129-083000104\",\n    \"correlation_id\": \"c3a1c2d0-3d5a-4e6c-8e91-8a3c2fd4c9a1\",\n    \"event_type\": \"PatientEncounterUpsert\",\n    \"source_system\": \"HIS\"\n  },\n  \"payload\": {\n    \"patient\": {\n      \"mrn\": \"MRN-001\",\n      \"title\": \"Mr.\",\n      \"title_th\": \"นาย\",\n      \"first_name\": \"Aryan\",\n      \"last_name\": \"Khan\",\n      \"first_name_th\": \"สมศักดิ์\",\n      \"last_name_th\": \"ดีใจ\",\n      \"gender\": \"M\",\n      \"dob\": \"1985-12-31\",\n      \"country_code\": \"TH\",\n      \"phone\": \"081-999-8888\",\n      \"email\": \"somsak.d@email.com\",\n      \"address_full\": \"123 Sukhumvit Road, Watthana, Bangkok\"\n    },\n    \"encounter\": {\n      \"encounter_id\": \"VN-001\",\n      \"type_code\": \"OPD\",\n      \"visit_date\": \"2026-01-29T08:30:00\",\n      \"doctor_code\": \"D0055\",\n      \"clinic_code\": \"TNCSTOCK\"\n    }\n  }\n}\n</code></pre>\n<h2 id=\"expected-responses\">Expected responses</h2>\n<ul>\n<li><strong>200 OK / 201 Created</strong> — Upsert succeeded (patient and encounter processed)</li>\n<li><strong>400 Bad Request</strong> — Validation error (missing required fields, invalid date formats, etc.)</li>\n<li><strong>401 Unauthorized / 403 Forbidden</strong> — Invalid, missing, or insufficient API key/permissions</li>\n<li><strong>500 Internal Server Error</strong> — Unexpected backend error</li>\n</ul>\n<h2 id=\"tips-for-collection-runner--data-driven-runs\">Tips for Collection Runner / data-driven runs</h2>\n<ul>\n<li>Use a CSV/JSON data file to iterate patients/encounters and map columns to fields (e.g., <code>{{mrn}}</code>, <code>{{encounter_id}}</code>, <code>{{visit_date}}</code>).</li>\n<li>Keep <code>correlation_id</code> consistent per run iteration if you are chaining multiple related requests.</li>\n<li>Ensure <code>event_id</code> is unique per iteration (for example, include a timestamp or row number).</li>\n</ul>\n","urlObject":{"path":["patientencounter-upsert"],"host":["{{Base_URL}}{{Base_PATH}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"0ba8910d-8ec3-41b5-a08f-38fae907eb81"},{"name":"OPD Patinet and Encounter Creation","id":"12c239fd-900e-4a5f-8270-67a6eb5ebbef","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"auth":{"type":"noauth","isInherited":false},"method":"POST","header":[{"key":"x-api-key","value":"{{APIKey}}","type":"text"}],"body":{"mode":"raw","raw":"{\n  \"meta\": {\n    \"event_id\": \"HIS-20260129-083000122\",\n    \"correlation_id\": \"c3a1c2d0-3d5a-4e6c-8e91-8a3c2fd4c9a1\",\n    \"event_type\": \"PatientEncounterUpsert\",\n    \"source_system\": \"HIS\"\n  },\n  \"payload\": {\n    \"patient\": {\n      \"mrn\": \"MRN-002\",\n      \"title\": \"Mr.\",\n      \"title_th\": \"Arya\",\n      \"first_name\": \"Reji\",\n      \"last_name\": \"Kha\",\n      \"first_name_th\": \"สมศักดิ์\",\n      \"last_name_th\": \"ดีใจ\",\n      \"gender\": \"M\",\n      \"dob\": \"1985-12-31\",\n      \"country_code\": \"TH\",\n      \"phone\": \"081-999-8888\",\n      \"email\": \"somsak.d@email.com\",\n      \"address_full\": \"123 Sukhumvit Road, Watthana, Bangkok 10110\"\n    },\n    \"encounter\": {\n      \"encounter_id\": \"VN-001\",\n      \"type_code\": \"OPD\",\n      \"visit_date\": \"2026-01-29T08:30:00\",\n      \"doctor_code\": \"D0055\",\n      \"clinic_code\": \"TNCSTOCK\"\n    }\n  }\n}","options":{"raw":{"language":"json"}}},"url":"{{Base_URL}}{{Base_PATH}}/patientencounter-upsert","description":"<h2 id=\"purpose\">Purpose</h2>\n<p>Upsert (create or update) <strong>OPD patient + encounter</strong> data into TMS by sending a <code>PatientEncounterUpsert</code> event.</p>\n<h2 id=\"endpoint\">Endpoint</h2>\n<p><code>POST {{Base_URL}}{{Base_PATH}}/patientencounter-upsert</code></p>\n<h2 id=\"authentication\">Authentication</h2>\n<p>Send API key in header:</p>\n<ul>\n<li><code>x-api-key: {{APIKey}}</code></li>\n</ul>\n<h2 id=\"required-variables\">Required variables</h2>\n<p>This request depends on the following variables (active environment: <strong>TMS-DEV</strong>):</p>\n<ul>\n<li><code>Base_URL</code> – API host, including protocol (e.g., <code>https://...</code>)</li>\n<li><code>Base_PATH</code> – base path/prefix for the API (e.g., <code>/tms/v3</code>)</li>\n<li><code>APIKey</code> – API key used in <code>x-api-key</code> header</li>\n</ul>\n<h2 id=\"payload-schema-overview\">Payload schema (overview)</h2>\n<p>Request body is JSON with the following top-level structure:</p>\n<ul>\n<li><code>meta</code> (object) – event metadata<ul>\n<li><code>event_id</code> (string) – <strong>must be unique</strong> per event</li>\n<li><code>correlation_id</code> (string) – UUID used to correlate logs/traces across systems</li>\n<li><code>event_type</code> (string) – <strong>fixed</strong> value: <code>PatientEncounterUpsert</code></li>\n<li><code>source_system</code> (string) – origin system identifier (e.g., <code>HIS</code>)</li>\n</ul>\n</li>\n<li><code>payload</code> (object) – business data<ul>\n<li><code>patient</code> (object) – patient demographics/contacts/identifiers</li>\n<li><code>encounter</code> (object) – visit/encounter details (VN, type, visit date/time, clinic/doctor codes)</li>\n</ul>\n</li>\n</ul>\n<h2 id=\"field-notes\">Field notes</h2>\n<ul>\n<li><strong><code>meta.event_id</code></strong>: should be unique (commonly used for idempotency / de-duplication).</li>\n<li><strong><code>meta.correlation_id</code></strong>: should be a valid UUID (e.g., <code>xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx</code>).</li>\n<li><strong><code>meta.event_type</code></strong>: must be exactly <code>PatientEncounterUpsert</code>.</li>\n</ul>\n<h2 id=\"example-request-body\">Example request body</h2>\n<pre class=\"click-to-expand-wrapper is-snippet-wrapper\"><code class=\"language-json\">{\"meta\":{\"event_id\":\"HIS-20260129-083000122\",\"correlation_id\":\"c3a1c2d0-3d5a-4e6c-8e91-8a3c2fd4c9a1\",\"event_type\":\"PatientEncounterUpsert\",\"source_system\":\"HIS\"},\"payload\":{\"patient\":{\"mrn\":\"MRN-001\",\"title\":\"Mr.\",\"title_th\":\"นาย\",\"first_name\":\"Ary\",\"last_name\":\"Kha\",\"first_name_th\":\"สมศักดิ์\",\"last_name_th\":\"ดีใจ\",\"gender\":\"M\",\"dob\":\"1985-12-31\",\"country_code\":\"TH\",\"phone\":\"081-999-8888\",\"email\":\"somsak.d@email.com\",\"address_full\":\"123 Sukhumvit Road, Watthana, Bangkok 10...&lt;truncated&gt;\"},\"encounter\":{\"encounter_id\":\"VN-001\",\"type_code\":\"OPD\",\"visit_date\":\"2026-01-29T08:30:00\",\"doctor_code\":\"D0055\",\"clinic_code\":\"TNCSTOCK\"}}}\n</code></pre>\n<h2 id=\"expected-responses\">Expected responses</h2>\n<p>Typical HTTP responses you may see:</p>\n<ul>\n<li><strong>200 OK / 201 Created</strong> – Upsert accepted/processed successfully.</li>\n<li><strong>400 Bad Request</strong> – Validation error (missing/invalid fields, wrong formats).</li>\n<li><strong>401 Unauthorized / 403 Forbidden</strong> – Missing/invalid <code>x-api-key</code> or not permitted.</li>\n<li><strong>409 Conflict</strong> – Duplicate <code>event_id</code> or idempotency conflict (implementation-specific).</li>\n<li><strong>500 Internal Server Error</strong> – Unexpected server-side error.</li>\n</ul>\n","urlObject":{"path":["patientencounter-upsert"],"host":["{{Base_URL}}{{Base_PATH}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"12c239fd-900e-4a5f-8270-67a6eb5ebbef"},{"name":"IPD Patinet and Encounter Creation","id":"7047998e-b643-4215-9009-f8576aa750cf","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"auth":{"type":"noauth","isInherited":false},"method":"POST","header":[{"key":"x-api-key","value":"{{APIKey}}","type":"text"}],"body":{"mode":"raw","raw":"{\n    \"meta\": {\n        \"event_id\": \"HIS-20260129-083000304\",\n        \"correlation_id\": \"c3a1c2d0-3d5a-4e6c-8e91-8a3c2fd4c9a1\",\n        \"event_type\": \"PatientEncounterUpsert\",\n        \"source_system\": \"HIS\"\n    },\n    \"payload\": {\n        \"patient\": {\n            \"mrn\": \"MRN-003\",\n            \"title\": \"Mrs.\",\n            \"title_th\": \"นาย\",\n            \"first_name\": \"Div\",\n            \"last_name\": \"Kas\",\n            \"first_name_th\": \"สมศักดิ์\",\n            \"last_name_th\": \"ดีใจ\",\n            \"gender\": \"F\",\n            \"dob\": \"1985-12-31\",\n            \"country_code\": \"TH\",\n            \"phone\": \"081-999-8888\",\n            \"email\": \"kashi.d@email.com\",\n            \"address_full\": \"123 Sukhumvit Road, Watthana, Bangkok 10110\"\n        },\n        \"encounter\": {\n            \"encounter_id\": \"AN-660214-001\",\n            \"type_code\": \"IPD\",\n            \"visit_date\": \"2026-01-29T08:30:00\",\n            \"doctor_code\": \"D0055\"\n        }\n    }\n}","options":{"raw":{"language":"json"}}},"url":"{{Base_URL}}{{Base_PATH}}/patientencounter-upsert","description":"<h2 id=\"patient--encounter-upsert\">Patient + Encounter Upsert</h2>\n<p>Creates or updates (<strong>upserts</strong>) a patient record and an associated encounter in TMS. Use this endpoint to synchronize patient demographics and encounter/visit details from the source HIS into TMS.</p>\n<h2 id=\"endpoint\">Endpoint</h2>\n<ul>\n<li><strong>Method:</strong> <code>POST</code></li>\n<li><strong>URL:</strong> <code>{{Base_URL}}{{Base_PATH}}/patientencounter-upsert</code></li>\n</ul>\n<h2 id=\"required-headers\">Required headers</h2>\n<div class=\"click-to-expand-wrapper is-table-wrapper\"><table>\n<thead>\n<tr>\n<th>Header</th>\n<th>Value</th>\n<th>Notes</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td><code>x-api-key</code></td>\n<td><code>{{APIKey}}</code></td>\n<td>Required for authentication/authorization</td>\n</tr>\n</tbody>\n</table>\n</div><h2 id=\"variables-used\">Variables used</h2>\n<p>This request relies on these variables (typically set in the active environment <strong>TMS-DEV</strong>):</p>\n<ul>\n<li><code>{{Base_URL}}</code> – API host (e.g., <code>https://...</code>)</li>\n<li><code>{{Base_PATH}}</code> – Base path/prefix for the API (e.g., <code>/tms/v3</code>)</li>\n<li><code>{{APIKey}}</code> – API key used in <code>x-api-key</code></li>\n</ul>\n<h2 id=\"request-body-overview-schema\">Request body overview (schema)</h2>\n<p>The body is JSON with two top-level sections:</p>\n<ul>\n<li><p><code>meta</code> (event envelope)</p>\n<ul>\n<li><code>event_id</code> <em>(string)</em>: Unique event identifier from the source system</li>\n<li><code>correlation_id</code> <em>(string, UUID recommended)</em>: Trace ID used to link retries and downstream logs</li>\n<li><code>event_type</code> <em>(string)</em>: Should be <code>PatientEncounterUpsert</code></li>\n<li><code>source_system</code> <em>(string)</em>: Originating system (e.g., <code>HIS</code>)</li>\n</ul>\n</li>\n<li><p><code>payload</code> (business data)</p>\n<ul>\n<li><code>patient</code> <em>(object)</em>: Patient demographics/contacts (e.g., <code>mrn</code>, names, gender, DOB, phone, email, address)</li>\n<li><code>encounter</code> <em>(object)</em>: Encounter/visit data (e.g., <code>encounter_id</code>, <code>type_code</code>, <code>visit_date</code>, <code>doctor_code</code>)</li>\n</ul>\n</li>\n</ul>\n<h2 id=\"idempotency--correlation-guidance\">Idempotency &amp; correlation guidance</h2>\n<ul>\n<li>Treat the combination of identifiers like <code>payload.patient.mrn</code> and <code>payload.encounter.encounter_id</code> as stable business keys for upsert behavior.</li>\n<li>For retries (network timeouts, 5xx, etc.), <strong>reuse the same <code>correlation_id</code></strong> so the event can be traced end-to-end.</li>\n<li>Ensure <code>event_id</code> remains unique per event emitted from the source system; if you replay the same event intentionally, keep the same <code>event_id</code> to help the receiver detect duplicates (depending on server-side behavior).</li>\n</ul>\n<h2 id=\"example-payload\">Example payload</h2>\n<pre class=\"click-to-expand-wrapper is-snippet-wrapper\"><code class=\"language-json\">{\n  \"meta\": {\n    \"event_id\": \"HIS-20260129-083000304\",\n    \"correlation_id\": \"c3a1c2d0-3d5a-4e6c-8e91-8a3c2fd4c9a1\",\n    \"event_type\": \"PatientEncounterUpsert\",\n    \"source_system\": \"HIS\"\n  },\n  \"payload\": {\n    \"patient\": {\n      \"mrn\": \"009988810998771\",\n      \"title\": \"Mrs.\",\n      \"first_name\": \"Div\",\n      \"last_name\": \"Kas\",\n      \"first_name_th\": \"สมศักดิ์\",\n      \"last_name_th\": \"ดีใจ\",\n      \"gender\": \"F\",\n      \"dob\": \"1985-12-31\",\n      \"country_code\": \"TH\",\n      \"phone\": \"081-999-8888\",\n      \"email\": \"kashi.d@email.com\",\n      \"address_full\": \"123 Sukhumvit Road, Watthana, Bangkok ...\"\n    },\n    \"encounter\": {\n      \"encounter_id\": \"660129000102\",\n      \"type_code\": \"IPD\",\n      \"visit_date\": \"2026-01-29T08:30:00\",\n      \"doctor_code\": \"D0055\"\n    }\n  }\n}\n</code></pre>\n","urlObject":{"path":["patientencounter-upsert"],"host":["{{Base_URL}}{{Base_PATH}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"7047998e-b643-4215-9009-f8576aa750cf"}],"id":"6082370d-6d12-4b09-add0-0fb2a7738eae","_postman_id":"6082370d-6d12-4b09-add0-0fb2a7738eae","description":""},{"name":"IF009 Stock Dispense Create","item":[{"name":"IF009 Dispense API","id":"97871755-dd9c-4e8f-9426-c3980684dbe5","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"auth":{"type":"noauth","isInherited":false},"method":"POST","header":[{"key":"x-api-key","value":"{{APIKey}}","type":"text"}],"body":{"mode":"raw","raw":"{\n    \"meta\": {\n        \"event_id\": \"HIS-20260129-144000936\",\n        \"correlation_id\": \"RX-998877\",\n        \"event_type\": \"StockDispenseCreate\",\n        \"source_system\": \"HIS\"\n    },\n    \"payload\": {\n        \"dispense_no\": \"DSP-2026-186\",\n        \"encounter_id\": \"AN-660214-101\",\n        \"dispense_date\": \"2026-02-20T14:30:00\",\n        \"doctor_code\": \"D0055\",\n        \"items\": [\n            \n            {\n                \"line_id\": \"1\",\n                \"item_code\": \"FPMSYR05\",\n                \"quantity\": 10.0,\n                \"lot_serial_no\": \"LOT-21\",\n                \"location_code\": \"BHTGS\",\n                \"cost_center_code\": \"CC002\"\n            }\n        ]\n    }\n}","options":{"raw":{"language":"json"}}},"url":"{{Base_URL}}{{Base_PATH}}/StockDispense-Create","description":"<h2 id=\"stock-dispense-create\">Stock Dispense Create</h2>\n<p>Creates a <strong>stock dispense transaction</strong> in TMS from an upstream system (e.g., HIS). Use this endpoint to submit a dispense header plus one or more dispensed item lines.</p>\n<hr />\n<h2 id=\"endpoint\">Endpoint</h2>\n<p><code>POST {{Base_URL}}{{Base_PATH}}/StockDispense-Create</code></p>\n<hr />\n<h2 id=\"required-headers\">Required headers</h2>\n<div class=\"click-to-expand-wrapper is-table-wrapper\"><table>\n<thead>\n<tr>\n<th>Header</th>\n<th>Required</th>\n<th>Description</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td><code>x-api-key: {{APIKey}}</code></td>\n<td>Yes</td>\n<td>API key used to authorize the request.</td>\n</tr>\n<tr>\n<td><code>Content-Type: application/json</code></td>\n<td>Yes</td>\n<td>When sending a JSON body (raw).</td>\n</tr>\n</tbody>\n</table>\n</div><blockquote>\n<p>Note: <code>Content-Type</code> is typically set automatically by Postman when using a raw JSON body.</p>\n</blockquote>\n<hr />\n<h2 id=\"variables-used\">Variables used</h2>\n<div class=\"click-to-expand-wrapper is-table-wrapper\"><table>\n<thead>\n<tr>\n<th>Variable</th>\n<th>Where</th>\n<th>Meaning</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td><code>{{Base_URL}}</code></td>\n<td>Environment (<code>TMS-DEV</code>)</td>\n<td>Base host (scheme + domain + optional port).</td>\n</tr>\n<tr>\n<td><code>{{Base_PATH}}</code></td>\n<td>Environment (<code>TMS-DEV</code>)</td>\n<td>Base API path/prefix for TMS services.</td>\n</tr>\n<tr>\n<td><code>{{APIKey}}</code></td>\n<td>Environment (<code>TMS-DEV</code>)</td>\n<td>API key value injected into the <code>x-api-key</code> header.</td>\n</tr>\n</tbody>\n</table>\n</div><hr />\n<h2 id=\"request-body-json\">Request body (JSON)</h2>\n<p>Top-level structure:</p>\n<ul>\n<li><code>meta</code> <em>(object, required)</em>: Event and tracking information.</li>\n<li><code>payload</code> <em>(object, required)</em>: Dispense data (header + line items).</li>\n</ul>\n<h3 id=\"meta-fields\"><code>meta</code> fields</h3>\n<div class=\"click-to-expand-wrapper is-table-wrapper\"><table>\n<thead>\n<tr>\n<th>Field</th>\n<th>Type</th>\n<th>Required</th>\n<th>Description</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td><code>meta.event_id</code></td>\n<td>string</td>\n<td>Yes</td>\n<td>Unique event identifier from the source system.</td>\n</tr>\n<tr>\n<td><code>meta.correlation_id</code></td>\n<td>string</td>\n<td>Yes</td>\n<td>Correlates this request to a business process/workflow (e.g., Rx number).</td>\n</tr>\n<tr>\n<td><code>meta.event_type</code></td>\n<td>string</td>\n<td>Yes</td>\n<td>Event type name. Expected: <code>StockDispenseCreate</code>.</td>\n</tr>\n<tr>\n<td><code>meta.source_system</code></td>\n<td>string</td>\n<td>Yes</td>\n<td>Source system name/code (e.g., <code>HIS</code>).</td>\n</tr>\n</tbody>\n</table>\n</div><h3 id=\"payload-fields-header\"><code>payload</code> fields (header)</h3>\n<div class=\"click-to-expand-wrapper is-table-wrapper\"><table>\n<thead>\n<tr>\n<th>Field</th>\n<th>Type</th>\n<th>Required</th>\n<th>Description</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td><code>payload.dispense_no</code></td>\n<td>string</td>\n<td>Yes</td>\n<td>Dispense document/transaction number.</td>\n</tr>\n<tr>\n<td><code>payload.encounter_id</code></td>\n<td>string</td>\n<td>Yes</td>\n<td>Encounter/visit identifier.</td>\n</tr>\n<tr>\n<td><code>payload.dispense_date</code></td>\n<td>string (date-time)</td>\n<td>Yes</td>\n<td>Dispense date/time in ISO-8601 format (e.g., <code>YYYY-MM-DDTHH:mm:ss</code>).</td>\n</tr>\n<tr>\n<td><code>payload.doctor_code</code></td>\n<td>string</td>\n<td>Yes</td>\n<td>Prescriber/doctor code associated with the dispense.</td>\n</tr>\n<tr>\n<td><code>payload.items</code></td>\n<td>array</td>\n<td>Yes</td>\n<td>List of dispensed item lines (must contain at least 1 item).</td>\n</tr>\n</tbody>\n</table>\n</div><h3 id=\"payloaditems-fields-lines\"><code>payload.items[]</code> fields (lines)</h3>\n<div class=\"click-to-expand-wrapper is-table-wrapper\"><table>\n<thead>\n<tr>\n<th>Field</th>\n<th>Type</th>\n<th>Required</th>\n<th>Description</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td><code>line_id</code></td>\n<td>string</td>\n<td>Yes</td>\n<td>Line sequence/identifier within the dispense document.</td>\n</tr>\n<tr>\n<td><code>item_code</code></td>\n<td>string</td>\n<td>Yes</td>\n<td>Item/Drug code.</td>\n</tr>\n<tr>\n<td><code>quantity</code></td>\n<td>number</td>\n<td>Yes</td>\n<td>Quantity dispensed.</td>\n</tr>\n<tr>\n<td><code>uom_code</code></td>\n<td>string</td>\n<td>Yes</td>\n<td>Unit of measure code/name.</td>\n</tr>\n<tr>\n<td><code>lot_serial_no</code></td>\n<td>string</td>\n<td>Yes</td>\n<td>Lot or serial number used for traceability.</td>\n</tr>\n<tr>\n<td><code>location_code</code></td>\n<td>string</td>\n<td>Yes</td>\n<td>Stock location/warehouse code where the item is issued from.</td>\n</tr>\n<tr>\n<td><code>cost_center_code</code></td>\n<td>string</td>\n<td>Yes</td>\n<td>Cost center code to book the dispense/issue.</td>\n</tr>\n</tbody>\n</table>\n</div><hr />\n<h2 id=\"example-payload\">Example payload</h2>\n<pre class=\"click-to-expand-wrapper is-snippet-wrapper\"><code class=\"language-json\">{\n  \"meta\": {\n    \"event_id\": \"HIS-20260129-144000231\",\n    \"correlation_id\": \"RX-998877\",\n    \"event_type\": \"StockDispenseCreate\",\n    \"source_system\": \"HIS\"\n  },\n  \"payload\": {\n    \"dispense_no\": \"DSP-2026-133\",\n    \"encounter_id\": \"967568568\",\n    \"dispense_date\": \"2026-01-29T14:30:00\",\n    \"doctor_code\": \"D0055\",\n    \"items\": [\n      {\n        \"line_id\": \"1\",\n        \"item_code\": \"FPMSYR05\",\n        \"quantity\": 10,\n        \"uom_code\": \"ชุด\",\n        \"lot_serial_no\": \"LOT-FPMSYR05-100\",\n        \"location_code\": \"PHSTOCK\",\n        \"cost_center_code\": \"CC002\"\n      }\n    ]\n  }\n}\n</code></pre>\n","urlObject":{"path":["StockDispense-Create"],"host":["{{Base_URL}}{{Base_PATH}}"],"query":[],"variable":[]}},"response":[{"id":"b31c5ea7-40fd-4c88-a834-6415b39aa93e","name":"200 OK","originalRequest":{"method":"POST","header":[{"key":"x-api-key","value":"{{APIKey}}","type":"text"}],"body":{"mode":"raw","raw":"{\n    \"meta\": {\n        \"event_id\": \"HIS-20260129-144000231\",\n        \"correlation_id\": \"RX-998877\",\n        \"event_type\": \"StockDispenseCreate\",\n        \"source_system\": \"HIS\"\n    },\n    \"payload\": {\n        \"dispense_no\": \"DSP-2026-133\",\n        \"encounter_id\": \"967568568\",\n        \"dispense_date\": \"2026-01-29T14:30:00\",\n        \"doctor_code\": \"D0055\",\n        \"items\": [\n            \n            {\n                \"line_id\": \"1\",\n                \"item_code\": \"FPMSYR05\",\n                \"quantity\": 10.0,\n                \"uom_code\": \"ชุด\",\n                \"lot_serial_no\": \"LOT-FPMSYR05-100\",\n                \"location_code\": \"PHSTOCK\",\n                \"cost_center_code\": \"CC002\"\n            }\n        ]\n    }\n}","options":{"raw":{"language":"json"}}},"url":"{{Base_URL}}{{Base_PATH}}/StockDispense-Create"},"status":"OK","code":200,"_postman_previewlanguage":"json","header":[{"key":"Server","value":"nginx"},{"key":"Date","value":"Fri, 20 Feb 2026 05:02:03 GMT"},{"key":"Content-Type","value":"application/json","description":"","type":"text"},{"key":"Content-Length","value":"251"},{"key":"Connection","value":"keep-alive"},{"key":"Access-Control-Allow-Origin","value":"*"},{"key":"Access-Control-Allow-Origin","value":"*"},{"key":"Access-Control-Allow-Methods","value":"POST, OPTIONS"},{"key":"X-Content-Type-Options","value":"nosniff"},{"key":"Strict-Transport-Security","value":"max-age=31536000"}],"cookie":[],"responseTime":null,"body":"{\n    \"result\": \"DUPLICATE_IGNORED\",\n    \"meta\": {\n        \"event_id\": \"HIS-20260129-144000231\",\n        \"original_processed_at\": \"2026-02-20T04:52:39\",\n        \"processed_at\": \"2026-02-20T05:02:03\"\n    },\n    \"resource\": {},\n    \"message\": \"Request with this event_id has already been processed.\"\n}"},{"id":"75eed9bd-7229-45af-983e-ee7fb6eeeef6","name":"401 UNAUTHORIZED","originalRequest":{"method":"POST","header":[{"key":"x-api-key","value":"{{APIKey}}","type":"text"}],"body":{"mode":"raw","raw":"{\n    \"meta\": {\n        \"event_id\": \"HIS-20260129-144000231\",\n        \"correlation_id\": \"RX-998877\",\n        \"event_type\": \"StockDispenseCreate\",\n        \"source_system\": \"HIS\"\n    },\n    \"payload\": {\n        \"dispense_no\": \"DSP-2026-133\",\n        \"encounter_id\": \"967568568\",\n        \"dispense_date\": \"2026-01-29T14:30:00\",\n        \"doctor_code\": \"D0055\",\n        \"items\": [\n            \n            {\n                \"line_id\": \"1\",\n                \"item_code\": \"FPMSYR05\",\n                \"quantity\": 10.0,\n                \"uom_code\": \"ชุด\",\n                \"lot_serial_no\": \"LOT-FPMSYR05-100\",\n                \"location_code\": \"PHSTOCK\",\n                \"cost_center_code\": \"CC002\"\n            }\n        ]\n    }\n}","options":{"raw":{"language":"json"}}},"url":"{{Base_URL}}{{Base_PATH}}/StockDispense-Create"},"status":"UNAUTHORIZED","code":401,"_postman_previewlanguage":"json","header":[{"key":"Server","value":"nginx"},{"key":"Date","value":"Fri, 20 Feb 2026 05:01:08 GMT"},{"key":"Content-Type","value":"application/json","description":"","type":"text"},{"key":"Content-Length","value":"90"},{"key":"Connection","value":"keep-alive"},{"key":"Access-Control-Allow-Origin","value":"*"},{"key":"Access-Control-Allow-Origin","value":"*"},{"key":"Access-Control-Allow-Methods","value":"POST, OPTIONS"},{"key":"Set-Cookie","value":"session_id=O2IhaEjDQ57bM1wjllBhCHmeL6KMocT4H1zgMlCsOPkiqSfVZpX_mYi6XmIcMyU8juO39p6sQOMhsHhrPIqB; Expires=Sat, 20 Feb 2027 05:01:08 GMT; Max-Age=604800; HttpOnly; Path=/"},{"key":"X-Content-Type-Options","value":"nosniff"},{"key":"Strict-Transport-Security","value":"max-age=31536000"}],"cookie":[],"responseTime":null,"body":"{\n    \"result\": \"AUTH_ERROR\",\n    \"errors\": [\n        {\n            \"code\": \"AUTH_ERROR\",\n            \"message\": \"Invalid API key\"\n        }\n    ]\n}"}],"_postman_id":"97871755-dd9c-4e8f-9426-c3980684dbe5"},{"name":"IF009 Dispense API test","id":"fd6c05d4-aaf8-4e76-85b4-8d843247a9a7","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"auth":{"type":"noauth","isInherited":false},"method":"POST","header":[{"key":"x-api-key","value":"{{APIKey}}","type":"text"}],"body":{"mode":"raw","raw":"{\n    \"meta\": {\n        \"event_id\": \"HIS-20260129-144000235\",\n        \"correlation_id\": \"RX-998877\",\n        \"event_type\": \"StockDispenseCreate\",\n        \"source_system\": \"HIS\"\n    },\n    \"payload\": {\n        \"dispense_no\": \"DSP-2026-136\",\n        \"encounter_id\": \"AMB2600001016\",\n        \"dispense_date\": \"2026-02-20T14:30:00\",\n        \"doctor_code\": \"D0055\",\n        \"items\": [\n            \n            {\n                \"line_id\": \"1\",\n                \"item_code\": \"E-COM06\",\n                \"quantity\": 10.0,\n                \"uom_code\": \"UNIT\",\n                \"lot_serial_no\": \"LOT-FPMSYR05-20\",\n                \"location_code\": \"WHSTOCK\",\n                \"cost_center_code\": \"CC002\"\n            }\n        ]\n    }\n}","options":{"raw":{"language":"json"}}},"url":"{{Base_URL}}{{Base_PATH}}/StockDispense-Create","urlObject":{"path":["StockDispense-Create"],"host":["{{Base_URL}}{{Base_PATH}}"],"query":[],"variable":[]}},"response":[{"id":"0027e3ed-0e65-4b5c-b564-538b1f574bcd","name":"200 OK","originalRequest":{"method":"POST","header":[{"key":"x-api-key","value":"{{APIKey}}","type":"text"}],"body":{"mode":"raw","raw":"{\n    \"meta\": {\n        \"event_id\": \"HIS-20260129-144000231\",\n        \"correlation_id\": \"RX-998877\",\n        \"event_type\": \"StockDispenseCreate\",\n        \"source_system\": \"HIS\"\n    },\n    \"payload\": {\n        \"dispense_no\": \"DSP-2026-133\",\n        \"encounter_id\": \"967568568\",\n        \"dispense_date\": \"2026-01-29T14:30:00\",\n        \"doctor_code\": \"D0055\",\n        \"items\": [\n            \n            {\n                \"line_id\": \"1\",\n                \"item_code\": \"FPMSYR05\",\n                \"quantity\": 10.0,\n                \"uom_code\": \"ชุด\",\n                \"lot_serial_no\": \"LOT-FPMSYR05-100\",\n                \"location_code\": \"PHSTOCK\",\n                \"cost_center_code\": \"CC002\"\n            }\n        ]\n    }\n}","options":{"raw":{"language":"json"}}},"url":"{{Base_URL}}{{Base_PATH}}/StockDispense-Create"},"status":"OK","code":200,"_postman_previewlanguage":"json","header":[{"key":"Server","value":"nginx","uuid":"811b4cd7-2495-4a65-971e-b586cf610a23"},{"key":"Date","value":"Fri, 20 Feb 2026 05:02:03 GMT","uuid":"61c5c1cc-41e4-4a01-a336-4d6c10ec3299"},{"key":"Content-Type","value":"application/json","description":"","type":"text","uuid":"e1314632-c50b-4cd2-863a-92e1f4e740c4"},{"key":"Content-Length","value":"251","uuid":"57c7f4ad-32bf-4d6d-b8c9-63925df00ab5"},{"key":"Connection","value":"keep-alive","uuid":"880dccd2-1f8a-42f9-9de1-bb0a915b526e"},{"key":"Access-Control-Allow-Origin","value":"*","uuid":"4a440534-f065-45e5-8f8a-7c0c8a51dc3b"},{"key":"Access-Control-Allow-Origin","value":"*","uuid":"4a440534-f065-45e5-8f8a-7c0c8a51dc3b"},{"key":"Access-Control-Allow-Methods","value":"POST, OPTIONS","uuid":"b0cbaf5f-3ccb-4eb1-b07e-903364045a22"},{"key":"X-Content-Type-Options","value":"nosniff","uuid":"fdba565d-7418-4fae-883b-c71abb397a45"},{"key":"Strict-Transport-Security","value":"max-age=31536000","uuid":"59e3c61c-ddb1-4a6b-9fc0-82dd18c45d84"}],"cookie":[],"responseTime":null,"body":"{\n    \"result\": \"DUPLICATE_IGNORED\",\n    \"meta\": {\n        \"event_id\": \"HIS-20260129-144000231\",\n        \"original_processed_at\": \"2026-02-20T04:52:39\",\n        \"processed_at\": \"2026-02-20T05:02:03\"\n    },\n    \"resource\": {},\n    \"message\": \"Request with this event_id has already been processed.\"\n}"},{"id":"4486fb53-6628-4ed0-95a5-9b3e443c5979","name":"401 UNAUTHORIZED","originalRequest":{"method":"POST","header":[{"key":"x-api-key","value":"{{APIKey}}","type":"text"}],"body":{"mode":"raw","raw":"{\n    \"meta\": {\n        \"event_id\": \"HIS-20260129-144000231\",\n        \"correlation_id\": \"RX-998877\",\n        \"event_type\": \"StockDispenseCreate\",\n        \"source_system\": \"HIS\"\n    },\n    \"payload\": {\n        \"dispense_no\": \"DSP-2026-133\",\n        \"encounter_id\": \"967568568\",\n        \"dispense_date\": \"2026-01-29T14:30:00\",\n        \"doctor_code\": \"D0055\",\n        \"items\": [\n            \n            {\n                \"line_id\": \"1\",\n                \"item_code\": \"FPMSYR05\",\n                \"quantity\": 10.0,\n                \"uom_code\": \"ชุด\",\n                \"lot_serial_no\": \"LOT-FPMSYR05-100\",\n                \"location_code\": \"PHSTOCK\",\n                \"cost_center_code\": \"CC002\"\n            }\n        ]\n    }\n}","options":{"raw":{"language":"json"}}},"url":"{{Base_URL}}{{Base_PATH}}/StockDispense-Create"},"status":"UNAUTHORIZED","code":401,"_postman_previewlanguage":"json","header":[{"key":"Server","value":"nginx","uuid":"3268e6c7-70be-4625-ac42-912cb818e6d9"},{"key":"Date","value":"Fri, 20 Feb 2026 05:01:08 GMT","uuid":"30c361e5-c33b-4875-a68d-bd1787d14033"},{"key":"Content-Type","value":"application/json","description":"","type":"text","uuid":"3bcd29c7-6c89-40ef-a60b-d59153c21762"},{"key":"Content-Length","value":"90","uuid":"9614314a-dcef-4511-9b70-c6bb5b809771"},{"key":"Connection","value":"keep-alive","uuid":"b6f0dfe7-0854-4f65-8e48-c1c4283e2110"},{"key":"Access-Control-Allow-Origin","value":"*","uuid":"c2e17bca-70ba-4e21-96d5-d9421a3395d2"},{"key":"Access-Control-Allow-Origin","value":"*","uuid":"c2e17bca-70ba-4e21-96d5-d9421a3395d2"},{"key":"Access-Control-Allow-Methods","value":"POST, OPTIONS","uuid":"2b2e9bf2-9730-43d5-a36d-9768035cc65c"},{"key":"Set-Cookie","value":"session_id=O2IhaEjDQ57bM1wjllBhCHmeL6KMocT4H1zgMlCsOPkiqSfVZpX_mYi6XmIcMyU8juO39p6sQOMhsHhrPIqB; Expires=Sat, 20 Feb 2027 05:01:08 GMT; Max-Age=604800; HttpOnly; Path=/","uuid":"26a2712d-4153-4d5b-bafc-44c2dd1aa6ac"},{"key":"X-Content-Type-Options","value":"nosniff","uuid":"b18cf83c-19c8-4450-bfb0-4b6a4add46e7"},{"key":"Strict-Transport-Security","value":"max-age=31536000","uuid":"ca380bdf-6d3e-4073-9f53-95150d32750e"}],"cookie":[],"responseTime":null,"body":"{\n    \"result\": \"AUTH_ERROR\",\n    \"errors\": [\n        {\n            \"code\": \"AUTH_ERROR\",\n            \"message\": \"Invalid API key\"\n        }\n    ]\n}"}],"_postman_id":"fd6c05d4-aaf8-4e76-85b4-8d843247a9a7"},{"name":"IF009 Dispense API","id":"83e74cec-00f4-47d2-829c-e2b789b268f5","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"auth":{"type":"noauth","isInherited":false},"method":"POST","header":[{"key":"x-api-key","value":"{{APIKey}}","type":"text"}],"body":{"mode":"raw","raw":"{\n    \"meta\": {\n        \"event_id\": \"HIS-20260129-144000231\",\n        \"correlation_id\": \"RX-998877\",\n        \"event_type\": \"StockDispenseCreate\",\n        \"source_system\": \"HIS\"\n    },\n    \"payload\": {\n        \"dispense_no\": \"DSP-2026-133\",\n        \"encounter_id\": \"AMB2600001271\",\n        \"dispense_date\": \"2026-01-29T14:30:00\",\n        \"doctor_code\": \"D0055\",\n        \"items\": [\n            \n            {\n                \"line_id\": \"1\",\n                \"item_code\": \"FPMSYR05\",\n                \"quantity\": 1.0,AMB2600001271\n                \"uom_code\": \"ชุด\",\n                \"lot_serial_no\": \"LOT-001\",\n                \"location_code\": \"BHTGS\",\n                \"cost_center_code\": \"CC002\"\n            }\n        ]\n    }\n}","options":{"raw":{"language":"json"}}},"url":"{{Base_URL}}{{Base_PATH}}/StockDispense-Create","urlObject":{"path":["StockDispense-Create"],"host":["{{Base_URL}}{{Base_PATH}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"83e74cec-00f4-47d2-829c-e2b789b268f5"}],"id":"6a3a2aea-6a68-4d09-8e07-41494f14aa8e","_postman_id":"6a3a2aea-6a68-4d09-8e07-41494f14aa8e","description":""},{"name":"IF011 Notify Stock on Hand Change","item":[{"name":"OnStockOnHandChanged","id":"8b4c65d6-2a57-47cb-80b8-623f91d13270","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[{"key":"","value":"","type":"text"}],"body":{"mode":"raw","raw":"{\r\n  \"meta\": {\r\n    \"event_id\": \"ERP-20260220-143521015\",\r\n    \"event_type\": \"OnStockOnHandChanged\",\r\n    \"source_system\": \"ERP\",\r\n    \"correlation_id\": \"P00015\"\r\n  },\r\n  \"payload\": {\r\n    \"movement_id\": \"WH/IN/00010\",\r\n    \"movement_type\": \"incoming\",\r\n    \"event_time\": \"2026-02-20T14:35:21\",\r\n    \"from_location_code\": \"Partners/Vendors\",\r\n    \"to_location_code\": \"WHSTOCK\",\r\n    \"reference_doc\": \"P00015\",\r\n    \"items\": [\r\n      {\r\n        \"line_id\": 1,\r\n        \"move_id\": 44,\r\n        \"move_line_id\": 40,\r\n        \"item_code\": \"E-COM08\",\r\n        \"item_name\": \"Storage Box\",\r\n        \"qty_change\": 1.0,\r\n        \"updated_from_location_onhand_qty\": -3.0,\r\n        \"updated_from_location_available_qty\": -3.0,\r\n        \"updated_to_location_onhand_qty\": 21.0,\r\n        \"updated_to_location_available_qty\": 21.0,\r\n        \"uom_code\": \"Unit\",\r\n        \"lot_no\": \"\",\r\n        \"expiry_date\": \"\",\r\n        \"reference_doc\": \"P00015\"\r\n      }\r\n    ]\r\n  }\r\n}","options":{"raw":{"language":"json"}}},"url":"/api/v3/odoo/StockOnHand-Changed","urlObject":{"path":["api","v3","odoo","StockOnHand-Changed"],"host":[""],"query":[],"variable":[]}},"response":[{"id":"112928d2-3e92-42cd-9aa0-d04511d34434","name":"Success","originalRequest":{"method":"POST","header":[{"key":"","value":"","type":"text"},{"key":"Content-Type","value":"application/json","type":"text"}],"body":{"mode":"raw","raw":"{\r\n  \"meta\": {\r\n    \"event_id\": \"ERP-20260220-143521015\",\r\n    \"event_type\": \"OnStockOnHandChanged\",\r\n    \"source_system\": \"ERP\",\r\n    \"correlation_id\": \"P00015\"\r\n  },\r\n  \"payload\": {\r\n    \"movement_id\": \"WH/IN/00010\",\r\n    \"movement_type\": \"incoming\",\r\n    \"event_time\": \"2026-02-20T14:35:21\",\r\n    \"from_location_code\": \"Partners/Vendors\",\r\n    \"to_location_code\": \"WHSTOCK\",\r\n    \"reference_doc\": \"P00015\",\r\n    \"items\": [\r\n      {\r\n        \"line_id\": 1,\r\n        \"move_id\": 44,\r\n        \"move_line_id\": 40,\r\n        \"item_code\": \"E-COM08\",\r\n        \"item_name\": \"Storage Box\",\r\n        \"qty_change\": 1.0,\r\n        \"updated_from_location_onhand_qty\": -3.0,\r\n        \"updated_from_location_available_qty\": -3.0,\r\n        \"updated_to_location_onhand_qty\": 21.0,\r\n        \"updated_to_location_available_qty\": 21.0,\r\n        \"uom_code\": \"Unit\",\r\n        \"lot_no\": \"\",\r\n        \"expiry_date\": \"\",\r\n        \"reference_doc\": \"P00015\"\r\n      }\r\n    ]\r\n  }\r\n}","options":{"raw":{"language":"json"}}},"url":"/api/v3/odoo/StockOnHand-Changed"},"status":"OK","code":200,"_postman_previewlanguage":"json","header":[{"key":"Content-Type","value":"application/json","description":"","type":"text"}],"cookie":[],"responseTime":null,"body":"{\n    \"result\": \"SUCCESS\",\n    \"meta\": {\n        \"event_id\": \"ERP-20260129-160000123\",\n        \"processed_at\": \"2026-01-29T16:00:01.500\"\n    },\n    \"resource\": {\n        \"message\": \"Inventory updated successfully.\",\n        \"his_ref_id\": \"HIS-TXN-888\"\n    }\n}"},{"id":"964d2149-4ac4-4b5b-b609-0d35a0a1596a","name":"OnStockOnHandChanged Copy","originalRequest":{"method":"POST","header":[{"key":"","value":"","type":"text"}],"url":"/api/v3/odoo/StockOnHand-Changed"},"status":"Not Found","code":404,"_postman_previewlanguage":"json","header":[{"key":"Content-Type","value":"application/json","description":"","type":"text"}],"cookie":[],"responseTime":null,"body":"{\n    \"result\": \"VALIDATION_ERROR\",\n    \"meta\": {\n        \"event_id\": \"ERP-20260129-160000123\",\n        \"processed_at\": \"2026-01-29T16:00:01.500\"\n    },\n    \"errors\": [\n        {\n            \"code\": \"LOCATION_NOT_FOUND\",\n            \"message\": \"Location Code 'BHTPH' does not exist in HIS Master.\"\n        }\n    ]\n}"},{"id":"82fe83f3-7720-440d-8c79-6bca4e8024b5","name":"Processing Error","originalRequest":{"method":"POST","header":[{"key":"","value":"","type":"text"}],"url":"/api/v3/odoo/StockOnHand-Changed"},"status":"Internal Server Error","code":500,"_postman_previewlanguage":"json","header":[{"key":"Content-Type","value":"application/json","description":"","type":"text"}],"cookie":[],"responseTime":null,"body":"{\n    \"result\": \"ERROR\",\n    \"meta\": {\n        \"event_id\": \"ERP-20260129-160000123\",\n        \"processed_at\": \"2026-01-29T16:00:01.500\"\n    },\n    \"errors\": [\n        {\n            \"code\": \"INTERNAL_SERVER_ERROR\",\n            \"message\": \"Database connection failed.\"\n        }\n    ]\n}"}],"_postman_id":"8b4c65d6-2a57-47cb-80b8-623f91d13270"}],"id":"28181012-8e9b-40e1-80a1-9701813e9a1d","_postman_id":"28181012-8e9b-40e1-80a1-9701813e9a1d","description":""},{"name":"IF016 Transaction Update","item":[{"name":"Transaction API Including invoice,payment and deposite","id":"9d575d9b-7f5f-452d-92ed-e71696797920","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"auth":{"type":"noauth","isInherited":false},"method":"POST","header":[{"key":"Content-Type","value":"application/json","type":"text"},{"key":"x-api-key","value":"{{APIKey}}","type":"text"}],"body":{"mode":"raw","raw":"{\r\n    \"meta\": {\r\n        \"event_id\": \"HIS-20260216-001\",\r\n        \"event_type\": \"TransactionRecord\",\r\n        \"source_system\": \"HIS\",\r\n        \"correlation_id\": \"optional\"\r\n    },\r\n    \"payload\": {\r\n        \"batch_id\": \"BATCH-001\",\r\n        \"auto_reverse_accruals\": true,\r\n        \"transactions\": [\r\n            {\r\n                \"transaction_id\": \"PT-001\",\r\n                \"mrn\": \"MRN-002\",\r\n                \"encounter_id\": \"VN-001\",\r\n                \"product_code\": \"E-COM06\",\r\n                \"uom_code\": \"UNIT\",\r\n                \"quantity\": 1,\r\n                \"unit_price\": 500.00,\r\n                \"sold_final_price\": 500.00,\r\n                \"sold_cover_price\": 0,\r\n                \"sold_final_excess_price\": 500.00,\r\n                \"payor_type\": \"Self\",\r\n                \"cost_center_code\": \"OPD-A\",\r\n                \"order_doctor_code\": \"DOC-001\",\r\n                \"status_code\": \"active\",\r\n                \"transaction_datetime\": \"2026-02-16T10:00:00\"\r\n            }\r\n        ],\r\n        \"invoices\": [\r\n            {\r\n                \"invoice_id\": \"INV-001\",\r\n                \"bill_no\": \"B-001\",\r\n                \"bill_date\": \"2026-02-16T10:00:00\",\r\n                \"invoice_type\": \"cgd\",\r\n                \"mrn\": \"MRN-002\",\r\n                \"payor_type\": \"Self\",\r\n                \"payor_code\": null,\r\n                \"is_void\": false,\r\n                \"is_credit_note\": false,\r\n                \"ref_original_bill_no\": null,\r\n                \"is_paid\": true,\r\n                \"auto_reverse_accruals\": true,\r\n                \"transaction_ids\": [\r\n                    \"PT-001\"\r\n                ],\r\n                \"items\": [\r\n                    {\r\n                        \"item_code\": \"E-COM06\",\r\n                        \"item_name\": \"Doctor Consultation\",\r\n                        \"uom_code\": \"UNIT\",\r\n                        \"quantity\": 1,\r\n                        \"unit_price\": 500.00,\r\n                        \"total_amount\": 500.00,\r\n                        \"cost_center_code\": \"OPD-A\"\r\n                    }\r\n                ],\r\n                \"payments\": [\r\n                    {\r\n                        \"payment_method_code\": \"CASH\",\r\n                        \"amount\": 500.00,\r\n                        \"payment_date\": \"2026-02-16T10:05:00\",\r\n                        \"payment_ref\": \"REC-001\",\r\n                        \"type\": \"payment\"\r\n                    }\r\n                ]\r\n            }\r\n        ],\r\n        \"deposits\": [\r\n            {\r\n                \"deposit_id\": \"DEP-001\",\r\n                \"mrn\": \"MRN-002\",\r\n                \"encounter_id\": \"VN-001\",\r\n                \"amount\": 50000,\r\n                \"payment_method_code\": \"CASH\",\r\n                \"payment_datetime\": \"2026-02-16T09:00:00\"\r\n            }\r\n        ]\r\n    }\r\n}","options":{"raw":{"language":"json"}}},"url":"{{Base_URL}}{{Base_PATH}}/TransactionRecord","description":"<h2 id=\"overview\">Overview</h2>\n<p>Creates (or upserts) a <strong>Transaction Record</strong> event from HIS into TMS for downstream billing/accounting processing. Use this endpoint to submit a batch containing <strong>transactions</strong>, <strong>invoices</strong>, and optional <strong>deposits</strong>, along with event metadata for traceability.</p>\n<h2 id=\"endpoint\">Endpoint</h2>\n<ul>\n<li><strong>Method:</strong> <code>POST</code></li>\n<li><strong>URL:</strong> <code>{{Base_URL}}{{Base_PATH}}/TransactionRecord</code></li>\n</ul>\n<h2 id=\"authentication\">Authentication</h2>\n<p>This API uses an API key passed as a request header.</p>\n<h2 id=\"required-headers\">Required headers</h2>\n<ul>\n<li><code>Content-Type: application/json</code></li>\n<li><code>x-api-key: {{APIKey}}</code></li>\n</ul>\n<h2 id=\"variables\">Variables</h2>\n<p>This request expects the following variables to be set (for example, in the active environment):</p>\n<ul>\n<li><code>{{Base_URL}}</code> – API host/base URL</li>\n<li><code>{{Base_PATH}}</code> – base path/prefix for the API</li>\n<li><code>{{APIKey}}</code> – API key value</li>\n</ul>\n<h2 id=\"request-body-schema\">Request body (schema)</h2>\n<p>The JSON payload contains two top-level objects: <code>meta</code> and <code>payload</code>.</p>\n<h3 id=\"meta-event-metadata\"><code>meta</code> (event metadata)</h3>\n<ul>\n<li><code>event_id</code> <em>(string, required)</em>: Unique event identifier from source system (e.g., <code>HIS-20260216-001</code>).</li>\n<li><code>event_type</code> <em>(string, required)</em>: Event name/type. For this endpoint: <code>TransactionRecord</code>.</li>\n<li><code>source_system</code> <em>(string, required)</em>: Source system identifier (e.g., <code>HIS</code>).</li>\n<li><code>correlation_id</code> <em>(string, optional)</em>: Used to correlate calls across systems/flows.</li>\n</ul>\n<h3 id=\"payload-business-content\"><code>payload</code> (business content)</h3>\n<ul>\n<li><code>batch_id</code> <em>(string, required)</em>: Batch identifier grouping this submission.</li>\n<li><code>auto_reverse_accruals</code> <em>(boolean, optional)</em>: Whether accruals should be auto-reversed for items in this batch.</li>\n</ul>\n<h4 id=\"payloadtransactions\"><code>payload.transactions[]</code></h4>\n<p>Array of transaction (service/item) records.\nCommon key fields:</p>\n<ul>\n<li><code>transaction_id</code> <em>(string, required)</em>: Unique ID for the transaction line (used for linking from invoices).</li>\n<li><code>mrn</code> <em>(string, required)</em>: Patient MRN.</li>\n<li><code>encounter_id</code> <em>(string, optional/required by your workflow)</em>: Visit/encounter reference.</li>\n<li><code>product_code</code> <em>(string, required)</em>: Item/service code.</li>\n<li><code>uom_code</code> <em>(string, required)</em>: Unit of measure.</li>\n<li><code>quantity</code> <em>(number, required)</em></li>\n<li><code>unit_price</code> <em>(number, required)</em></li>\n<li><code>sold_final_price</code>, <code>sold_cover_price</code>, <code>sold_final_excess_price</code> <em>(number, optional)</em></li>\n<li><code>payor_type</code> <em>(string, optional)</em></li>\n<li><code>cost_center_code</code> <em>(string, optional)</em></li>\n<li><code>order_doctor_code</code> <em>(string, optional)</em></li>\n<li><code>status_code</code> <em>(string, optional; e.g., <code>active</code>)</em></li>\n<li><code>transaction_datetime</code> <em>(string, required)</em>: Datetime of the transaction.</li>\n</ul>\n<h4 id=\"payloadinvoices\"><code>payload.invoices[]</code></h4>\n<p>Array of invoice/bill records.\nCommon key fields:</p>\n<ul>\n<li><code>invoice_id</code> <em>(string, required)</em></li>\n<li><code>bill_no</code> <em>(string, required)</em></li>\n<li><code>bill_date</code> <em>(string, required)</em></li>\n<li><code>invoice_type</code> <em>(string, optional; e.g., <code>cgd</code>)</em></li>\n<li><code>mrn</code> <em>(string, required)</em></li>\n<li><code>payor_type</code> <em>(string, optional)</em></li>\n<li><code>payor_code</code> <em>(string, nullable/optional)</em></li>\n<li><code>is_void</code> <em>(boolean, optional)</em></li>\n<li><code>is_credit_note</code> <em>(boolean, optional)</em></li>\n<li><code>ref_original_bill_no</code> <em>(string, nullable/optional)</em></li>\n<li><code>is_paid</code> <em>(boolean, optional)</em></li>\n<li><code>auto_reverse_accruals</code> <em>(boolean, optional)</em></li>\n<li><code>transaction_ids</code> <em>(string[], required)</em>: Links invoice to <code>payload.transactions[].transaction_id</code> values.</li>\n</ul>\n<p><code>items[]</code> (invoice line items):</p>\n<ul>\n<li><code>item_code</code>, <code>item_name</code>, <code>uom_code</code> <em>(string)</em></li>\n<li><code>quantity</code>, <code>unit_price</code>, <code>total_amount</code> <em>(number)</em></li>\n<li><code>cost_center_code</code> <em>(string)</em></li>\n</ul>\n<p><code>payments[]</code> (payments against invoice):</p>\n<ul>\n<li><code>payment_method_code</code> <em>(string)</em></li>\n<li><code>amount</code> <em>(number)</em></li>\n<li><code>payment_date</code> <em>(string)</em></li>\n<li><code>payment_ref</code> <em>(string)</em></li>\n<li><code>type</code> <em>(string; e.g., <code>payment</code>)</em></li>\n</ul>\n<h4 id=\"payloaddeposits-optional\"><code>payload.deposits[]</code> <em>(optional)</em></h4>\n<p>Array of deposit records.\nCommon key fields:</p>\n<ul>\n<li><code>deposit_id</code> <em>(string, required)</em></li>\n<li><code>mrn</code> <em>(string, required)</em></li>\n<li><code>encounter_id</code> <em>(string, optional/required by your workflow)</em></li>\n<li><code>amount</code> <em>(number, required)</em></li>\n<li><code>payment_method_code</code> <em>(string, required)</em></li>\n<li><code>payment_datetime</code> <em>(string, required)</em></li>\n</ul>\n<h2 id=\"example-request-body\">Example request body</h2>\n<pre class=\"click-to-expand-wrapper is-snippet-wrapper\"><code class=\"language-json\">{\n  \"meta\": {\n    \"event_id\": \"HIS-20260216-001\",\n    \"event_type\": \"TransactionRecord\",\n    \"source_system\": \"HIS\",\n    \"correlation_id\": \"optional\"\n  },\n  \"payload\": {\n    \"batch_id\": \"BATCH-001\",\n    \"auto_reverse_accruals\": true,\n    \"transactions\": [\n      {\n        \"transaction_id\": \"PT-001\",\n        \"mrn\": \"MRN-001\",\n        \"encounter_id\": \"VN-001\",\n        \"product_code\": \"SRV-CONSULT\",\n        \"uom_code\": \"UNIT\",\n        \"quantity\": 1,\n        \"unit_price\": 500,\n        \"sold_final_price\": 500,\n        \"sold_cover_price\": 0,\n        \"sold_final_excess_price\": 500,\n        \"payor_type\": \"Self\",\n        \"cost_center_code\": \"OPD-A\",\n        \"order_doctor_code\": \"DOC-001\",\n        \"status_code\": \"active\",\n        \"transaction_datetime\": \"2026-02-16T10:00:00\"\n      }\n    ],\n    \"invoices\": [\n      {\n        \"invoice_id\": \"INV-001\",\n        \"bill_no\": \"B-001\",\n        \"bill_date\": \"2026-02-16T10:00:00\",\n        \"invoice_type\": \"cgd\",\n        \"mrn\": \"MRN-001\",\n        \"payor_type\": \"Self\",\n        \"payor_code\": null,\n        \"is_void\": false,\n        \"is_credit_note\": false,\n        \"ref_original_bill_no\": null,\n        \"is_paid\": true,\n        \"auto_reverse_accruals\": true,\n        \"transaction_ids\": [\"PT-001\"],\n        \"items\": [\n          {\n            \"item_code\": \"SRV-CONSULT\",\n            \"item_name\": \"Doctor Consultation\",\n            \"uom_code\": \"UNIT\",\n            \"quantity\": 1,\n            \"unit_price\": 500,\n            \"total_amount\": 500,\n            \"cost_center_code\": \"OPD-A\"\n          }\n        ],\n        \"payments\": [\n          {\n            \"payment_method_code\": \"CASH\",\n            \"amount\": 500,\n            \"payment_date\": \"2026-02-16T10:05:00\",\n            \"payment_ref\": \"REC-001\",\n            \"type\": \"payment\"\n          }\n        ]\n      }\n    ],\n    \"deposits\": [\n      {\n        \"deposit_id\": \"DEP-001\",\n        \"mrn\": \"MRN-001\",\n        \"encounter_id\": \"AN-001\",\n        \"amount\": 50000,\n        \"payment_method_code\": \"CASH\",\n        \"payment_datetime\": \"2026-02-16T09:00:00\"\n      }\n    ]\n  }\n}\n</code></pre>\n<h2 id=\"validation--notes\">Validation &amp; notes</h2>\n<ul>\n<li><strong>Datetime format:</strong> Use ISO-8601 strings (recommended: <code>YYYY-MM-DDTHH:mm:ss</code> or with timezone offset if applicable).</li>\n<li><strong>Uniqueness:</strong> <code>meta.event_id</code> and <code>transactions[].transaction_id</code> should be unique to avoid accidental duplicates.</li>\n<li><strong>Linking:</strong> Every value in <code>invoices[].transaction_ids[]</code> should match an existing <code>transactions[].transaction_id</code> within the same payload/batch.</li>\n<li><strong>Amounts:</strong> Ensure <code>items[].total_amount</code> is consistent with <code>quantity * unit_price</code> based on your business rules.</li>\n</ul>\n<h2 id=\"responses-high-level\">Responses (high-level)</h2>\n<p>No saved examples are attached to this request yet. Typically, expect:</p>\n<ul>\n<li><strong>2xx</strong> for successful receipt/processing (may return an acknowledgement and/or identifiers)</li>\n<li><strong>4xx</strong> for validation/auth errors (missing API key, invalid schema, etc.)</li>\n<li><strong>5xx</strong> for server-side errors</li>\n</ul>\n","urlObject":{"path":["TransactionRecord"],"host":["{{Base_URL}}{{Base_PATH}}"],"query":[],"variable":[]}},"response":[{"id":"4ef687e6-42c4-4cbe-b1b7-818e55bfa9f8","name":"200 Success","originalRequest":{"method":"POST","header":[],"body":{"mode":"raw","raw":"{\r\n    \"meta\": {\r\n        \"event_id\": \"HIS-20260216-001\",\r\n        \"event_type\": \"TransactionRecord\",\r\n        \"source_system\": \"HIS\",\r\n        \"correlation_id\": \"optional\"\r\n    },\r\n    \"payload\": {\r\n        \"batch_id\": \"BATCH-001\",\r\n        \"auto_reverse_accruals\": true,\r\n        \"transactions\": [\r\n            {\r\n                \"transaction_id\": \"PT-001\",\r\n                \"mrn\": \"MRN-001\",\r\n                \"encounter_id\": \"VN-001\",\r\n                \"product_code\": \"SRV-CONSULT\",\r\n                \"uom_code\": \"UNIT\",\r\n                \"quantity\": 1,\r\n                \"unit_price\": 500.00,\r\n                \"sold_final_price\": 500.00,\r\n                \"sold_cover_price\": 0,\r\n                \"sold_final_excess_price\": 500.00,\r\n                \"payor_type\": \"Self\",\r\n                \"cost_center_code\": \"OPD-A\",\r\n                \"order_doctor_code\": \"DOC-001\",\r\n                \"status_code\": \"active\",\r\n                \"transaction_datetime\": \"2026-02-16T10:00:00\"\r\n            }\r\n        ],\r\n        \"invoices\": [\r\n            {\r\n                \"invoice_id\": \"INV-001\",\r\n                \"bill_no\": \"B-001\",\r\n                \"bill_date\": \"2026-02-16T10:00:00\",\r\n                \"invoice_type\": \"cgd\",\r\n                \"mrn\": \"MRN-001\",\r\n                \"payor_type\": \"Self\",\r\n                \"payor_code\": null,\r\n                \"is_void\": false,\r\n                \"is_credit_note\": false,\r\n                \"ref_original_bill_no\": null,\r\n                \"is_paid\": true,\r\n                \"auto_reverse_accruals\": true,\r\n                \"transaction_ids\": [\r\n                    \"PT-001\"\r\n                ],\r\n                \"items\": [\r\n                    {\r\n                        \"item_code\": \"SRV-CONSULT\",\r\n                        \"item_name\": \"Doctor Consultation\",\r\n                        \"uom_code\": \"UNIT\",\r\n                        \"quantity\": 1,\r\n                        \"unit_price\": 500.00,\r\n                        \"total_amount\": 500.00,\r\n                        \"cost_center_code\": \"OPD-A\"\r\n                    }\r\n                ],\r\n                \"payments\": [\r\n                    {\r\n                        \"payment_method_code\": \"CASH\",\r\n                        \"amount\": 500.00,\r\n                        \"payment_date\": \"2026-02-16T10:05:00\",\r\n                        \"payment_ref\": \"REC-001\",\r\n                        \"type\": \"payment\"\r\n                    }\r\n                ]\r\n            }\r\n        ],\r\n        \"deposits\": [\r\n            {\r\n                \"deposit_id\": \"DEP-001\",\r\n                \"mrn\": \"MRN-001\",\r\n                \"encounter_id\": \"AN-001\",\r\n                \"amount\": 50000,\r\n                \"payment_method_code\": \"CASH\",\r\n                \"payment_datetime\": \"2026-02-16T09:00:00\"\r\n            }\r\n        ]\r\n    }\r\n}","options":{"raw":{"language":"json"}}},"url":"{{Base_URL}}{{Base_PATH}}/TransactionRecord"},"status":"OK","code":200,"_postman_previewlanguage":"json","header":[],"cookie":[],"responseTime":null,"body":"{\n  \"status\": \"success\",\n  \"message\": \"Transaction record processed\",\n  \"data\": {\n    \"batch_id\": \"batch-2026-02-20-0001\",\n    \"accepted\": true,\n    \"processed_at\": \"2026-02-20T10:15:30Z\"\n  }\n}"},{"id":"e7a3063f-d64d-4cb4-84af-3f87ed50f06c","name":"400 Bad Request - Validation","originalRequest":{"method":"POST","header":[],"body":{"mode":"raw","raw":"{\r\n    \"meta\": {\r\n        \"event_id\": \"HIS-20260216-001\",\r\n        \"event_type\": \"TransactionRecord\",\r\n        \"source_system\": \"HIS\",\r\n        \"correlation_id\": \"optional\"\r\n    },\r\n    \"payload\": {\r\n        \"batch_id\": \"BATCH-001\",\r\n        \"auto_reverse_accruals\": true,\r\n        \"transactions\": [\r\n            {\r\n                \"transaction_id\": \"PT-001\",\r\n                \"mrn\": \"MRN-001\",\r\n                \"encounter_id\": \"VN-001\",\r\n                \"product_code\": \"SRV-CONSULT\",\r\n                \"uom_code\": \"UNIT\",\r\n                \"quantity\": 1,\r\n                \"unit_price\": 500.00,\r\n                \"sold_final_price\": 500.00,\r\n                \"sold_cover_price\": 0,\r\n                \"sold_final_excess_price\": 500.00,\r\n                \"payor_type\": \"Self\",\r\n                \"cost_center_code\": \"OPD-A\",\r\n                \"order_doctor_code\": \"DOC-001\",\r\n                \"status_code\": \"active\",\r\n                \"transaction_datetime\": \"2026-02-16T10:00:00\"\r\n            }\r\n        ],\r\n        \"invoices\": [\r\n            {\r\n                \"invoice_id\": \"INV-001\",\r\n                \"bill_no\": \"B-001\",\r\n                \"bill_date\": \"2026-02-16T10:00:00\",\r\n                \"invoice_type\": \"cgd\",\r\n                \"mrn\": \"MRN-001\",\r\n                \"payor_type\": \"Self\",\r\n                \"payor_code\": null,\r\n                \"is_void\": false,\r\n                \"is_credit_note\": false,\r\n                \"ref_original_bill_no\": null,\r\n                \"is_paid\": true,\r\n                \"auto_reverse_accruals\": true,\r\n                \"transaction_ids\": [\r\n                    \"PT-001\"\r\n                ],\r\n                \"items\": [\r\n                    {\r\n                        \"item_code\": \"SRV-CONSULT\",\r\n                        \"item_name\": \"Doctor Consultation\",\r\n                        \"uom_code\": \"UNIT\",\r\n                        \"quantity\": 1,\r\n                        \"unit_price\": 500.00,\r\n                        \"total_amount\": 500.00,\r\n                        \"cost_center_code\": \"OPD-A\"\r\n                    }\r\n                ],\r\n                \"payments\": [\r\n                    {\r\n                        \"payment_method_code\": \"CASH\",\r\n                        \"amount\": 500.00,\r\n                        \"payment_date\": \"2026-02-16T10:05:00\",\r\n                        \"payment_ref\": \"REC-001\",\r\n                        \"type\": \"payment\"\r\n                    }\r\n                ]\r\n            }\r\n        ],\r\n        \"deposits\": [\r\n            {\r\n                \"deposit_id\": \"DEP-001\",\r\n                \"mrn\": \"MRN-001\",\r\n                \"encounter_id\": \"AN-001\",\r\n                \"amount\": 50000,\r\n                \"payment_method_code\": \"CASH\",\r\n                \"payment_datetime\": \"2026-02-16T09:00:00\"\r\n            }\r\n        ]\r\n    }\r\n}","options":{"raw":{"language":"json"}}},"url":"{{Base_URL}}{{Base_PATH}}/TransactionRecord"},"status":"Bad Request","code":400,"_postman_previewlanguage":"json","header":[],"cookie":[],"responseTime":null,"body":"{\n  \"status\": \"error\",\n  \"message\": \"Validation failed\",\n  \"errors\": [\n    {\n      \"field\": \"payload.transactions[0].transaction_id\",\n      \"message\": \"Required\"\n    },\n    {\n      \"field\": \"payload.invoices[0].invoice_id\",\n      \"message\": \"Invalid format\"\n    }\n  ]\n}"},{"id":"6834e090-e53d-4ea4-a3be-7fa6d512257a","name":"401 Unauthorized - Invalid API Key","originalRequest":{"method":"POST","header":[],"body":{"mode":"raw","raw":"{\r\n    \"meta\": {\r\n        \"event_id\": \"HIS-20260216-001\",\r\n        \"event_type\": \"TransactionRecord\",\r\n        \"source_system\": \"HIS\",\r\n        \"correlation_id\": \"optional\"\r\n    },\r\n    \"payload\": {\r\n        \"batch_id\": \"BATCH-001\",\r\n        \"auto_reverse_accruals\": true,\r\n        \"transactions\": [\r\n            {\r\n                \"transaction_id\": \"PT-001\",\r\n                \"mrn\": \"MRN-001\",\r\n                \"encounter_id\": \"VN-001\",\r\n                \"product_code\": \"SRV-CONSULT\",\r\n                \"uom_code\": \"UNIT\",\r\n                \"quantity\": 1,\r\n                \"unit_price\": 500.00,\r\n                \"sold_final_price\": 500.00,\r\n                \"sold_cover_price\": 0,\r\n                \"sold_final_excess_price\": 500.00,\r\n                \"payor_type\": \"Self\",\r\n                \"cost_center_code\": \"OPD-A\",\r\n                \"order_doctor_code\": \"DOC-001\",\r\n                \"status_code\": \"active\",\r\n                \"transaction_datetime\": \"2026-02-16T10:00:00\"\r\n            }\r\n        ],\r\n        \"invoices\": [\r\n            {\r\n                \"invoice_id\": \"INV-001\",\r\n                \"bill_no\": \"B-001\",\r\n                \"bill_date\": \"2026-02-16T10:00:00\",\r\n                \"invoice_type\": \"cgd\",\r\n                \"mrn\": \"MRN-001\",\r\n                \"payor_type\": \"Self\",\r\n                \"payor_code\": null,\r\n                \"is_void\": false,\r\n                \"is_credit_note\": false,\r\n                \"ref_original_bill_no\": null,\r\n                \"is_paid\": true,\r\n                \"auto_reverse_accruals\": true,\r\n                \"transaction_ids\": [\r\n                    \"PT-001\"\r\n                ],\r\n                \"items\": [\r\n                    {\r\n                        \"item_code\": \"SRV-CONSULT\",\r\n                        \"item_name\": \"Doctor Consultation\",\r\n                        \"uom_code\": \"UNIT\",\r\n                        \"quantity\": 1,\r\n                        \"unit_price\": 500.00,\r\n                        \"total_amount\": 500.00,\r\n                        \"cost_center_code\": \"OPD-A\"\r\n                    }\r\n                ],\r\n                \"payments\": [\r\n                    {\r\n                        \"payment_method_code\": \"CASH\",\r\n                        \"amount\": 500.00,\r\n                        \"payment_date\": \"2026-02-16T10:05:00\",\r\n                        \"payment_ref\": \"REC-001\",\r\n                        \"type\": \"payment\"\r\n                    }\r\n                ]\r\n            }\r\n        ],\r\n        \"deposits\": [\r\n            {\r\n                \"deposit_id\": \"DEP-001\",\r\n                \"mrn\": \"MRN-001\",\r\n                \"encounter_id\": \"AN-001\",\r\n                \"amount\": 50000,\r\n                \"payment_method_code\": \"CASH\",\r\n                \"payment_datetime\": \"2026-02-16T09:00:00\"\r\n            }\r\n        ]\r\n    }\r\n}","options":{"raw":{"language":"json"}}},"url":"{{Base_URL}}{{Base_PATH}}/TransactionRecord"},"status":"Unauthorized","code":401,"_postman_previewlanguage":"json","header":[],"cookie":[],"responseTime":null,"body":"{\n  \"status\": \"error\",\n  \"message\": \"Unauthorized\",\n  \"detail\": \"Invalid or missing x-api-key\"\n}"},{"id":"dbffbc82-d15b-4065-87ab-11cc98925e15","name":"500 Internal Server Error","originalRequest":{"method":"POST","header":[],"body":{"mode":"raw","raw":"{\r\n    \"meta\": {\r\n        \"event_id\": \"HIS-20260216-001\",\r\n        \"event_type\": \"TransactionRecord\",\r\n        \"source_system\": \"HIS\",\r\n        \"correlation_id\": \"optional\"\r\n    },\r\n    \"payload\": {\r\n        \"batch_id\": \"BATCH-001\",\r\n        \"auto_reverse_accruals\": true,\r\n        \"transactions\": [\r\n            {\r\n                \"transaction_id\": \"PT-001\",\r\n                \"mrn\": \"MRN-001\",\r\n                \"encounter_id\": \"VN-001\",\r\n                \"product_code\": \"SRV-CONSULT\",\r\n                \"uom_code\": \"UNIT\",\r\n                \"quantity\": 1,\r\n                \"unit_price\": 500.00,\r\n                \"sold_final_price\": 500.00,\r\n                \"sold_cover_price\": 0,\r\n                \"sold_final_excess_price\": 500.00,\r\n                \"payor_type\": \"Self\",\r\n                \"cost_center_code\": \"OPD-A\",\r\n                \"order_doctor_code\": \"DOC-001\",\r\n                \"status_code\": \"active\",\r\n                \"transaction_datetime\": \"2026-02-16T10:00:00\"\r\n            }\r\n        ],\r\n        \"invoices\": [\r\n            {\r\n                \"invoice_id\": \"INV-001\",\r\n                \"bill_no\": \"B-001\",\r\n                \"bill_date\": \"2026-02-16T10:00:00\",\r\n                \"invoice_type\": \"cgd\",\r\n                \"mrn\": \"MRN-001\",\r\n                \"payor_type\": \"Self\",\r\n                \"payor_code\": null,\r\n                \"is_void\": false,\r\n                \"is_credit_note\": false,\r\n                \"ref_original_bill_no\": null,\r\n                \"is_paid\": true,\r\n                \"auto_reverse_accruals\": true,\r\n                \"transaction_ids\": [\r\n                    \"PT-001\"\r\n                ],\r\n                \"items\": [\r\n                    {\r\n                        \"item_code\": \"SRV-CONSULT\",\r\n                        \"item_name\": \"Doctor Consultation\",\r\n                        \"uom_code\": \"UNIT\",\r\n                        \"quantity\": 1,\r\n                        \"unit_price\": 500.00,\r\n                        \"total_amount\": 500.00,\r\n                        \"cost_center_code\": \"OPD-A\"\r\n                    }\r\n                ],\r\n                \"payments\": [\r\n                    {\r\n                        \"payment_method_code\": \"CASH\",\r\n                        \"amount\": 500.00,\r\n                        \"payment_date\": \"2026-02-16T10:05:00\",\r\n                        \"payment_ref\": \"REC-001\",\r\n                        \"type\": \"payment\"\r\n                    }\r\n                ]\r\n            }\r\n        ],\r\n        \"deposits\": [\r\n            {\r\n                \"deposit_id\": \"DEP-001\",\r\n                \"mrn\": \"MRN-001\",\r\n                \"encounter_id\": \"AN-001\",\r\n                \"amount\": 50000,\r\n                \"payment_method_code\": \"CASH\",\r\n                \"payment_datetime\": \"2026-02-16T09:00:00\"\r\n            }\r\n        ]\r\n    }\r\n}","options":{"raw":{"language":"json"}}},"url":"{{Base_URL}}{{Base_PATH}}/TransactionRecord"},"status":"Internal Server Error","code":500,"_postman_previewlanguage":"json","header":[],"cookie":[],"responseTime":null,"body":"{\n  \"status\": \"error\",\n  \"message\": \"Internal Server Error\",\n  \"trace_id\": \"{{correlation_id}}\"\n}"}],"_postman_id":"9d575d9b-7f5f-452d-92ed-e71696797920"},{"name":"OPD Walk-in (charge + invoice + payment in one call)","id":"c493930c-94fa-4ed7-9e13-87111b508533","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"auth":{"type":"noauth","isInherited":false},"method":"POST","header":[{"key":"Content-Type","value":"application/json","type":"text"},{"key":"x-api-key","value":"{{APIKey}}","type":"text"}],"body":{"mode":"raw","raw":"{\r\n    \"meta\": {\r\n        \"event_id\": \"HIS-20260216-707\",\r\n        \"event_type\": \"TransactionRecord\",\r\n        \"source_system\": \"HIS\"\r\n    },\r\n    \"payload\": {\r\n        \"batch_id\": \"OPD-20260216-707\",\r\n        \"transactions\": [\r\n            {\r\n                \"transaction_id\": \"PT-97010\",\r\n                \"mrn\": \"MRN-101\",\r\n                \"encounter_id\": \"AN-660214-101\",\r\n                \"product_code\": \"PTACY01\",\r\n                \"quantity\": 1,\r\n                \"unit_price\": 0,\r\n                \"sold_final_price\": 0,\r\n                \"cost_center_code\": \"MHC001\",\r\n                \"status_code\": \"active\",\r\n                \"transaction_datetime\": \"2026-02-16T09:30:00\"\r\n            },\r\n            {\r\n                \"transaction_id\": \"PT-99011\",\r\n                \"mrn\": \"MRN-101\",\r\n                \"encounter_id\": \"AN-660214-101\",\r\n                \"product_code\": \"PXCHL05\",\r\n                \"quantity\": 1,\r\n                \"unit_price\": 300,\r\n                \"sold_final_price\": 300,\r\n                \"cost_center_code\": \"MHC001\",\r\n                \"status_code\": \"active\",\r\n                \"transaction_datetime\": \"2026-02-16T09:45:00\"\r\n            }\r\n        ],\r\n        \"invoices\": [\r\n            {\r\n                \"invoice_id\": \"INV-20260216-1606\",\r\n                \"bill_no\": \"B-7506\",\r\n                \"bill_date\": \"2026-02-16T10:00:00\",\r\n                \"invoice_type\": \"cgd\",\r\n                \"mrn\": \"MRN-101\",\r\n                \"payor_type\": \"Self\",\r\n                \"is_paid\": true,\r\n                \"transaction_ids\": [\r\n                    \"PT-97010\",\r\n                    \"PT-99011\"\r\n                ],\r\n                \"payments\": [\r\n                    {\r\n                        \"mode_of_payment\": \"Self\",\r\n                        \"amount\": 300.00,\r\n                        \"payment_method_code\": \"CASH\",\r\n                        \"payment_date\": \"2026-02-21T14:10:00\",\r\n                        \"payment_ref\": \"RCPT-MIX-007\"\r\n                    }\r\n                ]\r\n            }\r\n        ]\r\n    }\r\n}"},"url":"{{Base_URL}}{{Base_PATH}}/TransactionRecord","urlObject":{"path":["TransactionRecord"],"host":["{{Base_URL}}{{Base_PATH}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"c493930c-94fa-4ed7-9e13-87111b508533"},{"name":"OPD Split Payor (Self + Insurance)","id":"d4c04b0e-fda8-4ac7-bdfd-b8b9623b0e84","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"auth":{"type":"noauth","isInherited":false},"method":"POST","header":[{"key":"Content-Type","value":"application/json","type":"text"},{"key":"x-api-key","value":"{{APIKey}}","type":"text"}],"body":{"mode":"raw","raw":"{\r\n  \"meta\": {\r\n    \"event_id\": \"EVT-AR-002\",\r\n    \"event_type\": \"TransactionRecord\",\r\n    \"source_system\": \"HIS\"\r\n  },\r\n  \"payload\": {\r\n    \"batch_id\": \"BATCH-AR-002\",\r\n    \"transactions\": [\r\n      {\r\n        \"transaction_id\": \"TX-AR-004\",\r\n        \"mrn\": \"250000059\",\r\n        \"encounter_id\": \"AMB2600001263\",\r\n        \"product_code\": \"PTACY01\",\r\n        \"uom_code\": \"เม็ด\",\r\n        \"quantity\": 1,\r\n        \"unit_price\": 3000.00,\r\n        \"sold_final_price\": 3000.00,\r\n        \"cost_center_code\": \"CC001\",\r\n        \"status_code\": \"active\"\r\n      }\r\n    ],\r\n    \"invoices\": [\r\n      {\r\n        \"invoice_id\": \"INV-AR-0087\",\r\n        \"bill_no\": \"BN-AR-010\",\r\n        \"bill_date\": \"2026-02-21T09:00:00\",\r\n        \"mrn\": \"250000059\",\r\n        \"payor_type\": \"Self\",\r\n        \"transaction_ids\": [\"TX-AR-004\"],\r\n        \"payments\": [\r\n          {\r\n            \"mode_of_payment\": \"AR\",\r\n            \"amount\": 3000.00,\r\n            \"payor\": \"BEE001\",\r\n            \"payment_date\": \"2026-02-21T09:05:00\"\r\n          }\r\n        ]\r\n      }\r\n    ]\r\n  }\r\n}","options":{"raw":{"language":"json"}}},"url":"{{Base_URL}}{{Base_PATH}}/TransactionRecord","urlObject":{"path":["TransactionRecord"],"host":["{{Base_URL}}{{Base_PATH}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"d4c04b0e-fda8-4ac7-bdfd-b8b9623b0e84"},{"name":"OPD Split Payor (Discount + Insurance)","id":"2b869612-538e-4280-b6ea-63ff5339ad6d","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"auth":{"type":"noauth","isInherited":false},"method":"POST","header":[{"key":"Content-Type","value":"application/json","type":"text"},{"key":"x-api-key","value":"{{APIKey}}","type":"text"}],"body":{"mode":"raw","raw":"{\r\n  \"meta\": {\r\n    \"event_id\": \"EVT-AR-919\",\r\n    \"event_type\": \"TransactionRecord\",\r\n    \"source_system\": \"HIS\"\r\n  },\r\n  \"payload\": {\r\n    \"batch_id\": \"BATCH-AR-919\",\r\n    \"transactions\": [\r\n      {\r\n        \"transaction_id\": \"TX-AR-117\",\r\n        \"mrn\": \"250000059\",\r\n        \"encounter_id\": \"AMB2600001263\",\r\n        \"product_code\": \"PTACY01\",\r\n        \"uom_code\": \"เม็ด\",\r\n        \"quantity\": 2,\r\n        \"unit_price\": 3000.00,\r\n        \"discount_amt\": 500.00,\r\n        \"sold_final_price\": 5500.00,\r\n        \"cost_center_code\": \"OPD\",\r\n        \"status_code\": \"active\"\r\n      }\r\n    ],\r\n    \"invoices\": [\r\n      {\r\n        \"invoice_id\": \"INV-AR-3061\",\r\n        \"bill_no\": \"BN-AR-311\",\r\n        \"bill_date\": \"2026-02-21T09:00:00\",\r\n        \"mrn\": \"250000059\",\r\n        \"payor_type\": \"Self\",\r\n        \"transaction_ids\": [\"TX-AR-117\"],\r\n        \"payments\": [\r\n          {\r\n            \"mode_of_payment\": \"AR\",\r\n            \"amount\": 5500.00,\r\n            \"payor\": \"BEE001\",\r\n            \"payment_date\": \"2026-02-21T09:05:00\"\r\n          }\r\n        ]\r\n      }\r\n    ]\r\n  }\r\n}","options":{"raw":{"language":"json"}}},"url":"{{Base_URL}}{{Base_PATH}}/TransactionRecord","urlObject":{"path":["TransactionRecord"],"host":["{{Base_URL}}{{Base_PATH}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"2b869612-538e-4280-b6ea-63ff5339ad6d"},{"name":"IPD Discharge (invoice + auto-reverse accruals)","id":"13aae4cf-a762-4da5-986a-d8564eac2a7d","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[{"key":"x-api-key","value":"{{APIKey}}","type":"text"}],"body":{"mode":"raw","raw":"{\n    \"meta\": {\n        \"event_id\": \"HIS-20260218-DISCH\",\n        \"event_type\": \"TransactionRecord\",\n        \"source_system\": \"HIS\"\n    },\n    \"payload\": {\n        \"batch_id\": \"IPD-DISCHARGE-20260218-001\",\n        \"auto_reverse_accruals\": true,\n        \"transactions\": [\n            {\n                \"transaction_id\": \"PT-3005\",\n                \"mrn\": \"MRN-003\",\n                \"encounter_id\": \"AN-660214-001\",\n                \"product_code\": \"SRV-DOCTOR-FEE\",\n                \"uom_code\": \"UNIT\",\n                \"quantity\": 1,\n                \"unit_price\": 1500,\n                \"sold_final_price\": 1500,\n                \"cost_center_code\": \"MED\",\n                \"status_code\": \"active\",\n                \"transaction_datetime\": \"2026-02-18T08:00:00\"\n            }\n        ],\n        \"invoices\": [\n            {\n                \"invoice_id\": \"INV-DISCH-003\",\n                \"bill_no\": \"B-IPD-003\",\n                \"bill_date\": \"2026-02-18T10:00:00\",\n                \"invoice_type\": \"cgd\",\n                \"mrn\": \"MRN-003\",\n                \"payor_type\": \"Self\",\n                \"is_paid\": true,\n                \"transaction_ids\": [\n                    \"PT-3001\",\n                    \"PT-3002\",\n                    \"PT-3005\"\n                ],\n                \"payments\": [\n                    {\n                        \"mode_of_payment\": \"CreditNote\",\n                        \"amount\": 21530.00,\n                        \"reasonCode\": \"STAFF_DISC\",\n                        \"payment_date\": \"2026-02-21T14:10:00\"\n                    }\n                ]\n            }\n        ]\n    }\n}","options":{"raw":{"language":"json"}}},"url":"{{Base_URL}}{{Base_PATH}}/TransactionRecord","urlObject":{"path":["TransactionRecord"],"host":["{{Base_URL}}{{Base_PATH}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"13aae4cf-a762-4da5-986a-d8564eac2a7d"},{"name":"IPD Daily Accrual (transactions only, no invoice)","id":"fd46c402-11db-44fa-82d9-e3962cf6b820","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[{"key":"x-api-key","value":"{{APIKey}}","type":"text"}],"body":{"mode":"raw","raw":"{\n    \"meta\": {\n        \"event_id\": \"HIS-20260216-NIGHT\",\n        \"event_type\": \"TransactionRecord\",\n        \"source_system\": \"HIS\"\n    },\n    \"payload\": {\n        \"batch_id\": \"IPD-ACCRUAL-20260216\",\n        \"transactions\": [\n            {\n                \"transaction_id\": \"PT-3001\",\n                \"mrn\": \"MRN-003\",\n                \"encounter_id\": \"AN-660214-001\",\n                \"product_code\": \"SRV-ROOM-VIP\",\n                \"uom_code\": \"UNIT\",\n                \"quantity\": 1,\n                \"unit_price\": 5000,\n                \"sold_final_price\": 5000,\n                \"cost_center_code\": \"WARD-VIP\",\n                \"status_code\": \"active\",\n                \"transaction_datetime\": \"2026-02-16T23:59:59\"\n            },\n            {\n                \"transaction_id\": \"PT-3002\",\n                \"mrn\": \"MRN-003\",\n                \"encounter_id\": \"AN-660214-001\",\n                \"product_code\": \"MED-PARACETAMOL\",\n                \"uom_code\": \"UNIT\",\n                \"quantity\": 6,\n                \"unit_price\": 5,\n                \"sold_final_price\": 30,\n                \"cost_center_code\": \"PHARM\",\n                \"status_code\": \"active\",\n                \"transaction_datetime\": \"2026-02-16T14:30:00\"\n            }\n        ]\n    }\n}","options":{"raw":{"language":"json"}}},"url":"{{Base_URL}}{{Base_PATH}}/TransactionRecord","urlObject":{"path":["TransactionRecord"],"host":["{{Base_URL}}{{Base_PATH}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"fd46c402-11db-44fa-82d9-e3962cf6b820"},{"name":"Register Deposit","id":"6b7ba3d8-97d4-44be-bb6c-503e424d301c","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[{"key":"x-api-key","value":"{{APIKey}}","type":"text"}],"body":{"mode":"raw","raw":"{\n    \"meta\": {\n        \"event_id\": \"HIS-20260215-DEP\",\n        \"event_type\": \"TransactionRecord\",\n        \"source_system\": \"HIS\"\n    },\n    \"payload\": {\n        \"batch_id\": \"DEP-20260214-002\",\n        \"deposits\": [\n            {\n                \"deposit_id\": \"DEP-005\",\n                \"mrn\": \"MRN-003\",\n                \"encounter_id\": \"AN-660214-001\",\n                \"amount\": 50000,\n                \"payment_method_code\": \"CASH\",\n                \"payment_datetime\": \"2026-02-14T09:00:00\"\n            }\n        ]\n    }\n}","options":{"raw":{"language":"json"}}},"url":"{{Base_URL}}{{Base_PATH}}/TransactionRecord","urlObject":{"path":["TransactionRecord"],"host":["{{Base_URL}}{{Base_PATH}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"6b7ba3d8-97d4-44be-bb6c-503e424d301c"},{"name":"Cancel Transaction (pre-invoice)","id":"fecfcb0c-8d22-4c6d-8d29-7ed303a07fcb","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[{"key":"x-api-key","value":"{{APIKey}}","type":"text"}],"body":{"mode":"raw","raw":"{\n    \"meta\": {\n        \"event_id\": \"HIS-20260216-CANCEL\",\n        \"event_type\": \"TransactionRecord\",\n        \"source_system\": \"HIS\"\n    },\n    \"payload\": {\n        \"batch_id\": \"CANCEL-20260216-001\",\n        \"transactions\": [\n            {\n                \"transaction_id\": \"PT-3002\",\n                \"mrn\": \"MRN-003\",\n                \"encounter_id\": \"AN-660214-001\",\n                \"product_code\": \"MED-PARACETAMOL\",\n                \"uom_code\": \"TAB\",\n                \"quantity\": 6,\n                \"unit_price\": 5,\n                \"sold_final_price\": 30,\n                \"cost_center_code\": \"PHARM\",\n                \"status_code\": \"cancelled\",\n                \"transaction_datetime\": \"2026-02-16T14:30:00\"\n            }\n        ]\n    }\n}","options":{"raw":{"language":"json"}}},"url":"{{Base_URL}}{{Base_PATH}}/TransactionRecord","urlObject":{"path":["TransactionRecord"],"host":["{{Base_URL}}{{Base_PATH}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"fecfcb0c-8d22-4c6d-8d29-7ed303a07fcb"},{"name":"Void Invoice","id":"78fe89bb-ea4b-4c40-8a45-43fcd17ab2c1","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[{"key":"x-api-key","value":"{{APIKey}}","type":"text"}],"body":{"mode":"raw","raw":"{\n    \"meta\": {\n        \"event_id\": \"HIS-20260216-VOID\",\n        \"event_type\": \"TransactionRecord\",\n        \"source_system\": \"HIS\"\n    },\n    \"payload\": {\n        \"batch_id\": \"VOID-20260216-001\",\n        \"invoices\": [\n            {\n                \"invoice_id\": \"INV-DISCH-003\",\n                \"bill_no\": \"B-IPD-003\",\n                \"bill_date\": \"2026-02-16T10:00:00\",\n                \"invoice_type\": \"cgd\",\n                \"mrn\": \"MRN-003\",\n                \"payor_type\": \"Self\",\n                \"is_void\": true,\n                \"void_reason\": \"Wrong patient billed\"\n            }\n        ]\n    }\n}","options":{"raw":{"language":"json"}}},"url":"{{Base_URL}}{{Base_PATH}}/TransactionRecord","urlObject":{"path":["TransactionRecord"],"host":["{{Base_URL}}{{Base_PATH}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"78fe89bb-ea4b-4c40-8a45-43fcd17ab2c1"},{"name":"Insurance Partial Approval + Bill Patient","id":"34704b3a-5fb4-416b-8044-baee556ce989","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[{"key":"x-api-key","value":"{{APIKey}}","type":"text"}],"body":{"mode":"raw","raw":"{\n    \"meta\": {\n        \"event_id\": \"HIS-20260301-INSADJ\",\n        \"event_type\": \"TransactionRecord\",\n        \"source_system\": \"HIS\"\n    },\n    \"payload\": {\n        \"batch_id\": \"INSADJ-20260301-001\",\n        \"invoices\": [\n            {\n                \"invoice_id\": \"INV-INS-006\",\n                \"bill_no\": \"CN-INS-002\",\n                \"bill_date\": \"2026-03-01T10:00:00\",\n                \"invoice_type\": \"insurance\",\n                \"mrn\": \"MRN-002\",\n                \"payor_type\": \"Insurance\",\n                \"payor_code\": \"AIA\",\n                \"is_credit_note\": true,\n                \"ref_original_bill_no\": \"B-INS-002\"\n            },\n            {\n                \"invoice_id\": \"INV-PATIENT-002\",\n                \"bill_no\": \"B-PATIENT-002\",\n                \"bill_date\": \"2026-03-01T10:00:00\",\n                \"invoice_type\": \"cgd\",\n                \"mrn\": \"MRN-002\",\n                \"payor_type\": \"Self\",\n                \"is_paid\": false,\n                \"transaction_ids\": [\n                    \"PT-2001\"\n                ]\n            }\n        ]\n    }\n}","options":{"raw":{"language":"json"}}},"url":"{{Base_URL}}{{Base_PATH}}/TransactionRecord","urlObject":{"path":["TransactionRecord"],"host":["{{Base_URL}}{{Base_PATH}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"34704b3a-5fb4-416b-8044-baee556ce989"}],"id":"270faad1-2cfb-4520-90e5-775d6c882df4","description":"<p>aggregated planty of necessary interface functions as follows:</p>\n<ul>\n<li><p>Tranaction interface</p>\n</li>\n<li><p>Invoice Interface</p>\n</li>\n<li><p>Deposit Interfac</p>\n</li>\n<li><p>Cancel Transaction Interface</p>\n</li>\n<li><p>Cancel Invoice Interface</p>\n</li>\n<li><p>Payment Interface</p>\n</li>\n</ul>\n","_postman_id":"270faad1-2cfb-4520-90e5-775d6c882df4"},{"name":"Master Upsert API's","item":[{"name":"Upsert Price List","id":"a29d4a38-5f27-45ad-872f-170a263c1125","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[{"key":"x-api-key","value":"{{APIKey}}","type":"text"}],"body":{"mode":"raw","raw":"{\n  \"meta\": {\n    \"event_id\": \"HIS-20260325-123456994\",\n    \"source_system\": \"HIS\",\n    \"event_type\": \"PriceListUpsert\"\n  },\n  \"pricelist\": {\n    \"pricelist_code\": \"PL002\",\n    \"name\": \"Pricelist New name updated\",\n    \"currency_code\": \"USD\",\n    \"active\": true,\n    \"items\": [\n      {\n        \"item_code\": \"PMETH05\",\n        \"price\": 50,\n        \"uom_code\": \"UNIT\",\n        \"min_quantity\": 1,\n        \"date_start\": \"2026-01-01\",\n        \"date_end\": \"2026-12-31\"\n      },\n      {\n        \"item_code\": \"PXCHL05\",\n        \"price\": 200\n      }\n    ]\n  }\n}"},"url":"{{Base_URL}}{{Base_PATH}}/pricelist","description":"<h2 id=\"upsert-price-list\">Upsert Price List</h2>\n<p>Creates or updates (<strong>upserts</strong>) a <strong>Price List</strong> record in TMS/Odoo from an external system (e.g., HIS). Use this endpoint to synchronize pricing data including item codes, prices, units of measure, and validity periods.</p>\n<hr />\n<h3 id=\"endpoint\">Endpoint</h3>\n<p><code>POST {{Base_URL}}{{Base_PATH}}/pricelist</code></p>\n<hr />\n<h3 id=\"authentication\">Authentication</h3>\n<p>All requests must include a valid API key in the request header:</p>\n<div class=\"click-to-expand-wrapper is-table-wrapper\"><table>\n<thead>\n<tr>\n<th>Header</th>\n<th>Value</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td><code>x-api-key</code></td>\n<td><code>{{APIKey}}</code></td>\n</tr>\n</tbody>\n</table>\n</div><hr />\n<h3 id=\"request-body\">Request Body</h3>\n<p>The request body must be a JSON object with two top-level fields: <code>meta</code> and <code>pricelist</code>.</p>\n<h4 id=\"meta-object\"><code>meta</code> Object</h4>\n<div class=\"click-to-expand-wrapper is-table-wrapper\"><table>\n<thead>\n<tr>\n<th>Field</th>\n<th>Type</th>\n<th>Required</th>\n<th>Description</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td><code>event_id</code></td>\n<td>string</td>\n<td>Yes</td>\n<td>Unique identifier for this event (e.g., <code>HIS-20260325-123456790</code>)</td>\n</tr>\n<tr>\n<td><code>source_system</code></td>\n<td>string</td>\n<td>Yes</td>\n<td>The originating system sending the event (e.g., <code>HIS</code>)</td>\n</tr>\n<tr>\n<td><code>event_type</code></td>\n<td>string</td>\n<td>Yes</td>\n<td>Must be <code>PriceListUpsert</code></td>\n</tr>\n</tbody>\n</table>\n</div><h4 id=\"pricelist-object\"><code>pricelist</code> Object</h4>\n<div class=\"click-to-expand-wrapper is-table-wrapper\"><table>\n<thead>\n<tr>\n<th>Field</th>\n<th>Type</th>\n<th>Required</th>\n<th>Description</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td><code>pricelist_code</code></td>\n<td>string</td>\n<td>Yes</td>\n<td>Unique code identifying the price list (e.g., <code>PL001</code>)</td>\n</tr>\n<tr>\n<td><code>name</code></td>\n<td>string</td>\n<td>Yes</td>\n<td>Display name of the price list</td>\n</tr>\n<tr>\n<td><code>currency_code</code></td>\n<td>string</td>\n<td>Yes</td>\n<td>ISO 4217 currency code (e.g., <code>USD</code>, <code>THB</code>)</td>\n</tr>\n<tr>\n<td><code>active</code></td>\n<td>boolean</td>\n<td>Yes</td>\n<td>Whether the price list is active</td>\n</tr>\n<tr>\n<td><code>items</code></td>\n<td>array</td>\n<td>Yes</td>\n<td>List of price list line items (see below)</td>\n</tr>\n</tbody>\n</table>\n</div><h4 id=\"pricelistitems--line-item-object\"><code>pricelist.items[]</code> — Line Item Object</h4>\n<div class=\"click-to-expand-wrapper is-table-wrapper\"><table>\n<thead>\n<tr>\n<th>Field</th>\n<th>Type</th>\n<th>Required</th>\n<th>Description</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td><code>item_code</code></td>\n<td>string</td>\n<td>Yes</td>\n<td>Code of the item/product</td>\n</tr>\n<tr>\n<td><code>price</code></td>\n<td>number</td>\n<td>Yes</td>\n<td>Unit price of the item</td>\n</tr>\n<tr>\n<td><code>uom_code</code></td>\n<td>string</td>\n<td>No</td>\n<td>Unit of measure code (e.g., <code>UNIT</code>)</td>\n</tr>\n<tr>\n<td><code>min_quantity</code></td>\n<td>number</td>\n<td>No</td>\n<td>Minimum quantity for this price to apply</td>\n</tr>\n<tr>\n<td><code>date_start</code></td>\n<td>string (date)</td>\n<td>No</td>\n<td>Start date of price validity (<code>YYYY-MM-DD</code>)</td>\n</tr>\n<tr>\n<td><code>date_end</code></td>\n<td>string (date)</td>\n<td>No</td>\n<td>End date of price validity (<code>YYYY-MM-DD</code>)</td>\n</tr>\n</tbody>\n</table>\n</div><hr />\n<h3 id=\"example-request-body\">Example Request Body</h3>\n<pre class=\"click-to-expand-wrapper is-snippet-wrapper\"><code class=\"language-json\">{\n  \"meta\": {\n    \"event_id\": \"HIS-20260325-123456790\",\n    \"source_system\": \"HIS\",\n    \"event_type\": \"PriceListUpsert\"\n  },\n  \"pricelist\": {\n    \"pricelist_code\": \"PL001\",\n    \"name\": \"Standard Pricelist\",\n    \"currency_code\": \"USD\",\n    \"active\": true,\n    \"items\": [\n      {\n        \"item_code\": \"ITEM001\",\n        \"price\": 100,\n        \"uom_code\": \"UNIT\",\n        \"min_quantity\": 1,\n        \"date_start\": \"2026-01-01\",\n        \"date_end\": \"2026-12-31\"\n      },\n      {\n        \"item_code\": \"ITEM002\",\n        \"price\": 200\n      }\n    ]\n  }\n}\n\n</code></pre>\n<hr />\n<h3 id=\"behavior\">Behavior</h3>\n<ul>\n<li><p>If a price list with the given <code>pricelist_code</code> <strong>already exists</strong>, it will be <strong>updated</strong>.</p>\n</li>\n<li><p>If it <strong>does not exist</strong>, a <strong>new price list</strong> will be <strong>created</strong>.</p>\n</li>\n<li><p>Items within the price list are also upserted based on <code>item_code</code>.</p>\n</li>\n<li><p>Partial item definitions (e.g., omitting <code>uom_code</code>, <code>date_start</code>, <code>date_end</code>) are accepted; missing optional fields will be left as default or unchanged.</p>\n</li>\n</ul>\n<hr />\n<h3 id=\"variables\">Variables</h3>\n<div class=\"click-to-expand-wrapper is-table-wrapper\"><table>\n<thead>\n<tr>\n<th>Variable</th>\n<th>Description</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td><code>{{Base_URL}}</code></td>\n<td>Base URL of the TMS API server</td>\n</tr>\n<tr>\n<td><code>{{Base_PATH}}</code></td>\n<td>Base path prefix for the API version (e.g., <code>/api/v3/odoo</code>)</td>\n</tr>\n<tr>\n<td><code>{{APIKey}}</code></td>\n<td>API key for authenticating requests</td>\n</tr>\n</tbody>\n</table>\n</div><p>Set these in the <strong>TMS-DEV</strong> environment before sending requests.</p>\n","urlObject":{"path":["pricelist"],"host":["{{Base_URL}}{{Base_PATH}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"a29d4a38-5f27-45ad-872f-170a263c1125"},{"name":"Upsert Payor","id":"2571f593-1e31-4bbd-ad56-d8c3af03f81b","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[{"key":"x-api-key","value":"{{APIKey}}","type":"text"}],"body":{"mode":"raw","raw":"{\n    \"meta\": {\n        \"event_id\": \"PAYOR-20260325-997654324\",\n        \"correlation_id\": \"CORR-001\",\n        \"source_system\": \"HIS\"\n    },\n    \"payor\": {\n        \"payor_code\": \"PAY001\",\n        \"name\": \"Name chneg Insurance\",\n        \"payor_type\": \"insurance\",\n        \"tax_id\": \"GST12345\",\n        \"email\": \"INSURANCE@abc.com\",\n        \"phone\": \"1234567\",\n        \"mobile\": \"18262266\",\n        \"website\": \"https://abcinsurance.com\",\n        \"street\": \"Main Road\",\n        \"city\": \"Calicut\",\n        \"state_code\": \"KL\",\n        \"zip\": \"673001\",\n        \"country_code\": \"IN\",\n        \"requires_claim_ref\": true,\n        \"contact_person\": \"John Doe\",\n        \"contact_person_phone\": \"9999999999\",\n        \"contact_person_email\": \"john@abc.com\",\n        \"payment_terms\": \"30 Days\",\n        \"credit_limit\": 50000,\n        \"active\": true,\n        \"notes\": \"Preferred insurance partner\",\n        \"is_payer\": true\n    }\n}"},"url":"{{Base_URL}}/api/v1/his/payors","description":"<h2 id=\"upsert-payor\">Upsert Payor</h2>\n<p>Creates a new payor record or updates an existing one in the HIS (Hospital Information System). The upsert logic is driven by <code>payor_code</code> — if a payor with the given code already exists, it will be updated; otherwise, a new record is inserted.</p>\n<hr />\n<h2 id=\"authentication\">Authentication</h2>\n<p>This endpoint requires an API key passed as a request header:</p>\n<div class=\"click-to-expand-wrapper is-table-wrapper\"><table>\n<thead>\n<tr>\n<th>Header</th>\n<th>Value</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td><code>x-api-key</code></td>\n<td><code>{{APIKey}}</code></td>\n</tr>\n</tbody>\n</table>\n</div><hr />\n<h2 id=\"request-body\">Request Body</h2>\n<p>The request body is a JSON object with two top-level keys: <code>meta</code> and <code>payor</code>.</p>\n<h3 id=\"meta--event-metadata\"><code>meta</code> — Event Metadata</h3>\n<p>Provides traceability and context for the event being submitted.</p>\n<div class=\"click-to-expand-wrapper is-table-wrapper\"><table>\n<thead>\n<tr>\n<th>Field</th>\n<th>Type</th>\n<th>Description</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td><code>event_id</code></td>\n<td><code>string</code></td>\n<td>Unique identifier for this event (e.g., <code>PAYOR-20260325-987654322</code>)</td>\n</tr>\n<tr>\n<td><code>correlation_id</code></td>\n<td><code>string</code></td>\n<td>Correlation ID used to trace the request across systems</td>\n</tr>\n<tr>\n<td><code>source_system</code></td>\n<td><code>string</code></td>\n<td>The originating system sending the request (e.g., <code>HIS</code>)</td>\n</tr>\n</tbody>\n</table>\n</div><hr />\n<h3 id=\"payor--payor-record\"><code>payor</code> — Payor Record</h3>\n<p>Contains the full details of the payor to be inserted or updated.</p>\n<div class=\"click-to-expand-wrapper is-table-wrapper\"><table>\n<thead>\n<tr>\n<th>Field</th>\n<th>Type</th>\n<th>Description</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td><code>payor_code</code></td>\n<td><code>string</code></td>\n<td><strong>Unique identifier</strong> used for upsert logic. If a payor with this code exists, it will be updated.</td>\n</tr>\n<tr>\n<td><code>name</code></td>\n<td><code>string</code></td>\n<td>Full name of the payor (e.g., insurance company or individual)</td>\n</tr>\n<tr>\n<td><code>payor_type</code></td>\n<td><code>string</code></td>\n<td>Type of payor. Common values: <code>insurance</code>, <code>corporate</code>, <code>government</code>, <code>self</code></td>\n</tr>\n<tr>\n<td><code>tax_id</code></td>\n<td><code>string</code></td>\n<td>Tax identification number (e.g., GST number)</td>\n</tr>\n<tr>\n<td><code>email</code></td>\n<td><code>string</code></td>\n<td>Primary email address of the payor</td>\n</tr>\n<tr>\n<td><code>phone</code></td>\n<td><code>string</code></td>\n<td>Landline/office phone number</td>\n</tr>\n<tr>\n<td><code>mobile</code></td>\n<td><code>string</code></td>\n<td>Mobile contact number</td>\n</tr>\n<tr>\n<td><code>website</code></td>\n<td><code>string</code></td>\n<td>Payor's official website URL</td>\n</tr>\n<tr>\n<td><code>street</code></td>\n<td><code>string</code></td>\n<td>Street address</td>\n</tr>\n<tr>\n<td><code>city</code></td>\n<td><code>string</code></td>\n<td>City name</td>\n</tr>\n<tr>\n<td><code>state_code</code></td>\n<td><code>string</code></td>\n<td>State code (e.g., <code>KL</code> for Kerala)</td>\n</tr>\n<tr>\n<td><code>zip</code></td>\n<td><code>string</code></td>\n<td>Postal/ZIP code</td>\n</tr>\n<tr>\n<td><code>country_code</code></td>\n<td><code>string</code></td>\n<td>ISO country code (e.g., <code>IN</code> for India)</td>\n</tr>\n<tr>\n<td><code>requires_claim_ref</code></td>\n<td><code>boolean</code></td>\n<td>If <code>true</code>, a claim reference number is mandatory when billing this payor</td>\n</tr>\n<tr>\n<td><code>contact_person</code></td>\n<td><code>string</code></td>\n<td>Name of the primary contact person at the payor organization</td>\n</tr>\n<tr>\n<td><code>contact_person_phone</code></td>\n<td><code>string</code></td>\n<td>Phone number of the contact person</td>\n</tr>\n<tr>\n<td><code>contact_person_email</code></td>\n<td><code>string</code></td>\n<td>Email address of the contact person</td>\n</tr>\n<tr>\n<td><code>payment_terms</code></td>\n<td><code>string</code></td>\n<td>Payment terms agreed with the payor (e.g., <code>30 Days</code>)</td>\n</tr>\n<tr>\n<td><code>credit_limit</code></td>\n<td><code>number</code></td>\n<td>Maximum credit amount extended to this payor</td>\n</tr>\n<tr>\n<td><code>active</code></td>\n<td><code>boolean</code></td>\n<td>If <code>true</code>, the payor is active and available for use in transactions</td>\n</tr>\n<tr>\n<td><code>notes</code></td>\n<td><code>string</code></td>\n<td>Any additional notes or remarks about the payor</td>\n</tr>\n<tr>\n<td><code>is_payer</code></td>\n<td><code>boolean</code></td>\n<td>If <code>true</code>, this entity is responsible for making payments (as opposed to just being a guarantor or referral source)</td>\n</tr>\n</tbody>\n</table>\n</div><hr />\n<h2 id=\"key-field-notes\">Key Field Notes</h2>\n<ul>\n<li><strong><code>payor_code</code></strong> — Acts as the natural key for upsert. Always provide a stable, unique code per payor.</li>\n<li><strong><code>payor_type</code></strong> — Determines how billing and claim workflows are handled for this payor. Ensure the value matches the system's supported types.</li>\n<li><strong><code>requires_claim_ref</code></strong> — When set to <code>true</code>, the billing module will enforce a claim reference number during invoice creation for this payor.</li>\n<li><strong><code>is_payer</code></strong> — Distinguishes between entities that are financially responsible (<code>true</code>) versus those that are only referenced for administrative purposes.</li>\n<li><strong><code>active</code></strong> — Inactive payors (<code>false</code>) are excluded from billing dropdowns and transaction flows without being deleted from the system.</li>\n<li><strong><code>credit_limit</code></strong> — Used by the AR module to enforce credit controls. Set to <code>0</code> if no credit is extended.</li>\n</ul>\n","urlObject":{"path":["api","v1","his","payors"],"host":["{{Base_URL}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"2571f593-1e31-4bbd-ad56-d8c3af03f81b"},{"name":"Upsert Doctor","id":"b207ec34-7c55-4eac-bafa-121bcab8c223","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[{"key":"x-api-key","value":"{{APIKey}}","type":"text"}],"body":{"mode":"raw","raw":"{\n    \"meta\": {\n        \"event_id\": \"HIS-20260325-111222335\",\n        \"source_system\": \"HIS\",\n        \"event_type\": \"DoctorUpsert\"\n    },\n    \"doctor\": {\n        \"doctor_code\": \"DOC012\",\n        \"name\": \"Dr. Kurien\",\n        \"email\": \"jKurien@hospital.com\",\n        \"phone\": \"04842345678\",\n        \"mobile\": \"9876543210\",\n        \"active\": true,\n        \"doctor_type\": \"consultant\",\n        \"license_no\": \"LIC1234587989\",\n        \"department_code\": \"CARD\",\n        \"specialization_code\": \"CARDIO\"\n    }\n}"},"url":"{{Base_URL}}{{Base_PATH}}/doctors","description":"<h2 id=\"upsert-doctor\">Upsert Doctor</h2>\n<p>Creates or updates (<strong>upserts</strong>) a doctor record in TMS/Odoo from an external system (e.g., HIS). Use this endpoint to synchronize doctor master data — including contact details, department, specialization, and license information.</p>\n<hr />\n<h2 id=\"authentication\">Authentication</h2>\n<p>This endpoint requires an API key passed via the request header:</p>\n<div class=\"click-to-expand-wrapper is-table-wrapper\"><table>\n<thead>\n<tr>\n<th>Header</th>\n<th>Value</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td><code>x-api-key</code></td>\n<td><code>{{APIKey}}</code></td>\n</tr>\n</tbody>\n</table>\n</div><blockquote>\n<p>Set the <code>APIKey</code> variable in the active environment (e.g., <strong>TMS-DEV</strong>).</p>\n</blockquote>\n<hr />\n<h2 id=\"base-url\">Base URL</h2>\n<p>The full endpoint URL is constructed from environment variables:</p>\n<pre class=\"click-to-expand-wrapper is-snippet-wrapper\"><code>{{Base_URL}}{{Base_PATH}}/doctors\n</code></pre><div class=\"click-to-expand-wrapper is-table-wrapper\"><table>\n<thead>\n<tr>\n<th>Variable</th>\n<th>Description</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td><code>Base_URL</code></td>\n<td>The root URL of the TMS API server (e.g., <code>https://tnh-dev.vgroupth.com</code>)</td>\n</tr>\n<tr>\n<td><code>Base_PATH</code></td>\n<td>The API version path prefix (e.g., <code>/api/v3/odoo</code>)</td>\n</tr>\n</tbody>\n</table>\n</div><hr />\n<h2 id=\"request-body\">Request Body</h2>\n<p>Send a JSON payload with two top-level keys: <code>meta</code> and <code>doctor</code>.</p>\n<h3 id=\"meta-object\"><code>meta</code> Object</h3>\n<div class=\"click-to-expand-wrapper is-table-wrapper\"><table>\n<thead>\n<tr>\n<th>Field</th>\n<th>Type</th>\n<th>Description</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td><code>event_id</code></td>\n<td><code>string</code></td>\n<td>Unique event identifier from the source system (e.g., <code>HIS-20260325-111222334</code>)</td>\n</tr>\n<tr>\n<td><code>source_system</code></td>\n<td><code>string</code></td>\n<td>Originating system code (e.g., <code>HIS</code>)</td>\n</tr>\n<tr>\n<td><code>event_type</code></td>\n<td><code>string</code></td>\n<td>Type of event being sent. Must be <code>DoctorUpsert</code></td>\n</tr>\n</tbody>\n</table>\n</div><h3 id=\"doctor-object\"><code>doctor</code> Object</h3>\n<div class=\"click-to-expand-wrapper is-table-wrapper\"><table>\n<thead>\n<tr>\n<th>Field</th>\n<th>Type</th>\n<th>Required</th>\n<th>Description</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td><code>doctor_code</code></td>\n<td><code>string</code></td>\n<td>Yes</td>\n<td>Unique doctor identifier in the source system (e.g., <code>DOC001</code>)</td>\n</tr>\n<tr>\n<td><code>name</code></td>\n<td><code>string</code></td>\n<td>Yes</td>\n<td>Full name of the doctor</td>\n</tr>\n<tr>\n<td><code>email</code></td>\n<td><code>string</code></td>\n<td>No</td>\n<td>Doctor's email address</td>\n</tr>\n<tr>\n<td><code>phone</code></td>\n<td><code>string</code></td>\n<td>No</td>\n<td>Office/clinic phone number</td>\n</tr>\n<tr>\n<td><code>mobile</code></td>\n<td><code>string</code></td>\n<td>No</td>\n<td>Mobile phone number</td>\n</tr>\n<tr>\n<td><code>active</code></td>\n<td><code>boolean</code></td>\n<td>Yes</td>\n<td><code>true</code> if the doctor is active; <code>false</code> to deactivate</td>\n</tr>\n<tr>\n<td><code>doctor_type</code></td>\n<td><code>string</code></td>\n<td>Yes</td>\n<td>Type of doctor (e.g., <code>consultant</code>, <code>resident</code>)</td>\n</tr>\n<tr>\n<td><code>license_no</code></td>\n<td><code>string</code></td>\n<td>No</td>\n<td>Medical license number</td>\n</tr>\n<tr>\n<td><code>department_code</code></td>\n<td><code>string</code></td>\n<td>No</td>\n<td>Code of the department the doctor belongs to (e.g., <code>CARD</code>)</td>\n</tr>\n<tr>\n<td><code>specialization_code</code></td>\n<td><code>string</code></td>\n<td>No</td>\n<td>Specialization code (e.g., <code>CARDIO</code>)</td>\n</tr>\n</tbody>\n</table>\n</div><hr />\n<h2 id=\"example-request-body\">Example Request Body</h2>\n<pre class=\"click-to-expand-wrapper is-snippet-wrapper\"><code class=\"language-json\">{\n  \"meta\": {\n    \"event_id\": \"HIS-20260325-111222334\",\n    \"source_system\": \"HIS\",\n    \"event_type\": \"DoctorUpsert\"\n  },\n  \"doctor\": {\n    \"doctor_code\": \"DOC001\",\n    \"name\": \"Dr. John Mathew\",\n    \"email\": \"john.mathew@hospital.com\",\n    \"phone\": \"04842345678\",\n    \"mobile\": \"9876543210\",\n    \"active\": true,\n    \"doctor_type\": \"consultant\",\n    \"license_no\": \"LIC12345fffffffffff6\",\n    \"department_code\": \"CARD\",\n    \"specialization_code\": \"CARDIO\"\n  }\n}\n</code></pre>\n<hr />\n<h2 id=\"behavior\">Behavior</h2>\n<ul>\n<li>If a doctor with the given <code>doctor_code</code> <strong>already exists</strong>, the record will be <strong>updated</strong>.</li>\n<li>If no matching record is found, a <strong>new doctor</strong> will be <strong>created</strong>.</li>\n<li>The <code>active</code> flag can be used to <strong>deactivate</strong> a doctor without deleting the record.</li>\n</ul>\n","urlObject":{"path":["doctors"],"host":["{{Base_URL}}{{Base_PATH}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"b207ec34-7c55-4eac-bafa-121bcab8c223"},{"name":"Cancel Stock Consumption","id":"f9fcc291-580f-4b5b-96de-10944a56f69d","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[{"key":"x-api-key","value":"{{APIKey}}","type":"text"}],"body":{"mode":"raw","raw":"{\n    \"meta\": {\n        \"event_id\": \"HIS-20260325-000000003\",\n        \"source_system\": \"HIS\",\n        \"event_type\": \"StockDispenseCancel\"\n    },\n    \"payload\": {\n        \"dispense_no\": \"DSP-2026-136\"\n    }\n}"},"url":"{{Base_URL}}{{Base_PATH}}/StockDispense-Cancel","description":"<h2 id=\"cancel-stock-consumption\">Cancel Stock Consumption</h2>\n<p>Cancels a previously created stock dispense record in TMS/Odoo. Use this endpoint when a stock dispensing event initiated by HIS needs to be reversed or voided.</p>\n<hr />\n<h2 id=\"method--endpoint\">Method &amp; Endpoint</h2>\n<p><strong>POST</strong> <code>{{Base_URL}}{{Base_PATH}}/StockDispense-Cancel</code></p>\n<hr />\n<h2 id=\"authentication\">Authentication</h2>\n<p>This endpoint requires an API key passed as a request header:</p>\n<div class=\"click-to-expand-wrapper is-table-wrapper\"><table>\n<thead>\n<tr>\n<th>Header</th>\n<th>Value</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td><code>x-api-key</code></td>\n<td><code>{{APIKey}}</code></td>\n</tr>\n</tbody>\n</table>\n</div><hr />\n<h2 id=\"request-body\">Request Body</h2>\n<p>The request body must be a JSON object with two top-level fields: <code>meta</code> and <code>payload</code>.</p>\n<h3 id=\"meta-object\"><code>meta</code> Object</h3>\n<div class=\"click-to-expand-wrapper is-table-wrapper\"><table>\n<thead>\n<tr>\n<th>Field</th>\n<th>Type</th>\n<th>Required</th>\n<th>Description</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td><code>event_id</code></td>\n<td>string</td>\n<td>Yes</td>\n<td>Unique identifier for this event, generated by the source system (e.g., <code>HIS-20260325-000000002</code>).</td>\n</tr>\n<tr>\n<td><code>source_system</code></td>\n<td>string</td>\n<td>Yes</td>\n<td>The originating system sending the event (e.g., <code>HIS</code>).</td>\n</tr>\n<tr>\n<td><code>event_type</code></td>\n<td>string</td>\n<td>Yes</td>\n<td>The type of event. Must be <code>StockDispenseCancel</code> for this endpoint.</td>\n</tr>\n</tbody>\n</table>\n</div><h3 id=\"payload-object\"><code>payload</code> Object</h3>\n<div class=\"click-to-expand-wrapper is-table-wrapper\"><table>\n<thead>\n<tr>\n<th>Field</th>\n<th>Type</th>\n<th>Required</th>\n<th>Description</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td><code>dispense_no</code></td>\n<td>string</td>\n<td>Yes</td>\n<td>The dispense number of the stock dispensing record to be cancelled (e.g., <code>DSP-2026-133</code>).</td>\n</tr>\n</tbody>\n</table>\n</div><hr />\n<h2 id=\"example-request-body\">Example Request Body</h2>\n<pre class=\"click-to-expand-wrapper is-snippet-wrapper\"><code class=\"language-json\">{\n  \"meta\": {\n    \"event_id\": \"HIS-20260325-000000002\",\n    \"source_system\": \"HIS\",\n    \"event_type\": \"StockDispenseCancel\"\n  },\n  \"payload\": {\n    \"dispense_no\": \"DSP-2026-133\"\n  }\n}\n</code></pre>\n<hr />\n<h2 id=\"notes\">Notes</h2>\n<ul>\n<li>Ensure the <code>dispense_no</code> references an existing and active dispense record before calling this endpoint.</li>\n<li>The <code>event_id</code> should be unique per event to support idempotency and traceability.</li>\n<li>This endpoint is part of the <strong>IF009 Stock Dispense</strong> integration interface between HIS and TMS.</li>\n</ul>\n","urlObject":{"path":["StockDispense-Cancel"],"host":["{{Base_URL}}{{Base_PATH}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"f9fcc291-580f-4b5b-96de-10944a56f69d"},{"name":"Upsert Item Master","id":"03b2f838-7a99-4d79-82bb-d91818c85e10","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[{"key":"X-API-Key","value":"{{api_key}}","type":"text"}],"body":{"mode":"raw","raw":"{\n  \"meta\": {\n    \"event_id\": \"ERP-20260220-143521001\",\n    \"event_type\": \"ItemMasterUpsert\",\n    \"source_system\": \"ERP\",\n    \"correlation_id\": \"MED-001\"\n  },\n  \"payload\": {\n    \"item_code\": \"MED-001\",\n    \"name\": \"Paracetamol 500mg\",\n    \"description\": \"Analgesic tablet\",\n    \"item_type\": \"storable\",\n    \"standard_price\": 0.85,\n    \"sales_price\": 1.20,\n    \"active\": true,\n    \"category_code\": \"PHARMA\",\n    \"tracking\": \"lot\",\n    \"barcode\": \"1234567890123\"\n  }\n}","options":{"raw":{"language":"json"}}},"url":"/api/v1/odoo/items","urlObject":{"path":["api","v1","odoo","items"],"host":[""],"query":[],"variable":[]}},"response":[],"_postman_id":"03b2f838-7a99-4d79-82bb-d91818c85e10"},{"name":"Location Update","id":"69cd98cf-4f8e-4cc1-a915-e891fe7fb0fa","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[],"body":{"mode":"raw","raw":"{\n  \"meta\": {\n    \"event_id\": \"ERP-20260220-143526006\",\n    \"event_type\": \"LocationUpdate\",\n    \"source_system\": \"ERP\",\n    \"correlation_id\": \"WH-PHARM-01\"\n  },\n  \"payload\": {\n    \"location_code\": \"WH-PHARM-01\",\n    \"name\": \"Pharmacy Main Store\",\n    \"complete_name\": \"WH/Pharmacy/Main Store\",\n    \"location_type\": \"internal\",\n    \"active\": true,\n    \"parent_code\": \"WH-PHARM\",\n    \"scrap_location\": false,\n    \"return_location\": false,\n    \"x_his_code\": \"LOC-PHARM-001\"\n  }\n}","options":{"raw":{"language":"json"}}},"url":"/api/v1/odoo/locations","urlObject":{"path":["api","v1","odoo","locations"],"host":[""],"query":[],"variable":[]}},"response":[],"_postman_id":"69cd98cf-4f8e-4cc1-a915-e891fe7fb0fa"},{"name":"Cost Center Update","id":"d7235ca6-219d-447e-a667-8fc9be752a8a","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[],"body":{"mode":"raw","raw":"{\n  \"meta\": {\n    \"event_id\": \"ERP-20260220-143531011\",\n    \"event_type\": \"CostCenterUpdate\",\n    \"source_system\": \"ERP\",\n    \"correlation_id\": \"CC-OPD-001\"\n  },\n  \"payload\": {\n    \"cost_center_code\": \"CC-OPD-001\",\n    \"name\": \"OPD Department\",\n    \"active\": true,\n    \"parent_code\": \"CC-OPD\",\n    \"plan\": \"Departments\",\n    \"company_code\": \"VG Hospital\",\n    \"x_his_code\": \"HIS-CC-OPD-001\"\n  }\n}","options":{"raw":{"language":"json"}}},"url":"/api/v1/odoo/cost-centers","urlObject":{"path":["api","v1","odoo","cost-centers"],"host":[""],"query":[],"variable":[]}},"response":[],"_postman_id":"d7235ca6-219d-447e-a667-8fc9be752a8a"}],"id":"6cf44c05-037d-413b-ad89-72b410962813","_postman_id":"6cf44c05-037d-413b-ad89-72b410962813","description":""},{"name":"IF009 Stock Dispense Create","item":[{"name":"IF009 Dispense API","id":"18e60d93-fd41-47d5-a584-31edab5f1649","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"auth":{"type":"noauth","isInherited":false},"method":"POST","header":[{"key":"x-api-key","value":"{{APIKey}}","type":"text"}],"body":{"mode":"raw","raw":"{\n    \"meta\": {\n        \"event_id\": \"HIS-20260129-144000235\",\n        \"correlation_id\": \"RX-998877\",\n        \"event_type\": \"StockDispenseCreate\",\n        \"source_system\": \"HIS\"\n    },\n    \"payload\": {\n        \"dispense_no\": \"DSP-2026-136\",\n        \"encounter_id\": \"AMB2600001016\",\n        \"dispense_date\": \"2026-02-20T14:30:00\",\n        \"doctor_code\": \"D0055\",\n        \"items\": [\n            \n            {\n                \"line_id\": \"1\",\n                \"item_code\": \"E-COM06\",\n                \"quantity\": 10.0,\n                \"uom_code\": \"UNIT\",\n                \"lot_serial_no\": \"LOT-FPMSYR05-20\",\n                \"location_code\": \"WHSTOCK\",\n                \"cost_center_code\": \"CC002\"\n            }\n        ]\n    }\n}","options":{"raw":{"language":"json"}}},"url":"{{Base_URL}}{{Base_PATH}}/StockDispense-Create","description":"<h2 id=\"stock-dispense-create\">Stock Dispense Create</h2>\n<p>Creates a <strong>stock dispense transaction</strong> in TMS from an upstream system (e.g., HIS). Use this endpoint to submit a dispense header plus one or more dispensed item lines.</p>\n<hr />\n<h2 id=\"endpoint\">Endpoint</h2>\n<p><code>POST {{Base_URL}}{{Base_PATH}}/StockDispense-Create</code></p>\n<hr />\n<h2 id=\"required-headers\">Required headers</h2>\n<div class=\"click-to-expand-wrapper is-table-wrapper\"><table>\n<thead>\n<tr>\n<th>Header</th>\n<th>Required</th>\n<th>Description</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td><code>x-api-key: {{APIKey}}</code></td>\n<td>Yes</td>\n<td>API key used to authorize the request.</td>\n</tr>\n<tr>\n<td><code>Content-Type: application/json</code></td>\n<td>Yes</td>\n<td>When sending a JSON body (raw).</td>\n</tr>\n</tbody>\n</table>\n</div><blockquote>\n<p>Note: <code>Content-Type</code> is typically set automatically by Postman when using a raw JSON body.</p>\n</blockquote>\n<hr />\n<h2 id=\"variables-used\">Variables used</h2>\n<div class=\"click-to-expand-wrapper is-table-wrapper\"><table>\n<thead>\n<tr>\n<th>Variable</th>\n<th>Where</th>\n<th>Meaning</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td><code>{{Base_URL}}</code></td>\n<td>Environment (<code>TMS-DEV</code>)</td>\n<td>Base host (scheme + domain + optional port).</td>\n</tr>\n<tr>\n<td><code>{{Base_PATH}}</code></td>\n<td>Environment (<code>TMS-DEV</code>)</td>\n<td>Base API path/prefix for TMS services.</td>\n</tr>\n<tr>\n<td><code>{{APIKey}}</code></td>\n<td>Environment (<code>TMS-DEV</code>)</td>\n<td>API key value injected into the <code>x-api-key</code> header.</td>\n</tr>\n</tbody>\n</table>\n</div><hr />\n<h2 id=\"request-body-json\">Request body (JSON)</h2>\n<p>Top-level structure:</p>\n<ul>\n<li><code>meta</code> <em>(object, required)</em>: Event and tracking information.</li>\n<li><code>payload</code> <em>(object, required)</em>: Dispense data (header + line items).</li>\n</ul>\n<h3 id=\"meta-fields\"><code>meta</code> fields</h3>\n<div class=\"click-to-expand-wrapper is-table-wrapper\"><table>\n<thead>\n<tr>\n<th>Field</th>\n<th>Type</th>\n<th>Required</th>\n<th>Description</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td><code>meta.event_id</code></td>\n<td>string</td>\n<td>Yes</td>\n<td>Unique event identifier from the source system.</td>\n</tr>\n<tr>\n<td><code>meta.correlation_id</code></td>\n<td>string</td>\n<td>Yes</td>\n<td>Correlates this request to a business process/workflow (e.g., Rx number).</td>\n</tr>\n<tr>\n<td><code>meta.event_type</code></td>\n<td>string</td>\n<td>Yes</td>\n<td>Event type name. Expected: <code>StockDispenseCreate</code>.</td>\n</tr>\n<tr>\n<td><code>meta.source_system</code></td>\n<td>string</td>\n<td>Yes</td>\n<td>Source system name/code (e.g., <code>HIS</code>).</td>\n</tr>\n</tbody>\n</table>\n</div><h3 id=\"payload-fields-header\"><code>payload</code> fields (header)</h3>\n<div class=\"click-to-expand-wrapper is-table-wrapper\"><table>\n<thead>\n<tr>\n<th>Field</th>\n<th>Type</th>\n<th>Required</th>\n<th>Description</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td><code>payload.dispense_no</code></td>\n<td>string</td>\n<td>Yes</td>\n<td>Dispense document/transaction number.</td>\n</tr>\n<tr>\n<td><code>payload.encounter_id</code></td>\n<td>string</td>\n<td>Yes</td>\n<td>Encounter/visit identifier.</td>\n</tr>\n<tr>\n<td><code>payload.dispense_date</code></td>\n<td>string (date-time)</td>\n<td>Yes</td>\n<td>Dispense date/time in ISO-8601 format (e.g., <code>YYYY-MM-DDTHH:mm:ss</code>).</td>\n</tr>\n<tr>\n<td><code>payload.doctor_code</code></td>\n<td>string</td>\n<td>Yes</td>\n<td>Prescriber/doctor code associated with the dispense.</td>\n</tr>\n<tr>\n<td><code>payload.items</code></td>\n<td>array</td>\n<td>Yes</td>\n<td>List of dispensed item lines (must contain at least 1 item).</td>\n</tr>\n</tbody>\n</table>\n</div><h3 id=\"payloaditems-fields-lines\"><code>payload.items[]</code> fields (lines)</h3>\n<div class=\"click-to-expand-wrapper is-table-wrapper\"><table>\n<thead>\n<tr>\n<th>Field</th>\n<th>Type</th>\n<th>Required</th>\n<th>Description</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td><code>line_id</code></td>\n<td>string</td>\n<td>Yes</td>\n<td>Line sequence/identifier within the dispense document.</td>\n</tr>\n<tr>\n<td><code>item_code</code></td>\n<td>string</td>\n<td>Yes</td>\n<td>Item/Drug code.</td>\n</tr>\n<tr>\n<td><code>quantity</code></td>\n<td>number</td>\n<td>Yes</td>\n<td>Quantity dispensed.</td>\n</tr>\n<tr>\n<td><code>uom_code</code></td>\n<td>string</td>\n<td>Yes</td>\n<td>Unit of measure code/name.</td>\n</tr>\n<tr>\n<td><code>lot_serial_no</code></td>\n<td>string</td>\n<td>Yes</td>\n<td>Lot or serial number used for traceability.</td>\n</tr>\n<tr>\n<td><code>location_code</code></td>\n<td>string</td>\n<td>Yes</td>\n<td>Stock location/warehouse code where the item is issued from.</td>\n</tr>\n<tr>\n<td><code>cost_center_code</code></td>\n<td>string</td>\n<td>Yes</td>\n<td>Cost center code to book the dispense/issue.</td>\n</tr>\n</tbody>\n</table>\n</div><hr />\n<h2 id=\"example-payload\">Example payload</h2>\n<pre class=\"click-to-expand-wrapper is-snippet-wrapper\"><code class=\"language-json\">{\n  \"meta\": {\n    \"event_id\": \"HIS-20260129-144000231\",\n    \"correlation_id\": \"RX-998877\",\n    \"event_type\": \"StockDispenseCreate\",\n    \"source_system\": \"HIS\"\n  },\n  \"payload\": {\n    \"dispense_no\": \"DSP-2026-133\",\n    \"encounter_id\": \"967568568\",\n    \"dispense_date\": \"2026-01-29T14:30:00\",\n    \"doctor_code\": \"D0055\",\n    \"items\": [\n      {\n        \"line_id\": \"1\",\n        \"item_code\": \"FPMSYR05\",\n        \"quantity\": 10,\n        \"uom_code\": \"ชุด\",\n        \"lot_serial_no\": \"LOT-FPMSYR05-100\",\n        \"location_code\": \"PHSTOCK\",\n        \"cost_center_code\": \"CC002\"\n      }\n    ]\n  }\n}\n</code></pre>\n","urlObject":{"path":["StockDispense-Create"],"host":["{{Base_URL}}{{Base_PATH}}"],"query":[],"variable":[]}},"response":[{"id":"158276d8-23af-4a92-a1a7-749c8b96fe4e","name":"200 OK","originalRequest":{"method":"POST","header":[{"key":"x-api-key","value":"{{APIKey}}","type":"text"}],"body":{"mode":"raw","raw":"{\n    \"meta\": {\n        \"event_id\": \"HIS-20260129-144000231\",\n        \"correlation_id\": \"RX-998877\",\n        \"event_type\": \"StockDispenseCreate\",\n        \"source_system\": \"HIS\"\n    },\n    \"payload\": {\n        \"dispense_no\": \"DSP-2026-133\",\n        \"encounter_id\": \"967568568\",\n        \"dispense_date\": \"2026-01-29T14:30:00\",\n        \"doctor_code\": \"D0055\",\n        \"items\": [\n            \n            {\n                \"line_id\": \"1\",\n                \"item_code\": \"FPMSYR05\",\n                \"quantity\": 10.0,\n                \"uom_code\": \"ชุด\",\n                \"lot_serial_no\": \"LOT-FPMSYR05-100\",\n                \"location_code\": \"PHSTOCK\",\n                \"cost_center_code\": \"CC002\"\n            }\n        ]\n    }\n}","options":{"raw":{"language":"json"}}},"url":"{{Base_URL}}{{Base_PATH}}/StockDispense-Create"},"status":"OK","code":200,"_postman_previewlanguage":"json","header":[{"key":"Server","value":"nginx"},{"key":"Date","value":"Fri, 20 Feb 2026 05:02:03 GMT"},{"key":"Content-Type","value":"application/json","description":"","type":"text"},{"key":"Content-Length","value":"251"},{"key":"Connection","value":"keep-alive"},{"key":"Access-Control-Allow-Origin","value":"*"},{"key":"Access-Control-Allow-Origin","value":"*"},{"key":"Access-Control-Allow-Methods","value":"POST, OPTIONS"},{"key":"X-Content-Type-Options","value":"nosniff"},{"key":"Strict-Transport-Security","value":"max-age=31536000"}],"cookie":[],"responseTime":null,"body":"{\n    \"result\": \"DUPLICATE_IGNORED\",\n    \"meta\": {\n        \"event_id\": \"HIS-20260129-144000231\",\n        \"original_processed_at\": \"2026-02-20T04:52:39\",\n        \"processed_at\": \"2026-02-20T05:02:03\"\n    },\n    \"resource\": {},\n    \"message\": \"Request with this event_id has already been processed.\"\n}"},{"id":"35dc02ae-7d5b-4e86-95ed-13c5caa51214","name":"401 UNAUTHORIZED","originalRequest":{"method":"POST","header":[{"key":"x-api-key","value":"{{APIKey}}","type":"text"}],"body":{"mode":"raw","raw":"{\n    \"meta\": {\n        \"event_id\": \"HIS-20260129-144000231\",\n        \"correlation_id\": \"RX-998877\",\n        \"event_type\": \"StockDispenseCreate\",\n        \"source_system\": \"HIS\"\n    },\n    \"payload\": {\n        \"dispense_no\": \"DSP-2026-133\",\n        \"encounter_id\": \"967568568\",\n        \"dispense_date\": \"2026-01-29T14:30:00\",\n        \"doctor_code\": \"D0055\",\n        \"items\": [\n            \n            {\n                \"line_id\": \"1\",\n                \"item_code\": \"FPMSYR05\",\n                \"quantity\": 10.0,\n                \"uom_code\": \"ชุด\",\n                \"lot_serial_no\": \"LOT-FPMSYR05-100\",\n                \"location_code\": \"PHSTOCK\",\n                \"cost_center_code\": \"CC002\"\n            }\n        ]\n    }\n}","options":{"raw":{"language":"json"}}},"url":"{{Base_URL}}{{Base_PATH}}/StockDispense-Create"},"status":"UNAUTHORIZED","code":401,"_postman_previewlanguage":"json","header":[{"key":"Server","value":"nginx"},{"key":"Date","value":"Fri, 20 Feb 2026 05:01:08 GMT"},{"key":"Content-Type","value":"application/json","description":"","type":"text"},{"key":"Content-Length","value":"90"},{"key":"Connection","value":"keep-alive"},{"key":"Access-Control-Allow-Origin","value":"*"},{"key":"Access-Control-Allow-Origin","value":"*"},{"key":"Access-Control-Allow-Methods","value":"POST, OPTIONS"},{"key":"Set-Cookie","value":"session_id=O2IhaEjDQ57bM1wjllBhCHmeL6KMocT4H1zgMlCsOPkiqSfVZpX_mYi6XmIcMyU8juO39p6sQOMhsHhrPIqB; Expires=Sat, 20 Feb 2027 05:01:08 GMT; Max-Age=604800; HttpOnly; Path=/"},{"key":"X-Content-Type-Options","value":"nosniff"},{"key":"Strict-Transport-Security","value":"max-age=31536000"}],"cookie":[],"responseTime":null,"body":"{\n    \"result\": \"AUTH_ERROR\",\n    \"errors\": [\n        {\n            \"code\": \"AUTH_ERROR\",\n            \"message\": \"Invalid API key\"\n        }\n    ]\n}"}],"_postman_id":"18e60d93-fd41-47d5-a584-31edab5f1649"},{"name":"IF009 Dispense API test","id":"508f1006-8423-4dea-9de0-803e0137c6de","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"auth":{"type":"noauth","isInherited":false},"method":"POST","header":[{"key":"x-api-key","value":"{{APIKey}}","type":"text"}],"body":{"mode":"raw","raw":"{\n    \"meta\": {\n        \"event_id\": \"HIS-20260129-144000235\",\n        \"correlation_id\": \"RX-998877\",\n        \"event_type\": \"StockDispenseCreate\",\n        \"source_system\": \"HIS\"\n    },\n    \"payload\": {\n        \"dispense_no\": \"DSP-2026-136\",\n        \"encounter_id\": \"AMB2600001016\",\n        \"dispense_date\": \"2026-02-20T14:30:00\",\n        \"doctor_code\": \"D0055\",\n        \"items\": [\n            \n            {\n                \"line_id\": \"1\",\n                \"item_code\": \"E-COM06\",\n                \"quantity\": 10.0,\n                \"uom_code\": \"UNIT\",\n                \"lot_serial_no\": \"LOT-FPMSYR05-20\",\n                \"location_code\": \"WHSTOCK\",\n                \"cost_center_code\": \"CC002\"\n            }\n        ]\n    }\n}","options":{"raw":{"language":"json"}}},"url":"{{Base_URL}}{{Base_PATH}}/StockDispense-Create","urlObject":{"path":["StockDispense-Create"],"host":["{{Base_URL}}{{Base_PATH}}"],"query":[],"variable":[]}},"response":[{"id":"e4a65774-4227-4bcd-b489-c4756c4a9d2e","name":"200 OK","originalRequest":{"method":"POST","header":[{"key":"x-api-key","value":"{{APIKey}}","type":"text"}],"body":{"mode":"raw","raw":"{\n    \"meta\": {\n        \"event_id\": \"HIS-20260129-144000231\",\n        \"correlation_id\": \"RX-998877\",\n        \"event_type\": \"StockDispenseCreate\",\n        \"source_system\": \"HIS\"\n    },\n    \"payload\": {\n        \"dispense_no\": \"DSP-2026-133\",\n        \"encounter_id\": \"967568568\",\n        \"dispense_date\": \"2026-01-29T14:30:00\",\n        \"doctor_code\": \"D0055\",\n        \"items\": [\n            \n            {\n                \"line_id\": \"1\",\n                \"item_code\": \"FPMSYR05\",\n                \"quantity\": 10.0,\n                \"uom_code\": \"ชุด\",\n                \"lot_serial_no\": \"LOT-FPMSYR05-100\",\n                \"location_code\": \"PHSTOCK\",\n                \"cost_center_code\": \"CC002\"\n            }\n        ]\n    }\n}","options":{"raw":{"language":"json"}}},"url":"{{Base_URL}}{{Base_PATH}}/StockDispense-Create"},"status":"OK","code":200,"_postman_previewlanguage":"json","header":[{"key":"Server","value":"nginx","uuid":"811b4cd7-2495-4a65-971e-b586cf610a23"},{"key":"Date","value":"Fri, 20 Feb 2026 05:02:03 GMT","uuid":"61c5c1cc-41e4-4a01-a336-4d6c10ec3299"},{"key":"Content-Type","value":"application/json","description":"","type":"text","uuid":"e1314632-c50b-4cd2-863a-92e1f4e740c4"},{"key":"Content-Length","value":"251","uuid":"57c7f4ad-32bf-4d6d-b8c9-63925df00ab5"},{"key":"Connection","value":"keep-alive","uuid":"880dccd2-1f8a-42f9-9de1-bb0a915b526e"},{"key":"Access-Control-Allow-Origin","value":"*","uuid":"4a440534-f065-45e5-8f8a-7c0c8a51dc3b"},{"key":"Access-Control-Allow-Origin","value":"*","uuid":"4a440534-f065-45e5-8f8a-7c0c8a51dc3b"},{"key":"Access-Control-Allow-Methods","value":"POST, OPTIONS","uuid":"b0cbaf5f-3ccb-4eb1-b07e-903364045a22"},{"key":"X-Content-Type-Options","value":"nosniff","uuid":"fdba565d-7418-4fae-883b-c71abb397a45"},{"key":"Strict-Transport-Security","value":"max-age=31536000","uuid":"59e3c61c-ddb1-4a6b-9fc0-82dd18c45d84"}],"cookie":[],"responseTime":null,"body":"{\n    \"result\": \"DUPLICATE_IGNORED\",\n    \"meta\": {\n        \"event_id\": \"HIS-20260129-144000231\",\n        \"original_processed_at\": \"2026-02-20T04:52:39\",\n        \"processed_at\": \"2026-02-20T05:02:03\"\n    },\n    \"resource\": {},\n    \"message\": \"Request with this event_id has already been processed.\"\n}"},{"id":"71ea21e4-9fd0-49f4-9612-5efc02aa7312","name":"401 UNAUTHORIZED","originalRequest":{"method":"POST","header":[{"key":"x-api-key","value":"{{APIKey}}","type":"text"}],"body":{"mode":"raw","raw":"{\n    \"meta\": {\n        \"event_id\": \"HIS-20260129-144000231\",\n        \"correlation_id\": \"RX-998877\",\n        \"event_type\": \"StockDispenseCreate\",\n        \"source_system\": \"HIS\"\n    },\n    \"payload\": {\n        \"dispense_no\": \"DSP-2026-133\",\n        \"encounter_id\": \"967568568\",\n        \"dispense_date\": \"2026-01-29T14:30:00\",\n        \"doctor_code\": \"D0055\",\n        \"items\": [\n            \n            {\n                \"line_id\": \"1\",\n                \"item_code\": \"FPMSYR05\",\n                \"quantity\": 10.0,\n                \"uom_code\": \"ชุด\",\n                \"lot_serial_no\": \"LOT-FPMSYR05-100\",\n                \"location_code\": \"PHSTOCK\",\n                \"cost_center_code\": \"CC002\"\n            }\n        ]\n    }\n}","options":{"raw":{"language":"json"}}},"url":"{{Base_URL}}{{Base_PATH}}/StockDispense-Create"},"status":"UNAUTHORIZED","code":401,"_postman_previewlanguage":"json","header":[{"key":"Server","value":"nginx","uuid":"3268e6c7-70be-4625-ac42-912cb818e6d9"},{"key":"Date","value":"Fri, 20 Feb 2026 05:01:08 GMT","uuid":"30c361e5-c33b-4875-a68d-bd1787d14033"},{"key":"Content-Type","value":"application/json","description":"","type":"text","uuid":"3bcd29c7-6c89-40ef-a60b-d59153c21762"},{"key":"Content-Length","value":"90","uuid":"9614314a-dcef-4511-9b70-c6bb5b809771"},{"key":"Connection","value":"keep-alive","uuid":"b6f0dfe7-0854-4f65-8e48-c1c4283e2110"},{"key":"Access-Control-Allow-Origin","value":"*","uuid":"c2e17bca-70ba-4e21-96d5-d9421a3395d2"},{"key":"Access-Control-Allow-Origin","value":"*","uuid":"c2e17bca-70ba-4e21-96d5-d9421a3395d2"},{"key":"Access-Control-Allow-Methods","value":"POST, OPTIONS","uuid":"2b2e9bf2-9730-43d5-a36d-9768035cc65c"},{"key":"Set-Cookie","value":"session_id=O2IhaEjDQ57bM1wjllBhCHmeL6KMocT4H1zgMlCsOPkiqSfVZpX_mYi6XmIcMyU8juO39p6sQOMhsHhrPIqB; Expires=Sat, 20 Feb 2027 05:01:08 GMT; Max-Age=604800; HttpOnly; Path=/","uuid":"26a2712d-4153-4d5b-bafc-44c2dd1aa6ac"},{"key":"X-Content-Type-Options","value":"nosniff","uuid":"b18cf83c-19c8-4450-bfb0-4b6a4add46e7"},{"key":"Strict-Transport-Security","value":"max-age=31536000","uuid":"ca380bdf-6d3e-4073-9f53-95150d32750e"}],"cookie":[],"responseTime":null,"body":"{\n    \"result\": \"AUTH_ERROR\",\n    \"errors\": [\n        {\n            \"code\": \"AUTH_ERROR\",\n            \"message\": \"Invalid API key\"\n        }\n    ]\n}"}],"_postman_id":"508f1006-8423-4dea-9de0-803e0137c6de"},{"name":"IF009 Dispense API","id":"995a26d7-f412-442d-9d19-54679e770e23","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"auth":{"type":"noauth","isInherited":false},"method":"POST","header":[{"key":"x-api-key","value":"{{APIKey}}","type":"text"}],"body":{"mode":"raw","raw":"{\n    \"meta\": {\n        \"event_id\": \"HIS-20260129-144000231\",\n        \"correlation_id\": \"RX-998877\",\n        \"event_type\": \"StockDispenseCreate\",\n        \"source_system\": \"HIS\"\n    },\n    \"payload\": {\n        \"dispense_no\": \"DSP-2026-133\",\n        \"encounter_id\": \"AMB2600001271\",\n        \"dispense_date\": \"2026-01-29T14:30:00\",\n        \"doctor_code\": \"D0055\",\n        \"items\": [\n            \n            {\n                \"line_id\": \"1\",\n                \"item_code\": \"FPMSYR05\",\n                \"quantity\": 1.0,AMB2600001271\n                \"uom_code\": \"ชุด\",\n                \"lot_serial_no\": \"LOT-001\",\n                \"location_code\": \"BHTGS\",\n                \"cost_center_code\": \"CC002\"\n            }\n        ]\n    }\n}","options":{"raw":{"language":"json"}}},"url":"{{Base_URL}}{{Base_PATH}}/StockDispense-Create","urlObject":{"path":["StockDispense-Create"],"host":["{{Base_URL}}{{Base_PATH}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"995a26d7-f412-442d-9d19-54679e770e23"}],"id":"eefa0c44-08cb-4ea7-8fcf-45152ddb55b5","_postman_id":"eefa0c44-08cb-4ea7-8fcf-45152ddb55b5","description":""}],"variable":[{"key":"url","value":"","type":"default"}]}