{"info":{"_postman_id":"2de804e6-d70c-4e4f-9d9b-0e9a67b10cc1","name":"BSure API Documentation","description":"<html><head></head><body><p><strong>Integration guide for BSure API v2</strong> — Use this to connect your <strong>CRM</strong>, <strong>Power BI</strong>, or other systems to BSure survey data. You can call the API from any HTTP client; this collection is provided so you can test endpoints in Postman and use the request/response docs as a reference for your integration.</p>\n<h2 id=\"who-is-this-for\">Who is this for?</h2>\n<ul>\n<li><p><strong>Clients integrating BSure with their CRM</strong> (Salesforce, HubSpot, Zoho, etc.)</p>\n</li>\n<li><p><strong>Clients building reports in Power BI</strong> (or similar) from BSure responses</p>\n</li>\n<li><p><strong>Developers</strong> who need to pull surveys, responses, or exports into their own apps</p>\n</li>\n</ul>\n<h2 id=\"how-to-use-this-collection\">How to use this collection</h2>\n<ul>\n<li><p><strong>As integration reference:</strong> Use the endpoint URLs, query parameters, and response examples to build your CRM connector, Power BI data source, or custom integration. All authenticated requests use <strong>Bearer token</strong> (<code>Authorization: Bearer</code> ).</p>\n</li>\n<li><p><strong>In Postman:</strong> Import the collection, set <code>baseUrl</code> (<a href=\"https://api.bsure.sa\">https://api.bsure.sa</a>) and <code>apiKey</code>, then run <strong>Health Check</strong> and <strong>Get All Surveys</strong> to verify. Use the requests to explore responses and copy the same URLs/headers into your CRM or Power BI.</p>\n</li>\n</ul>\n<h2 id=\"features\">Features</h2>\n<ul>\n<li><p>✅ Read-only GET endpoints: Surveys, Responses, Export (CSV, Excel, JSON, SPSS, Power BI)</p>\n</li>\n<li><p>✅ Token setup and authentication guide</p>\n</li>\n<li><p>✅ Power BI integration instructions (step-by-step)</p>\n</li>\n<li><p>✅ Request/response examples and field descriptions for each endpoint</p>\n</li>\n<li><p>✅ Collection-level Bearer auth; Health Check and doc-only items use no auth</p>\n</li>\n</ul>\n<h2 id=\"quick-setup-for-any-integration\">Quick setup (for any integration)</h2>\n<ol>\n<li><p><strong>Get your API key:</strong> BSure → Profile → Settings → <strong>Developer</strong> tab → Create Token. Format: <code>sp_xxxxxxxxxxxxx</code> (32 chars).</p>\n</li>\n<li><p><strong>Base URL:</strong> <code>https://api.bsure.sa</code></p>\n</li>\n<li><p><strong>Auth:</strong> Send header <code>Authorization: Bearer</code> on every request except Health Check.</p>\n</li>\n<li><p><strong>Survey ID:</strong> Use <strong>GET /v2/surveys</strong> to list surveys; use <strong>GET /v2/responses?surveyId=...</strong> or <strong>GET /v2/responses/export?surveyId=...&amp;format=...</strong> for data.</p>\n</li>\n</ol>\n<h2 id=\"structure\">Structure</h2>\n<div class=\"click-to-expand-wrapper is-table-wrapper\"><table>\n<thead>\n<tr>\n<th>Folder</th>\n<th>Purpose</th>\n<th>Auth</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>Token Setup</td>\n<td>How to get API token; Postman setup (optional)</td>\n<td>None (docs only)</td>\n</tr>\n<tr>\n<td>Health Check</td>\n<td>Public health check — no auth</td>\n<td>None</td>\n</tr>\n<tr>\n<td>Surveys</td>\n<td>List surveys</td>\n<td>Bearer</td>\n</tr>\n<tr>\n<td>Responses</td>\n<td>List/get responses</td>\n<td>Bearer</td>\n</tr>\n<tr>\n<td>Export Responses</td>\n<td>Export CSV, Excel, JSON, SPSS, Power BI</td>\n<td>Bearer</td>\n</tr>\n<tr>\n<td>Power BI Integration</td>\n<td>Power BI connection guide</td>\n<td>None (docs only)</td>\n</tr>\n</tbody>\n</table>\n</div></body></html>","schema":"https://schema.getpostman.com/json/collection/v2.0.0/collection.json","toc":[],"owner":"51658604","collectionId":"2de804e6-d70c-4e4f-9d9b-0e9a67b10cc1","publishedId":"2sBXVmgoyq","public":true,"customColor":{"top-bar":"FFFFFF","right-sidebar":"303030","highlight":"FF6C37"},"publishDate":"2026-01-28T14:28:15.000Z"},"item":[{"name":"Token Setup","item":[{"name":"How to Get Your API Token","id":"70c27b29-999c-4335-9295-a5c85468841a","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"auth":{"type":"noauth","isInherited":false},"method":"GET","header":[],"url":"https://api.bsure.sa/v2/health","description":"<h1 id=\"how-to-get-your-api-token\">How to Get Your API Token</h1>\n<h2 id=\"step-by-step-guide\">Step-by-Step Guide</h2>\n<h3 id=\"step-1-log-in-to-bsure-platform\">Step 1: Log in to BSure Platform</h3>\n<ol>\n<li><p>Go to <a href=\"https://forms.bsure.sa\">forms.bsure.sa</a></p>\n</li>\n<li><p>Log in with your account credentials</p>\n</li>\n</ol>\n<h3 id=\"step-2-navigate-to-developer-settings\">Step 2: Navigate to Developer Settings</h3>\n<ol>\n<li><p>Click on your <strong>Profile</strong> (usually in the top right corner)</p>\n</li>\n<li><p>Select <strong>Settings</strong> from the dropdown menu</p>\n</li>\n<li><p>Click on the <strong>Developer</strong> tab</p>\n</li>\n</ol>\n<h3 id=\"step-3-create-your-api-token\">Step 3: Create Your API Token</h3>\n<ol>\n<li><p>In the Developer tab, you'll see the <strong>API Keys</strong> section</p>\n</li>\n<li><p>Click the <strong>Create Token</strong> button</p>\n</li>\n<li><p>Enter a name for your token (e.g., \"My API Key\", \"Power BI Integration\")</p>\n</li>\n<li><p>Click <strong>Create</strong> or <strong>Generate</strong></p>\n</li>\n<li><p><strong>Copy the API key</strong></p>\n</li>\n</ol>\n<h3 id=\"step-4-save-your-token-securely\">Step 4: Save Your Token Securely</h3>\n<ul>\n<li><p>The API key format is: <code>sp_xxxxxxxxxxxxx</code> (32 characters total)</p>\n</li>\n<li><p><strong>Example:</strong> <code>sp_a1b2c3d4e5f6g7h8i9j0k1l2m3</code></p>\n</li>\n<li><p>Store it in a secure location (password manager, secure notes, etc.)</p>\n</li>\n</ul>\n<hr />\n<h2 id=\"📝-important-notes\">📝 Important Notes</h2>\n<h3 id=\"token-format\">Token Format</h3>\n<ul>\n<li><p><strong>Prefix:</strong> <code>sp_</code></p>\n</li>\n<li><p><strong>Total Length:</strong> 32 characters</p>\n</li>\n<li><p><strong>Example:</strong> <code>sp_a1b2c3d4e5f6g7h8i9j0k1l2m3</code></p>\n</li>\n</ul>\n<h3 id=\"security-best-practices\">Security Best Practices</h3>\n<ol>\n<li><p><strong>Never share your API key</strong> with anyone</p>\n</li>\n<li><p><strong>Never commit API keys to version control</strong> (Git, etc.)</p>\n</li>\n<li><p><strong>Store keys securely</strong> (password managers, environment variables)</p>\n</li>\n<li><p><strong>Rotate keys regularly</strong> (revoke old ones, create new ones)</p>\n</li>\n<li><p><strong>Use different keys for different purposes</strong> (e.g., one for Power BI, one for testing)</p>\n</li>\n<li><p><strong>Monitor key usage</strong> - check when your key was last used</p>\n</li>\n</ol>\n<h3 id=\"managing-your-keys\">Managing Your Keys</h3>\n<p>In the Developer tab, you can:</p>\n<ul>\n<li><p><strong>View all your API keys</strong> (with last 4 characters visible)</p>\n</li>\n<li><p><strong>See when each key was created</strong></p>\n</li>\n<li><p><strong>See when each key was last used</strong></p>\n</li>\n<li><p><strong>Revoke/Delete keys</strong> that are no longer needed</p>\n</li>\n<li><p><strong>Create new keys</strong> (maximum of 2 active keys per user)</p>\n</li>\n</ul>\n<hr />\n<h2 id=\"✅-next-steps\">✅ Next Steps</h2>\n<ol>\n<li><p><strong>Copy your API key</strong> from the Developer tab and store it securely.</p>\n</li>\n<li><p><strong>Use it in your integration:</strong></p>\n<ul>\n<li><p><strong>CRM (Salesforce, HubSpot, Zoho, etc.):</strong> Configure your connector to call <code>https://api.bsure.sa</code> with header <code>Authorization: Bearer</code> .</p>\n</li>\n<li><p><strong>Power BI:</strong> See the <strong>📊 Power BI Integration</strong> folder in this collection for step-by-step setup (Web source + Authorization header).</p>\n</li>\n<li><p><strong>Postman (optional):</strong> Set the <code>apiKey</code> variable in your environment and run <strong>Health Check</strong> then <strong>Get All Surveys</strong> to verify.</p>\n</li>\n</ul>\n</li>\n<li><p><strong>Endpoints:</strong> Use <strong>GET /v2/surveys</strong> to list surveys; <strong>GET /v2/responses?surveyId=...</strong> for responses; <strong>GET /v2/responses/export?surveyId=...&amp;format=csv|excel|json|spss|powerbi</strong> for exports.</p>\n</li>\n</ol>\n<hr />\n<h2 id=\"🆘-troubleshooting\">🆘 Troubleshooting</h2>\n<h3 id=\"i-cant-find-the-developer-tab\">\"I can't find the Developer tab\"</h3>\n<ul>\n<li><p>Make sure you're logged in to forms.bsure.sa</p>\n</li>\n<li><p>Check that you have the necessary permissions</p>\n</li>\n<li><p>Contact support if you don't see the Developer tab</p>\n</li>\n</ul>\n<h3 id=\"i-lost-my-api-key\">\"I lost my API key\"</h3>\n<ul>\n<li><p>You cannot retrieve a lost API key</p>\n</li>\n<li><p>Create a new one in the Developer tab</p>\n</li>\n<li><p>Revoke the old key if you suspect it was compromised</p>\n</li>\n</ul>\n<h3 id=\"i-cant-create-a-new-key\">\"I can't create a new key\"</h3>\n<ul>\n<li><p>Check if you've reached the limit (2 active keys per user)</p>\n</li>\n<li><p>Revoke an existing key first, then create a new one</p>\n</li>\n</ul>\n<h3 id=\"my-api-key-doesnt-work\">\"My API key doesn't work\"</h3>\n<ul>\n<li><p>Verify the key is copied correctly (no extra spaces)</p>\n</li>\n<li><p>Check if the key is still active (not revoked)</p>\n</li>\n<li><p>Make sure you're using the correct format: <code>Bearer sp_xxxxxxxxxxxxx</code></p>\n</li>\n</ul>\n","urlObject":{"path":["v2","health"],"host":["https://api.bsure.sa"],"query":[],"variable":[]}},"response":[],"_postman_id":"70c27b29-999c-4335-9295-a5c85468841a"},{"name":"Setup Instructions","id":"17021d34-a5a0-42c3-a5be-2c31e4a85306","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"auth":{"type":"noauth","isInherited":false},"method":"GET","header":[],"url":"https://api.bsure.sa/v2/health","description":"<h1 id=\"🔧-using-this-collection\">🔧 Using This Collection</h1>\n<p>This collection is an <strong>integration guide</strong> for connecting BSure to your <strong>CRM</strong> (Salesforce, HubSpot, Zoho, etc.), <strong>Power BI</strong>, or any other system. You can use it in Postman to test the API, or use the request/response docs as reference when building your integration.</p>\n<hr />\n<h2 id=\"option-a-use-in-postman-to-test-the-api\">Option A: Use in Postman (to test the API)</h2>\n<h3 id=\"step-1-import-collection\">Step 1: Import Collection</h3>\n<ol>\n<li>Open Postman</li>\n<li>Click <strong>Import</strong> and select this collection file</li>\n</ol>\n<h3 id=\"step-2-create-environment\">Step 2: Create Environment</h3>\n<ol>\n<li><strong>Environments</strong> → <strong>+</strong> to create new</li>\n<li>Name it: <strong>BSure API v2</strong></li>\n<li>Add variables:</li>\n</ol>\n<div class=\"click-to-expand-wrapper is-table-wrapper\"><table>\n<thead>\n<tr>\n<th>Variable</th>\n<th>Initial Value</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td><code>baseUrl</code></td>\n<td><code>https://api.bsure.sa</code></td>\n</tr>\n<tr>\n<td><code>apiKey</code></td>\n<td><code>sp_xxxxxxxxxxxxx</code> (your key)</td>\n</tr>\n<tr>\n<td><code>surveyId</code></td>\n<td>(your survey ID)</td>\n</tr>\n<tr>\n<td><code>responseId</code></td>\n<td>(leave empty; auto-filled from responses)</td>\n</tr>\n</tbody>\n</table>\n</div><ol>\n<li><strong>Save</strong> and select this environment</li>\n</ol>\n<h3 id=\"step-3-get-your-api-key\">Step 3: Get Your API Key</h3>\n<ol>\n<li>See <strong>\"How to Get Your API Token\"</strong> in this folder</li>\n<li>Set <code>apiKey</code> in the environment to your token</li>\n</ol>\n<h3 id=\"step-4-test\">Step 4: Test</h3>\n<ol>\n<li>Run <strong>Health Check</strong> (🏥 Health Check folder)</li>\n<li>Run <strong>Get All Surveys</strong> (📋 Surveys folder)</li>\n</ol>\n<hr />\n<h2 id=\"option-b-use-as-reference-for-crm--power-bi\">Option B: Use as reference for CRM / Power BI</h2>\n<ul>\n<li><strong>Base URL:</strong> <code>https://api.bsure.sa</code></li>\n<li><strong>Auth:</strong> Header <code>Authorization: Bearer &lt;your_api_key&gt;</code></li>\n<li><strong>Endpoints:</strong> See folders <strong>Surveys</strong>, <strong>Responses</strong>, <strong>Export Responses</strong> for URLs, query params, and response shapes</li>\n<li><strong>Power BI:</strong> See folder <strong>📊 Power BI Integration</strong> for step-by-step connection</li>\n</ul>\n<p>You don’t need Postman to integrate; use these docs to configure your CRM connector or Power BI Web source.</p>\n","urlObject":{"path":["v2","health"],"host":["https://api.bsure.sa"],"query":[],"variable":[]}},"response":[],"_postman_id":"17021d34-a5a0-42c3-a5be-2c31e4a85306"}],"id":"f5cecb72-865c-4e13-bac9-d21ee01d4d8c","description":"<p>How to get your API token. Use this token in your CRM, Power BI, or any HTTP client (Postman, curl, etc.) to authenticate with the BSure API.</p>\n","_postman_id":"f5cecb72-865c-4e13-bac9-d21ee01d4d8c","auth":{"type":"bearer","bearer":{"basicConfig":[{"key":"token","value":"sp_xxxxxxxxxxxxx"}]},"isInherited":true,"source":{"_postman_id":"2de804e6-d70c-4e4f-9d9b-0e9a67b10cc1","id":"2de804e6-d70c-4e4f-9d9b-0e9a67b10cc1","name":"BSure API Documentation","type":"collection"}}},{"name":"Health Check","item":[{"name":"Health Check","event":[{"listen":"test","script":{"exec":["pm.test(\"Status code is 200\", function () {","    pm.response.to.have.status(200);","});","","pm.test(\"Response has status field\", function () {","    var jsonData = pm.response.json();","    pm.expect(jsonData).to.have.property('status');","});","","pm.test(\"Database is connected\", function () {","    var jsonData = pm.response.json();","    pm.expect(jsonData.database).to.eql('connected');","});","","pm.test(\"Response time is acceptable\", function () {","    pm.expect(pm.response.responseTime).to.be.below(2000);","});"],"type":"text/javascript","id":"a953614f-cd10-452c-8d39-ae0bcf73f995"}}],"id":"5f7e96a0-5827-46fe-8aa8-607db3d23445","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"auth":{"type":"noauth","isInherited":false},"method":"GET","header":[],"url":"https://api.bsure.sa/v2/health","description":"<p>Public health check endpoint to verify API is running and database connectivity.</p>\n<p><strong>No authentication required</strong></p>\n<h2 id=\"response-body-200-ok\">Response Body (200 OK)</h2>\n<pre class=\"click-to-expand-wrapper is-snippet-wrapper\"><code class=\"language-json\">{\n  \"status\": \"healthy\",\n  \"timestamp\": \"2025-12-17T10:15:00.000Z\",\n  \"service\": \"BSure API Gateway\",\n  \"version\": \"v2\",\n  \"database\": \"connected\"\n}\n</code></pre>\n<h3 id=\"response-fields\">Response Fields:</h3>\n<ul>\n<li><code>status</code> (string): Service status - \"healthy\" when all systems operational, \"degraded\" when there are issues</li>\n<li><code>timestamp</code> (string): ISO 8601 timestamp of when the health check was performed</li>\n<li><code>service</code> (string): Service name identifier</li>\n<li><code>version</code> (string): API version number</li>\n<li><code>database</code> (string): Database connectivity status - \"connected\" when database is reachable, \"disconnected\" when there are connectivity issues</li>\n</ul>\n","urlObject":{"path":["v2","health"],"host":["https://api.bsure.sa"],"query":[],"variable":[]}},"response":[{"id":"00f6f3b4-c34d-4e3d-afb5-d6da32f348ef","name":"Success - Healthy","originalRequest":{"method":"GET","header":[],"url":"https://api.bsure.sa/v2/health"},"status":"OK","code":200,"_postman_previewlanguage":"json","header":[{"key":"Content-Type","value":"application/json"}],"cookie":[],"responseTime":null,"body":"{\n  \"status\": \"healthy\",\n  \"timestamp\": \"2025-12-17T10:15:00.000Z\",\n  \"service\": \"BSure API Gateway\",\n  \"version\": \"v2\",\n  \"database\": \"connected\"\n}"}],"_postman_id":"5f7e96a0-5827-46fe-8aa8-607db3d23445"}],"id":"714b9e4d-0b5d-4ce5-a1f5-accc2570b3cc","description":"<p>Public endpoints that don't require authentication</p>\n","_postman_id":"714b9e4d-0b5d-4ce5-a1f5-accc2570b3cc","auth":{"type":"bearer","bearer":{"basicConfig":[{"key":"token","value":"sp_xxxxxxxxxxxxx"}]},"isInherited":true,"source":{"_postman_id":"2de804e6-d70c-4e4f-9d9b-0e9a67b10cc1","id":"2de804e6-d70c-4e4f-9d9b-0e9a67b10cc1","name":"BSure API Documentation","type":"collection"}}},{"name":"Surveys","item":[{"name":"Get All Surveys","event":[{"listen":"test","script":{"exec":["pm.test(\"Status code is 200\", function () {","    pm.response.to.have.status(200);","});","","pm.test(\"Response has meta and data\", function () {","    var jsonData = pm.response.json();","    pm.expect(jsonData).to.have.property('meta');","    pm.expect(jsonData).to.have.property('data');","    pm.expect(jsonData.data).to.be.an('array');","});","","pm.test(\"Meta contains pagination info\", function () {","    var jsonData = pm.response.json();","    pm.expect(jsonData.meta).to.have.property('total');","    pm.expect(jsonData.meta).to.have.property('limit');","    pm.expect(jsonData.meta).to.have.property('offset');","});","","// Save first survey ID if available","if (pm.response.json().data && pm.response.json().data.length > 0) {","    const firstSurvey = pm.response.json().data[0];","    if (firstSurvey.surveyId && !pm.environment.get('surveyId')) {","        pm.environment.set('surveyId', firstSurvey.surveyId);","    }","}"],"type":"text/javascript","id":"21f61d8a-dcf7-4c0b-9bc6-3fc0d2645d18"}}],"id":"59676656-5bda-41a9-b86c-ed00d1a53c4b","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[{"key":"Authorization","value":"Bearer sp_xxxxxxxxxxxxx","type":"text"}],"url":"https://api.bsure.sa/v2/surveys?includeArchived=false&limit=100&offset=0","description":"<p>Retrieve all surveys that the authenticated user has access to.</p>\n<p><strong>Query Parameters:</strong></p>\n<ul>\n<li><code>includeArchived</code> (optional): Include archived surveys (default: false)</li>\n<li><code>limit</code> (optional): Max surveys to return (default: 100, max: 1000)</li>\n<li><code>offset</code> (optional): Pagination offset (default: 0)</li>\n</ul>\n<h2 id=\"response-body-200-ok\">Response Body (200 OK)</h2>\n<pre class=\"click-to-expand-wrapper is-snippet-wrapper\"><code class=\"language-json\">{\n  \"meta\": {\n    \"total\": 25,\n    \"limit\": 100,\n    \"offset\": 0,\n    \"returned\": 25,\n    \"includeArchived\": false\n  },\n  \"data\": [\n    {\n      \"surveyId\": \"MCvPqNklENCa80hzHk9W\",\n      \"title\": {\n        \"default\": \"Customer Satisfaction Survey\",\n        \"ar\": \"استبيان رضا العملاء\"\n      },\n      \"createdByUserDisplayName\": \"John Doe\",\n      \"createdByUserId\": \"user123\",\n      \"createdDate\": \"2025-12-01T10:00:00.000Z\",\n      \"modifiedDate\": \"2025-12-17T10:00:00.000Z\",\n      \"target\": 1000,\n      \"responsesCount\": 2451,\n      \"completedResponsesCount\": 2300,\n      \"inCompletedResponsesCount\": 151,\n      \"surveyOriginalLanguage\": \"ar\",\n      \"archived\": false\n    }\n  ]\n}\n</code></pre>\n<h3 id=\"response-fields\">Response Fields:</h3>\n<p><strong>meta</strong> (object): Pagination and summary information</p>\n<ul>\n<li><code>total</code> (number): Total number of surveys matching the criteria</li>\n<li><code>limit</code> (number): Maximum number of surveys requested</li>\n<li><code>offset</code> (number): Number of surveys skipped</li>\n<li><code>returned</code> (number): Actual number of surveys returned in this response</li>\n<li><code>includeArchived</code> (boolean): Whether archived surveys were included</li>\n</ul>\n<p><strong>data</strong> (array): Array of survey objects</p>\n<ul>\n<li><code>surveyId</code> (string): Unique identifier for the survey</li>\n<li><code>title</code> (object): Survey title in multiple languages</li>\n<li><code>createdByUserDisplayName</code> (string): Name of user who created the survey</li>\n<li><code>createdByUserId</code> (string): ID of user who created the survey</li>\n<li><code>createdDate</code> (timestamp): When the survey was created</li>\n<li><code>modifiedDate</code> (timestamp): When the survey was last modified</li>\n<li><code>target</code> (number): Target number of responses</li>\n<li><code>responsesCount</code> (number): Total number of responses received</li>\n<li><code>completedResponsesCount</code> (number): Number of completed responses</li>\n<li><code>inCompletedResponsesCount</code> (number): Number of incomplete responses</li>\n<li><code>surveyOriginalLanguage</code> (string): Original language of the survey (\"ar\" or \"en\")</li>\n<li><code>archived</code> (boolean): Whether the survey is archived</li>\n</ul>\n","auth":{"type":"bearer","bearer":{"basicConfig":[{"key":"token","value":"sp_xxxxxxxxxxxxx"}]},"isInherited":true,"source":{"_postman_id":"2de804e6-d70c-4e4f-9d9b-0e9a67b10cc1","id":"2de804e6-d70c-4e4f-9d9b-0e9a67b10cc1","name":"BSure API Documentation","type":"collection"}},"urlObject":{"path":["v2","surveys"],"host":["https://api.bsure.sa"],"query":[{"description":{"content":"<p>Set to 'true' to include archived surveys</p>\n","type":"text/plain"},"key":"includeArchived","value":"false"},{"description":{"content":"<p>Maximum number of surveys (1-1000)</p>\n","type":"text/plain"},"key":"limit","value":"100"},{"description":{"content":"<p>Number of surveys to skip for pagination</p>\n","type":"text/plain"},"key":"offset","value":"0"}],"variable":[]}},"response":[{"id":"745e0f49-a23a-46c3-a5df-a8fcd821502c","name":"Success - Surveys Found","originalRequest":{"method":"GET","header":[{"key":"Authorization","value":"Bearer sp_xxxxxxxxxxxxx"}],"url":"https://api.bsure.sa/v2/surveys"},"status":"OK","code":200,"_postman_previewlanguage":"json","header":[{"key":"Content-Type","value":"application/json"},{"key":"X-RateLimit-Limit","value":"60"},{"key":"X-RateLimit-Remaining","value":"59"}],"cookie":[],"responseTime":null,"body":"{\n  \"meta\": {\n    \"total\": 25,\n    \"limit\": 100,\n    \"offset\": 0,\n    \"returned\": 25,\n    \"includeArchived\": false\n  },\n  \"data\": [\n    {\n      \"surveyId\": \"MCvPqNklENCa80hzHk9W\",\n      \"title\": {\n        \"default\": \"Customer Satisfaction Survey\",\n        \"ar\": \"استبيان رضا العملاء\"\n      },\n      \"createdByUserDisplayName\": \"John Doe\",\n      \"createdByUserId\": \"user123\",\n      \"createdDate\": \"2025-12-01T10:00:00.000Z\",\n      \"modifiedDate\": \"2025-12-17T10:00:00.000Z\",\n      \"target\": 1000,\n      \"responsesCount\": 2451,\n      \"completedResponsesCount\": 2300,\n      \"inCompletedResponsesCount\": 151,\n      \"surveyOriginalLanguage\": \"ar\",\n      \"archived\": false\n    }\n  ]\n}"}],"_postman_id":"59676656-5bda-41a9-b86c-ed00d1a53c4b"},{"name":"Get All Surveys (With Archived)","id":"a56cc820-b836-4d70-8c69-f8ce36e92aea","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[],"url":"https://api.bsure.sa/v2/surveys?includeArchived=true&limit=100","description":"<p>Retrieve all surveys including archived ones. Uses same response shape as <strong>Get All Surveys</strong>; set <code>includeArchived=true</code> to include archived surveys in the list.</p>\n","auth":{"type":"bearer","bearer":{"basicConfig":[{"key":"token","value":"sp_xxxxxxxxxxxxx"}]},"isInherited":true,"source":{"_postman_id":"2de804e6-d70c-4e4f-9d9b-0e9a67b10cc1","id":"2de804e6-d70c-4e4f-9d9b-0e9a67b10cc1","name":"BSure API Documentation","type":"collection"}},"urlObject":{"path":["v2","surveys"],"host":["https://api.bsure.sa"],"query":[{"description":{"content":"<p>Include archived surveys</p>\n","type":"text/plain"},"key":"includeArchived","value":"true"},{"description":{"content":"<p>Max surveys to return (1-1000)</p>\n","type":"text/plain"},"key":"limit","value":"100"}],"variable":[]}},"response":[],"_postman_id":"a56cc820-b836-4d70-8c69-f8ce36e92aea"}],"id":"a8213c82-8138-419b-a411-bde8e6f8ece7","description":"<p>Endpoints for managing surveys</p>\n","_postman_id":"a8213c82-8138-419b-a411-bde8e6f8ece7","auth":{"type":"bearer","bearer":{"basicConfig":[{"key":"token","value":"sp_xxxxxxxxxxxxx"}]},"isInherited":true,"source":{"_postman_id":"2de804e6-d70c-4e4f-9d9b-0e9a67b10cc1","id":"2de804e6-d70c-4e4f-9d9b-0e9a67b10cc1","name":"BSure API Documentation","type":"collection"}}},{"name":"Responses","item":[{"name":"Get All Responses","event":[{"listen":"test","script":{"exec":["pm.test(\"Status code is 200\", function () {","    pm.response.to.have.status(200);","});","","pm.test(\"Response has meta and data\", function () {","    var jsonData = pm.response.json();","    pm.expect(jsonData).to.have.property('meta');","    pm.expect(jsonData).to.have.property('data');","    pm.expect(jsonData.data).to.be.an('array');","});","","pm.test(\"Rate limit headers present\", function () {","    pm.expect(pm.response.headers.get('X-RateLimit-Limit')).to.exist;","    pm.expect(pm.response.headers.get('X-RateLimit-Remaining')).to.exist;","    pm.expect(pm.response.headers.get('X-RateLimit-Reset')).to.exist;","});","","// Save first response ID if available","if (pm.response.json().data && pm.response.json().data.length > 0) {","    const firstResponse = pm.response.json().data[0];","    if (firstResponse.response_id) {","        pm.environment.set('responseId', firstResponse.response_id);","    }","}"],"type":"text/javascript","id":"bcb330df-d4e5-43cb-944b-159d01735051"}}],"id":"b9cbe85d-740a-408c-bf04-bf54feceada3","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[{"key":"Authorization","value":"Bearer sp_xxxxxxxxxxxxx","type":"text"}],"url":"https://api.bsure.sa/v2/responses?surveyId=MCvPqNklENCa80hzHk9W&includeSchema=false","description":"<p>Retrieve all responses for a specific survey.</p>\n<p><strong>Query Parameters:</strong></p>\n<ul>\n<li><code>surveyId</code> (required): Survey ID</li>\n<li><code>includeSchema</code> (optional): Include question schema (default: false)</li>\n</ul>\n<h2 id=\"response-body-200-ok\">Response Body (200 OK)</h2>\n<pre class=\"click-to-expand-wrapper is-snippet-wrapper\"><code class=\"language-json\">{\n  \"meta\": {\n    \"survey_id\": \"MCvPqNklENCa80hzHk9W\",\n    \"total_responses\": 2451\n  },\n  \"data\": [\n    {\n      \"response_id\": \"1VaAmEAwWjC24g1cdIkP\",\n      \"at\": \"2025-12-17T10:15:00.000Z\",\n      \"context\": {\n        \"status\": \"completed\",\n        \"start_time\": \"2025-12-17T10:10:00.000Z\",\n        \"end_time\": \"2025-12-17T10:15:00.000Z\",\n        \"duration_seconds\": 300,\n        \"location\": {\n          \"lat\": 24.7136,\n          \"lng\": 46.6753\n        },\n        \"lang\": \"ar\"\n      },\n      \"answers\": {\n        \"Q1\": \"مرحبً من الـAPI\",\n        \"Q2\": \"#ff0000\",\n        \"Q29\": {\n          \"R1\": \"1\",\n          \"R2\": \"1\"\n        }\n      }\n    }\n  ]\n}\n</code></pre>\n<h3 id=\"response-fields\">Response Fields:</h3>\n<p><strong>meta</strong> (object): Metadata about the response set</p>\n<ul>\n<li><code>survey_id</code> (string): The survey ID these responses belong to</li>\n<li><code>total_responses</code> (number): Total number of responses returned</li>\n</ul>\n<p><strong>data</strong> (array): Array of response objects</p>\n<ul>\n<li><code>response_id</code> (string): Unique identifier for the response</li>\n<li><code>at</code> (string): ISO 8601 timestamp when the response was submitted</li>\n<li><code>context</code> (object): Response metadata<ul>\n<li><code>status</code> (string): Response status - \"completed\" or \"incompleted\"</li>\n<li><code>start_time</code> (string): When the interview started (ISO 8601)</li>\n<li><code>end_time</code> (string): When the interview ended (ISO 8601)</li>\n<li><code>duration_seconds</code> (number): Total duration in seconds</li>\n<li><code>location</code> (object|null): GPS coordinates if available<ul>\n<li><code>lat</code> (number): Latitude</li>\n<li><code>lng</code> (number): Longitude</li>\n</ul>\n</li>\n<li><code>lang</code> (string): Language code (\"ar\" or \"en\")</li>\n</ul>\n</li>\n<li><code>answers</code> (object): Question answers keyed by question ID<ul>\n<li>Keys are question IDs (e.g., \"Q1\", \"Q2\")</li>\n<li>Values are answer values (strings, numbers, arrays, or objects)</li>\n<li>Matrix questions are returned as structured objects</li>\n</ul>\n</li>\n</ul>\n<p><strong>schema</strong> (object, optional): Question schema definitions (only if <code>includeSchema=true</code>)</p>\n<ul>\n<li>Keys are question IDs</li>\n<li>Values contain question metadata (label, type, required, etc.)</li>\n</ul>\n","auth":{"type":"bearer","bearer":{"basicConfig":[{"key":"token","value":"sp_xxxxxxxxxxxxx"}]},"isInherited":true,"source":{"_postman_id":"2de804e6-d70c-4e4f-9d9b-0e9a67b10cc1","id":"2de804e6-d70c-4e4f-9d9b-0e9a67b10cc1","name":"BSure API Documentation","type":"collection"}},"urlObject":{"path":["v2","responses"],"host":["https://api.bsure.sa"],"query":[{"description":{"content":"<p>Survey ID to fetch responses for</p>\n","type":"text/plain"},"key":"surveyId","value":"MCvPqNklENCa80hzHk9W"},{"description":{"content":"<p>Set to 'true' to include question schema definitions</p>\n","type":"text/plain"},"key":"includeSchema","value":"false"}],"variable":[]}},"response":[{"id":"19cf698c-6827-4c10-ae56-90afb9f5d14d","name":"Success - With Responses","originalRequest":{"method":"GET","header":[{"key":"Authorization","value":"Bearer sp_xxxxxxxxxxxxx"}],"url":"https://api.bsure.sa/v2/responses"},"status":"OK","code":200,"_postman_previewlanguage":"json","header":[{"key":"Content-Type","value":"application/json"},{"key":"X-RateLimit-Limit","value":"60"},{"key":"X-RateLimit-Remaining","value":"58"}],"cookie":[],"responseTime":null,"body":"{\n  \"meta\": {\n    \"survey_id\": \"MCvPqNklENCa80hzHk9W\",\n    \"total_responses\": 2451\n  },\n  \"data\": [\n    {\n      \"response_id\": \"1VaAmEAwWjC24g1cdIkP\",\n      \"at\": \"2025-12-17T10:15:00.000Z\",\n      \"context\": {\n        \"status\": \"completed\",\n        \"start_time\": \"2025-12-17T10:10:00.000Z\",\n        \"end_time\": \"2025-12-17T10:15:00.000Z\",\n        \"duration_seconds\": 300,\n        \"location\": {\n          \"lat\": 24.7136,\n          \"lng\": 46.6753\n        },\n        \"lang\": \"ar\"\n      },\n      \"answers\": {\n        \"Q1\": \"مرحبً من الـAPI\",\n        \"Q2\": \"#ff0000\",\n        \"Q29\": {\n          \"R1\": \"1\",\n          \"R2\": \"1\"\n        }\n      }\n    }\n  ]\n}"}],"_postman_id":"b9cbe85d-740a-408c-bf04-bf54feceada3"},{"name":"Get All Responses (With Schema)","event":[{"listen":"test","script":{"exec":["pm.test(\"Status code is 200\", function () {","    pm.response.to.have.status(200);","});","","pm.test(\"Response includes schema\", function () {","    var jsonData = pm.response.json();","    pm.expect(jsonData).to.have.property('schema');","});"],"type":"text/javascript","id":"c8713af7-c4d6-4a25-b84a-41e1bf2e25f5"}}],"id":"8c77de32-cbe8-4ac9-83e1-c072183c1f7c","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[{"key":"Authorization","value":"Bearer sp_xxxxxxxxxxxxx","type":"text"}],"url":"https://api.bsure.sa/v2/responses?surveyId=MCvPqNklENCa80hzHk9W&includeSchema=true","description":"<p>Get all responses with question schema definitions included.</p>\n<h2 id=\"response-body-200-ok\">Response Body (200 OK)</h2>\n<p>Same as \"Get All Responses\" but includes <code>schema</code> field:</p>\n<pre class=\"click-to-expand-wrapper is-snippet-wrapper\"><code class=\"language-json\">{\n  \"meta\": { ... },\n  \"schema\": {\n    \"Q1\": {\n      \"label\": \"نص\",\n      \"type\": \"text\",\n      \"required\": true\n    },\n    \"Q29\": {\n      \"label\": \"مصفوفة اختيار واحد\",\n      \"type\": \"matrix_parent\",\n      \"required\": true,\n      \"config\": {\n        \"rows\": { \"R1\": \"R1\", \"R2\": \"R2\" },\n        \"cols\": { \"C1\": \"C1\", \"C2\": \"C2\" }\n      },\n      \"cells\": [\"Q29_R1\", \"Q29_R2\"]\n    }\n  },\n  \"data\": [ ... ]\n}\n</code></pre>\n<h3 id=\"schema-fields\">Schema Fields:</h3>\n<ul>\n<li><code>label</code> (string): Question label in survey language</li>\n<li><code>type</code> (string): Question type (\"text\", \"matrix_parent\", \"radio\", etc.)</li>\n<li><code>required</code> (boolean): Whether the question is required</li>\n<li><code>config</code> (object, optional): Configuration for complex question types</li>\n<li><code>cells</code> (array, optional): Sub-question IDs for matrix questions</li>\n</ul>\n","auth":{"type":"bearer","bearer":{"basicConfig":[{"key":"token","value":"sp_xxxxxxxxxxxxx"}]},"isInherited":true,"source":{"_postman_id":"2de804e6-d70c-4e4f-9d9b-0e9a67b10cc1","id":"2de804e6-d70c-4e4f-9d9b-0e9a67b10cc1","name":"BSure API Documentation","type":"collection"}},"urlObject":{"path":["v2","responses"],"host":["https://api.bsure.sa"],"query":[{"key":"surveyId","value":"MCvPqNklENCa80hzHk9W"},{"key":"includeSchema","value":"true"}],"variable":[]}},"response":[{"id":"bbe5deab-5a4f-4c5d-b78e-0b599c41b45b","name":"Success - With Schema","originalRequest":{"method":"GET","header":[{"key":"Authorization","value":"Bearer sp_xxxxxxxxxxxxx"}],"url":"https://api.bsure.sa/v2/responses"},"status":"OK","code":200,"_postman_previewlanguage":"json","header":[{"key":"Content-Type","value":"application/json"}],"cookie":[],"responseTime":null,"body":"{\n  \"meta\": {\n    \"survey_id\": \"MCvPqNklENCa80hzHk9W\",\n    \"total_responses\": 2451\n  },\n  \"schema\": {\n    \"Q1\": {\n      \"label\": \"نص\",\n      \"type\": \"text\",\n      \"required\": true\n    },\n    \"Q29\": {\n      \"label\": \"مصفوفة اختيار واحد\",\n      \"type\": \"matrix_parent\",\n      \"required\": true,\n      \"config\": {\n        \"rows\": { \"R1\": \"R1\", \"R2\": \"R2\" },\n        \"cols\": { \"C1\": \"C1\", \"C2\": \"C2\" }\n      },\n      \"cells\": [\"Q29_R1\", \"Q29_R2\"]\n    }\n  },\n  \"data\": [\n    {\n      \"response_id\": \"1VaAmEAwWjC24g1cdIkP\",\n      \"at\": \"2025-12-17T10:15:00.000Z\",\n      \"context\": { ... },\n      \"answers\": { ... }\n    }\n  ]\n}"}],"_postman_id":"8c77de32-cbe8-4ac9-83e1-c072183c1f7c"},{"name":"Get Single Response","event":[{"listen":"test","script":{"exec":["pm.test(\"Status code is 200\", function () {","    pm.response.to.have.status(200);","});","","pm.test(\"Response data is object (not array)\", function () {","    var jsonData = pm.response.json();","    pm.expect(jsonData.data).to.be.an('object');","    pm.expect(jsonData.meta.total_responses).to.eql(1);","});"],"type":"text/javascript","id":"a1ad758f-e07a-44ea-ac39-9d51202fac60"}}],"id":"8112ae40-9436-48bf-b1b7-79a859dbd142","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[{"key":"Authorization","value":"Bearer sp_xxxxxxxxxxxxx","type":"text"}],"url":"https://api.bsure.sa/v2/responses/?includeSchema=true","description":"<p>Retrieve a specific response by its ID.</p>\n<p><strong>Route Parameters:</strong></p>\n<ul>\n<li><code>responseId</code>: The response ID</li>\n</ul>\n<p><strong>Query Parameters:</strong></p>\n<ul>\n<li><code>includeSchema</code> (optional): Include question schema</li>\n</ul>\n<h2 id=\"response-body-200-ok\">Response Body (200 OK)</h2>\n<pre class=\"click-to-expand-wrapper is-snippet-wrapper\"><code class=\"language-json\">{\n  \"meta\": {\n    \"survey_id\": \"MCvPqNklENCa80hzHk9W\",\n    \"total_responses\": 1\n  },\n  \"schema\": { ... },\n  \"data\": {\n    \"response_id\": \"1VaAmEAwWjC24g1cdIkP\",\n    \"at\": \"2025-12-17T10:15:00.000Z\",\n    \"context\": {\n      \"status\": \"completed\",\n      \"start_time\": \"2025-12-17T10:10:00.000Z\",\n      \"end_time\": \"2025-12-17T10:15:00.000Z\",\n      \"duration_seconds\": 300,\n      \"location\": {\n        \"lat\": 24.7136,\n        \"lng\": 46.6753\n      },\n      \"lang\": \"ar\"\n    },\n    \"answers\": {\n      \"Q1\": \"مرحبً من الـAPI\",\n      \"Q29\": {\n        \"R1\": \"1\",\n        \"R2\": \"1\"\n      }\n    }\n  }\n}\n</code></pre>\n<h3 id=\"response-fields\">Response Fields:</h3>\n<p><strong>meta</strong> (object): Metadata</p>\n<ul>\n<li><code>survey_id</code> (string): Survey ID</li>\n<li><code>total_responses</code> (number): Always 1 for single response</li>\n</ul>\n<p><strong>data</strong> (object): Single response object (not array)</p>\n<ul>\n<li>Same structure as items in \"Get All Responses\" array</li>\n<li><code>response_id</code>, <code>at</code>, <code>context</code>, <code>answers</code> fields</li>\n</ul>\n<p><strong>schema</strong> (object, optional): Question schema (if <code>includeSchema=true</code>)</p>\n","auth":{"type":"bearer","bearer":{"basicConfig":[{"key":"token","value":"sp_xxxxxxxxxxxxx"}]},"isInherited":true,"source":{"_postman_id":"2de804e6-d70c-4e4f-9d9b-0e9a67b10cc1","id":"2de804e6-d70c-4e4f-9d9b-0e9a67b10cc1","name":"BSure API Documentation","type":"collection"}},"urlObject":{"path":["v2","responses",""],"host":["https://api.bsure.sa"],"query":[{"key":"includeSchema","value":"true"}],"variable":[]}},"response":[{"id":"b1927d04-f6da-44cb-9baf-b00d6b76b97e","name":"Success - Single Response","originalRequest":{"method":"GET","header":[{"key":"Authorization","value":"Bearer sp_xxxxxxxxxxxxx"}],"url":"https://api.bsure.sa/v2/responses/"},"status":"OK","code":200,"_postman_previewlanguage":"json","header":[{"key":"Content-Type","value":"application/json"}],"cookie":[],"responseTime":null,"body":"{\n  \"meta\": {\n    \"survey_id\": \"MCvPqNklENCa80hzHk9W\",\n    \"total_responses\": 1\n  },\n  \"schema\": {\n    \"Q1\": {\n      \"label\": \"نص\",\n      \"type\": \"text\",\n      \"required\": true\n    }\n  },\n  \"data\": {\n    \"response_id\": \"1VaAmEAwWjC24g1cdIkP\",\n    \"at\": \"2025-12-17T10:15:00.000Z\",\n    \"context\": {\n      \"status\": \"completed\",\n      \"start_time\": \"2025-12-17T10:10:00.000Z\",\n      \"end_time\": \"2025-12-17T10:15:00.000Z\",\n      \"duration_seconds\": 300,\n      \"location\": {\n        \"lat\": 24.7136,\n        \"lng\": 46.6753\n      },\n      \"lang\": \"ar\"\n    },\n    \"answers\": {\n      \"Q1\": \"مرحبً من الـAPI\",\n      \"Q29\": {\n        \"R1\": \"1\",\n        \"R2\": \"1\"\n      }\n    }\n  }\n}"},{"id":"ba672936-a47b-4be4-b861-6fab3e37e25e","name":"Error - Not Found","originalRequest":{"method":"GET","header":[{"key":"Authorization","value":"Bearer sp_xxxxxxxxxxxxx"}],"url":"https://api.bsure.sa/v2/responses/non-existent-id"},"status":"Not Found","code":404,"_postman_previewlanguage":"json","header":[{"key":"Content-Type","value":"application/json"}],"cookie":[],"responseTime":null,"body":"{\n  \"error\": {\n    \"code\": \"NOT_FOUND\",\n    \"message\": \"Response not found\"\n  }\n}"}],"_postman_id":"8112ae40-9436-48bf-b1b7-79a859dbd142"}],"id":"7e5091b3-d982-417f-8586-62ede7a9c64c","description":"<p>Endpoints for retrieving survey responses</p>\n","_postman_id":"7e5091b3-d982-417f-8586-62ede7a9c64c","auth":{"type":"bearer","bearer":{"basicConfig":[{"key":"token","value":"sp_xxxxxxxxxxxxx"}]},"isInherited":true,"source":{"_postman_id":"2de804e6-d70c-4e4f-9d9b-0e9a67b10cc1","id":"2de804e6-d70c-4e4f-9d9b-0e9a67b10cc1","name":"BSure API Documentation","type":"collection"}}},{"name":"Export Responses","item":[{"name":"Export - CSV","event":[{"listen":"test","script":{"exec":["pm.test(\"Status code is 200\", function () { pm.response.to.have.status(200); });","pm.test(\"Response has url and format\", function () {","    var j = pm.response.json();","    pm.expect(j).to.have.property('url');","    pm.expect(j).to.have.property('format', 'csv');","    pm.expect(j).to.have.property('surveyId');","    pm.expect(j).to.have.property('count');","});"],"type":"text/javascript","id":"c3f1cf96-e1e3-4881-8c32-a13d17bc98e6"}}],"id":"4fb4e689-d52e-4f78-a414-fa64a978ff96","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[{"key":"Authorization","value":"Bearer sp_xxxxxxxxxxxxx","type":"text"}],"url":"https://api.bsure.sa/v2/responses/export?surveyId=MCvPqNklENCa80hzHk9W&format=csv","description":"<p>Export responses in CSV format. Returns download URL.</p>\n<h2 id=\"response-body-200-ok\">Response Body (200 OK)</h2>\n<pre class=\"click-to-expand-wrapper is-snippet-wrapper\"><code class=\"language-json\">{\n  \"url\": \"https://storage.googleapis.com/bucket-name/exports/Survey_Title_1734432000000.csv\",\n  \"format\": \"csv\",\n  \"surveyId\": \"MCvPqNklENCa80hzHk9W\",\n  \"count\": 2451,\n  \"expiresIn\": \"1 hour\"\n}\n</code></pre>\n<h3 id=\"response-fields\">Response Fields:</h3>\n<ul>\n<li><code>url</code> (string): <strong>Public download URL</strong> - Use this URL to download the file</li>\n<li><code>format</code> (string): Export format (\"csv\", \"excel\", \"json\", \"spss\", \"powerbi\")</li>\n<li><code>surveyId</code> (string): Survey ID that was exported</li>\n<li><code>count</code> (number): Number of responses in the export</li>\n<li><code>expiresIn</code> (string): How long the URL is valid (typically \"1 hour\")</li>\n</ul>\n<p><strong>Note:</strong> The download URL expires after 1 hour. Download the file immediately after receiving the response.</p>\n","auth":{"type":"bearer","bearer":{"basicConfig":[{"key":"token","value":"sp_xxxxxxxxxxxxx"}]},"isInherited":true,"source":{"_postman_id":"2de804e6-d70c-4e4f-9d9b-0e9a67b10cc1","id":"2de804e6-d70c-4e4f-9d9b-0e9a67b10cc1","name":"BSure API Documentation","type":"collection"}},"urlObject":{"path":["v2","responses","export"],"host":["https://api.bsure.sa"],"query":[{"key":"surveyId","value":"MCvPqNklENCa80hzHk9W"},{"description":{"content":"<p>Export format</p>\n","type":"text/plain"},"key":"format","value":"csv"}],"variable":[]}},"response":[{"id":"e3ef3a50-1343-433d-bac6-d1a9665095dd","name":"Success - Export URL","originalRequest":{"method":"GET","header":[{"key":"Authorization","value":"Bearer sp_xxxxxxxxxxxxx"}],"url":"https://api.bsure.sa/v2/responses/export"},"status":"OK","code":200,"_postman_previewlanguage":"json","header":[{"key":"Content-Type","value":"application/json"}],"cookie":[],"responseTime":null,"body":"{\n  \"url\": \"https://storage.googleapis.com/bucket-name/exports/Survey_Title_1734432000000.csv\",\n  \"format\": \"csv\",\n  \"surveyId\": \"MCvPqNklENCa80hzHk9W\",\n  \"count\": 2451,\n  \"expiresIn\": \"1 hour\"\n}"}],"_postman_id":"4fb4e689-d52e-4f78-a414-fa64a978ff96"},{"name":"Export - Excel","event":[{"listen":"test","script":{"exec":["pm.test(\"Status code is 200\", function () { pm.response.to.have.status(200); });","pm.test(\"Response has url and format\", function () {","    var j = pm.response.json();","    pm.expect(j).to.have.property('url');","    pm.expect(j).to.have.property('format', 'excel');","    pm.expect(j).to.have.property('surveyId');","    pm.expect(j).to.have.property('count');","});"],"type":"text/javascript","id":"e32a5ee9-ec3c-4c11-acc8-f8a15a586541"}}],"id":"d8968631-7621-4bd9-863a-db95c10d7a38","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[],"url":"https://api.bsure.sa/v2/responses/export?surveyId=MCvPqNklENCa80hzHk9W&format=excel","description":"<p>Export responses in Excel (.xlsx) format. Returns a download URL (expires in 1 hour). Same response shape as Export - CSV.</p>\n","auth":{"type":"bearer","bearer":{"basicConfig":[{"key":"token","value":"sp_xxxxxxxxxxxxx"}]},"isInherited":true,"source":{"_postman_id":"2de804e6-d70c-4e4f-9d9b-0e9a67b10cc1","id":"2de804e6-d70c-4e4f-9d9b-0e9a67b10cc1","name":"BSure API Documentation","type":"collection"}},"urlObject":{"path":["v2","responses","export"],"host":["https://api.bsure.sa"],"query":[{"key":"surveyId","value":"MCvPqNklENCa80hzHk9W"},{"description":{"content":"<p>Export format: excel</p>\n","type":"text/plain"},"key":"format","value":"excel"}],"variable":[]}},"response":[],"_postman_id":"d8968631-7621-4bd9-863a-db95c10d7a38"},{"name":"Export - JSON","event":[{"listen":"test","script":{"exec":["pm.test(\"Status code is 200\", function () { pm.response.to.have.status(200); });","pm.test(\"Response has url and format\", function () {","    var j = pm.response.json();","    pm.expect(j).to.have.property('url');","    pm.expect(j).to.have.property('format', 'json');","    pm.expect(j).to.have.property('surveyId');","    pm.expect(j).to.have.property('count');","});"],"type":"text/javascript","id":"c6aecc4b-75f4-4b80-91cc-6405c0104004"}}],"id":"f2be3702-b02b-4178-b40e-ec83d93f9b5f","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[],"url":"https://api.bsure.sa/v2/responses/export?surveyId=MCvPqNklENCa80hzHk9W&format=json","description":"<p>Export responses in JSON format. Returns a download URL (expires in 1 hour). Same response shape as Export - CSV.</p>\n","auth":{"type":"bearer","bearer":{"basicConfig":[{"key":"token","value":"sp_xxxxxxxxxxxxx"}]},"isInherited":true,"source":{"_postman_id":"2de804e6-d70c-4e4f-9d9b-0e9a67b10cc1","id":"2de804e6-d70c-4e4f-9d9b-0e9a67b10cc1","name":"BSure API Documentation","type":"collection"}},"urlObject":{"path":["v2","responses","export"],"host":["https://api.bsure.sa"],"query":[{"key":"surveyId","value":"MCvPqNklENCa80hzHk9W"},{"description":{"content":"<p>Export format: json</p>\n","type":"text/plain"},"key":"format","value":"json"}],"variable":[]}},"response":[],"_postman_id":"f2be3702-b02b-4178-b40e-ec83d93f9b5f"},{"name":"Export - SPSS","event":[{"listen":"test","script":{"exec":["pm.test(\"Status code is 200\", function () { pm.response.to.have.status(200); });","pm.test(\"Response has url and format\", function () {","    var j = pm.response.json();","    pm.expect(j).to.have.property('url');","    pm.expect(j).to.have.property('format', 'spss');","    pm.expect(j).to.have.property('surveyId');","    pm.expect(j).to.have.property('count');","});"],"type":"text/javascript","id":"693981f6-b314-4238-a1d8-d87d67b67922"}}],"id":"d3d363dd-21d8-4c24-90ee-094705c43798","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[],"url":"https://api.bsure.sa/v2/responses/export?surveyId=MCvPqNklENCa80hzHk9W&format=spss","description":"<p>Export responses in SPSS (.sav) format. Returns a download URL (expires in 1 hour). Same response shape as Export - CSV.</p>\n","auth":{"type":"bearer","bearer":{"basicConfig":[{"key":"token","value":"sp_xxxxxxxxxxxxx"}]},"isInherited":true,"source":{"_postman_id":"2de804e6-d70c-4e4f-9d9b-0e9a67b10cc1","id":"2de804e6-d70c-4e4f-9d9b-0e9a67b10cc1","name":"BSure API Documentation","type":"collection"}},"urlObject":{"path":["v2","responses","export"],"host":["https://api.bsure.sa"],"query":[{"key":"surveyId","value":"MCvPqNklENCa80hzHk9W"},{"description":{"content":"<p>Export format: spss (.sav)</p>\n","type":"text/plain"},"key":"format","value":"spss"}],"variable":[]}},"response":[],"_postman_id":"d3d363dd-21d8-4c24-90ee-094705c43798"},{"name":"Export - Power BI","event":[{"listen":"test","script":{"exec":["pm.test(\"Status code is 200\", function () { pm.response.to.have.status(200); });","pm.test(\"Response has url and format\", function () {","    var j = pm.response.json();","    pm.expect(j).to.have.property('url');","    pm.expect(j).to.have.property('format', 'powerbi');","    pm.expect(j).to.have.property('surveyId');","    pm.expect(j).to.have.property('count');","});"],"type":"text/javascript","id":"f9d8cf36-6559-42f9-8c00-9fee5ffeb099"}}],"id":"28276837-46f3-4569-80b8-ce834de7c865","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[],"url":"https://api.bsure.sa/v2/responses/export?surveyId=MCvPqNklENCa80hzHk9W&format=powerbi","description":"<p>Export responses optimized for Power BI import.</p>\n<h2 id=\"response-body-200-ok\">Response Body (200 OK)</h2>\n<pre class=\"click-to-expand-wrapper is-snippet-wrapper\"><code class=\"language-json\">{\n  \"url\": \"https://storage.googleapis.com/bucket-name/exports/Survey_Title_1734432000000.powerbi.json\",\n  \"format\": \"powerbi\",\n  \"surveyId\": \"MCvPqNklENCa80hzHk9W\",\n  \"count\": 2451,\n  \"expiresIn\": \"1 hour\"\n}\n</code></pre>\n<p><strong>Note:</strong> This format is specifically optimized for Power BI data import. See Power BI Integration section for detailed setup instructions.</p>\n","auth":{"type":"bearer","bearer":{"basicConfig":[{"key":"token","value":"sp_xxxxxxxxxxxxx"}]},"isInherited":true,"source":{"_postman_id":"2de804e6-d70c-4e4f-9d9b-0e9a67b10cc1","id":"2de804e6-d70c-4e4f-9d9b-0e9a67b10cc1","name":"BSure API Documentation","type":"collection"}},"urlObject":{"path":["v2","responses","export"],"host":["https://api.bsure.sa"],"query":[{"key":"surveyId","value":"MCvPqNklENCa80hzHk9W"},{"key":"format","value":"powerbi"}],"variable":[]}},"response":[{"id":"5d0640d8-e696-4efa-b40f-19f0a095be07","name":"Success - Power BI Export","originalRequest":{"method":"GET","header":[{"key":"Authorization","value":"Bearer sp_xxxxxxxxxxxxx"}],"url":"https://api.bsure.sa/v2/responses/export"},"status":"OK","code":200,"_postman_previewlanguage":"json","header":[{"key":"Content-Type","value":"application/json"}],"cookie":[],"responseTime":null,"body":"{\n  \"url\": \"https://storage.googleapis.com/bucket-name/exports/Survey_Title_1734432000000.powerbi.json\",\n  \"format\": \"powerbi\",\n  \"surveyId\": \"MCvPqNklENCa80hzHk9W\",\n  \"count\": 2451,\n  \"expiresIn\": \"1 hour\"\n}"}],"_postman_id":"28276837-46f3-4569-80b8-ce834de7c865"}],"id":"6c355967-fdb0-499d-93ea-cfa74dd55068","description":"<p>Export survey responses in various formats</p>\n","_postman_id":"6c355967-fdb0-499d-93ea-cfa74dd55068","auth":{"type":"bearer","bearer":{"basicConfig":[{"key":"token","value":"sp_xxxxxxxxxxxxx"}]},"isInherited":true,"source":{"_postman_id":"2de804e6-d70c-4e4f-9d9b-0e9a67b10cc1","id":"2de804e6-d70c-4e4f-9d9b-0e9a67b10cc1","name":"BSure API Documentation","type":"collection"}}},{"name":"Power BI Integration","item":[{"name":"How to Connect Power BI to BSure API","id":"52a5b692-5d22-4d80-8bfe-6779980d38d6","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"auth":{"type":"noauth","isInherited":false},"method":"GET","header":[],"url":"https://api.bsure.sa/v2/health","description":"<h1 id=\"how-to-connect-power-bi-to-bsure-api\">How to Connect Power BI to BSure API</h1>\n<h2 id=\"prerequisites\">Prerequisites</h2>\n<p>Before you begin, make sure you have:</p>\n<ol>\n<li><p><strong>API Key</strong> - Get it from forms.bsure.sa &gt; Profile Settings &gt; Developer Tab &gt; Create Token</p>\n</li>\n<li><p><strong>Survey ID</strong> - Use the \"Get All Surveys\" endpoint to find your survey ID</p>\n</li>\n<li><p><strong>Power BI Desktop</strong> - Installed and ready to use</p>\n</li>\n</ol>\n<hr />\n<h2 id=\"step-by-step-connection-guide\">Step-by-Step Connection Guide</h2>\n<h3 id=\"step-1-get-your-api-key\">Step 1: Get Your API Key</h3>\n<ol>\n<li><p>Go to <a href=\"https://forms.bsure.sa\">forms.bsure.sa</a></p>\n</li>\n<li><p>Navigate to <strong>Profile</strong> &gt; <strong>Settings</strong> &gt; <strong>Developer</strong> tab</p>\n</li>\n<li><p>Click <strong>Create Token</strong></p>\n</li>\n<li><p>Copy your API key (format: <code>sp_xxxxxxxxxxxxx</code>)</p>\n</li>\n<li><p>Save it securely - you'll need it in the next steps</p>\n</li>\n</ol>\n<h3 id=\"step-2-get-your-survey-id\">Step 2: Get Your Survey ID</h3>\n<ol>\n<li><p>Use the <strong>\"Get All Surveys\"</strong> endpoint in this Postman collection</p>\n</li>\n<li><p>Copy the <code>surveyId</code> from the response</p>\n</li>\n<li><p>Example: <code>MCvPqNklENCa80hzHk9W</code></p>\n</li>\n</ol>\n<h3 id=\"step-3-open-power-bi-desktop\">Step 3: Open Power BI Desktop</h3>\n<ol>\n<li><p>Launch <strong>Power BI Desktop</strong></p>\n</li>\n<li><p>Click <strong>Get Data</strong> button (Home ribbon)</p>\n</li>\n<li><p>Select <strong>Web</strong> from the data sources list</p>\n</li>\n<li><p>Click <strong>Connect</strong></p>\n</li>\n</ol>\n<h3 id=\"step-4-configure-advanced-web-source\">Step 4: Configure Advanced Web Source</h3>\n<ol>\n<li><p>In the <strong>From Web</strong> dialog:</p>\n<ul>\n<li><p><strong>Select \"Advanced\" option</strong> (radio button at the top)</p>\n</li>\n<li><p>You'll see two sections: <strong>URL parts</strong> and <strong>HTTP request header parameters</strong></p>\n</li>\n</ul>\n</li>\n<li><p><strong>Configure URL Parts:</strong></p>\n<ul>\n<li><p>In the <strong>URL parts</strong> section, enter your API endpoint:</p>\n<pre class=\"click-to-expand-wrapper is-snippet-wrapper\"><code>                    https://api.bsure.sa/v2/responses?surveyId=YOUR_SURVEY_ID\n\n</code></pre></li>\n<li><p>Replace <code>YOUR_SURVEY_ID</code> with your actual survey ID</p>\n</li>\n<li><p><strong>Example:</strong></p>\n<pre class=\"click-to-expand-wrapper is-snippet-wrapper\"><code>                    https://api.bsure.sa/v2/responses?surveyId=MCvPqNklENCa80hzHk9W\n\n</code></pre></li>\n<li><p>The <strong>URL preview</strong> will show your complete URL</p>\n</li>\n</ul>\n</li>\n<li><p><strong>Configure HTTP Request Header:</strong></p>\n<ul>\n<li><p>In the <strong>HTTP request header parameters</strong> section:</p>\n</li>\n<li><p><strong>Header Name (dropdown):</strong> Select <strong>\"Authorization\"</strong> from the dropdown</p>\n</li>\n</ul>\n</li>\n</ol>\n<pre class=\"click-to-expand-wrapper is-snippet-wrapper\"><code>    sp_xxxxxxxxxxxxx\n</code></pre><ul>\n<li>Replace <code>sp_xxxxxxxxxxxxx</code> with your actual API key</li>\n<li><strong>Important:</strong> Include the word \"Bearer\" followed by a space, then your API key</li>\n<li><strong>Example:</strong> <code>Bearer sp_a1b2c3d4e5f6g7h8i9j0k1l2m3</code></li>\n</ul>\n<p> ```</p>\n<ol>\n<li><p><strong>Optional Settings:</strong></p>\n<ul>\n<li><strong>Command timeout:</strong> Leave empty (uses default) or set if needed</li>\n</ul>\n</li>\n<li><p><strong>Click OK</strong></p>\n</li>\n</ol>\n<h3 id=\"step-5-access-web-content-dialog\">Step 5: Access Web Content Dialog</h3>\n<ol>\n<li><p>After clicking OK, you'll see the <strong>Access Web content</strong> dialog</p>\n</li>\n<li><p>Select <strong>Anonymous</strong> (since authentication is handled via headers)</p>\n</li>\n<li><p>Click <strong>Connect</strong></p>\n</li>\n</ol>\n<h3 id=\"step-6-transform-data\">Step 6: Transform Data</h3>\n<ol>\n<li><p>Power BI will fetch and display the JSON response</p>\n</li>\n<li><p>You'll see a preview of the data structure</p>\n</li>\n<li><p>Click <strong>Transform Data</strong> to open Power Query Editor</p>\n<ul>\n<li>Or click <strong>Load</strong> to import directly (you can transform later)</li>\n</ul>\n</li>\n<li><p><strong>In Power Query Editor:</strong></p>\n<ul>\n<li><p>Expand the <code>data</code> column (click the expand icon ↗)</p>\n</li>\n<li><p>Select which columns to expand:</p>\n<ul>\n<li><p>✅ <code>response_id</code></p>\n</li>\n<li><p>✅ <code>at</code></p>\n</li>\n<li><p>✅ <code>context</code></p>\n</li>\n<li><p>✅ <code>answers</code></p>\n</li>\n</ul>\n</li>\n<li><p>Uncheck <strong>\"Use original column name as prefix\"</strong> (optional)</p>\n</li>\n<li><p>Click <strong>OK</strong></p>\n</li>\n</ul>\n</li>\n<li><p><strong>Expand nested columns:</strong></p>\n<ul>\n<li><p>Expand <code>context</code> column to get: <code>status</code>, <code>start_time</code>, <code>end_time</code>, <code>duration_seconds</code>, <code>location</code>, <code>lang</code></p>\n</li>\n<li><p>Expand <code>answers</code> column to get all question responses (Q1, Q2, etc.)</p>\n</li>\n</ul>\n</li>\n<li><p><strong>Set data types:</strong></p>\n<ul>\n<li><p>Change <code>at</code>, <code>start_time</code>, <code>end_time</code> to <strong>Date/Time</strong></p>\n</li>\n<li><p>Set numeric columns to <strong>Number</strong> type</p>\n</li>\n</ul>\n</li>\n<li><p><strong>Click Close &amp; Apply</strong> when done</p>\n</li>\n</ol>\n<hr />\n<h2 id=\"visual-guide-reference\">Visual Guide Reference</h2>\n<p>When you see the <strong>From Web</strong> dialog:</p>\n<ul>\n<li><p>✅ Select <strong>\"Advanced\"</strong> (not Basic)</p>\n</li>\n<li><p>✅ Enter URL in <strong>URL parts</strong> section</p>\n</li>\n<li><p>✅ In <strong>HTTP request header parameters</strong>:</p>\n<ul>\n<li><p>Header Name: <strong>Authorization</strong> (from dropdown)</p>\n</li>\n<li><p>Header Value: <strong>Bearer sp_xxxxxxxxxxxxx</strong> (your API key with \"Bearer \" prefix)</p>\n</li>\n</ul>\n</li>\n<li><p>✅ Click <strong>OK</strong></p>\n</li>\n</ul>\n<hr />\n<h2 id=\"alternative-using-power-bi-export-format\">Alternative: Using Power BI Export Format</h2>\n<p>If you prefer a pre-formatted export:</p>\n<ol>\n<li><p>Use the <strong>\"Export - Power BI\"</strong> endpoint in Postman</p>\n</li>\n<li><p>Copy the <code>url</code> from the response</p>\n</li>\n<li><p>In Power BI Desktop:</p>\n<ul>\n<li><p><strong>Get Data</strong> &gt; <strong>Web</strong></p>\n</li>\n<li><p>Enter the export URL</p>\n</li>\n<li><p>Click <strong>OK</strong></p>\n</li>\n<li><p>Select <strong>Anonymous</strong> authentication</p>\n</li>\n<li><p>Click <strong>Connect</strong></p>\n</li>\n</ul>\n</li>\n</ol>\n<p><strong>Note:</strong> Export URLs expire after 1 hour. For scheduled refreshes, use the direct API connection method above.</p>\n<hr />\n<h2 id=\"power-bi-settings-for-scheduled-refresh\">Power BI Settings for Scheduled Refresh</h2>\n<h3 id=\"configure-data-source-credentials\">Configure Data Source Credentials</h3>\n<ol>\n<li><p>Go to <strong>File</strong> &gt; <strong>Options and Settings</strong> &gt; <strong>Data Source Settings</strong></p>\n</li>\n<li><p>Select your BSure API data source</p>\n</li>\n<li><p>Click <strong>Edit Permissions</strong></p>\n</li>\n<li><p>Set authentication:</p>\n<ul>\n<li><p><strong>Authentication method:</strong> Anonymous (headers handle auth)</p>\n</li>\n<li><p>Or use <strong>Basic</strong> with:</p>\n<ul>\n<li><p><strong>Username:</strong> (empty)</p>\n</li>\n<li><p><strong>Password:</strong> Your API key</p>\n</li>\n</ul>\n</li>\n</ul>\n</li>\n<li><p>Click <strong>OK</strong></p>\n</li>\n</ol>\n<h3 id=\"enable-scheduled-refresh-power-bi-service\">Enable Scheduled Refresh (Power BI Service)</h3>\n<ol>\n<li><p><strong>Publish your report:</strong></p>\n<ul>\n<li><p>File &gt; <strong>Publish</strong> &gt; <strong>Publish to Power BI</strong></p>\n</li>\n<li><p>Sign in and select workspace</p>\n</li>\n<li><p>Click <strong>Publish</strong></p>\n</li>\n</ul>\n</li>\n<li><p><strong>Configure in Power BI Service:</strong></p>\n<ul>\n<li><p>Go to <a href=\"https://app.powerbi.com\">app.powerbi.com</a></p>\n</li>\n<li><p>Navigate to your workspace</p>\n</li>\n<li><p>Click <strong>Datasets</strong> tab</p>\n</li>\n<li><p>Find your dataset</p>\n</li>\n<li><p>Click <strong>...</strong> (more options) &gt; <strong>Settings</strong></p>\n</li>\n</ul>\n</li>\n<li><p><strong>Set Data Source Credentials:</strong></p>\n<ul>\n<li><p>Expand <strong>Data source credentials</strong></p>\n</li>\n<li><p>Click <strong>Edit credentials</strong></p>\n</li>\n<li><p><strong>Authentication method:</strong> Anonymous</p>\n</li>\n<li><p>Click <strong>Sign in</strong></p>\n</li>\n</ul>\n</li>\n<li><p><strong>Enable Scheduled Refresh:</strong></p>\n<ul>\n<li><p>Go to <strong>Scheduled refresh</strong> section</p>\n</li>\n<li><p>Toggle <strong>Keep your data up to date</strong> ON</p>\n</li>\n<li><p>Set <strong>Refresh frequency:</strong> Daily (or as needed)</p>\n</li>\n<li><p>Set <strong>Time zone</strong></p>\n</li>\n<li><p>Click <strong>Apply</strong></p>\n</li>\n</ul>\n</li>\n</ol>\n<hr />\n<h2 id=\"troubleshooting\">Troubleshooting</h2>\n<h3 id=\"error-unable-to-connect\">Error: \"Unable to connect\"</h3>\n<ul>\n<li><p>✅ Check API key is correct</p>\n</li>\n<li><p>✅ Verify URL is correct</p>\n</li>\n<li><p>✅ Ensure survey ID exists and you have access</p>\n</li>\n<li><p>✅ Check internet connection</p>\n</li>\n</ul>\n<h3 id=\"error-401-unauthorized\">Error: \"401 Unauthorized\"</h3>\n<ul>\n<li><p>✅ Verify API key format: <code>sp_xxxxxxxxxxxxx</code></p>\n</li>\n<li><p>✅ Check API key is active (not revoked in Developer tab)</p>\n</li>\n<li><p>✅ Ensure no extra spaces in the header value</p>\n</li>\n</ul>\n<h3 id=\"error-404-not-found\">Error: \"404 Not Found\"</h3>\n<ul>\n<li><p>✅ Verify survey ID is correct</p>\n</li>\n<li><p>✅ Check you have access to the survey</p>\n</li>\n<li><p>✅ Test the endpoint in Postman first</p>\n</li>\n</ul>\n<h3 id=\"data-not-refreshing\">Data Not Refreshing</h3>\n<ul>\n<li><p>✅ Check credentials in Data Source Settings</p>\n</li>\n<li><p>✅ Verify scheduled refresh is enabled</p>\n</li>\n<li><p>✅ Check refresh history for errors</p>\n</li>\n<li><p>✅ Ensure API key hasn't been revoked</p>\n</li>\n</ul>\n<h3 id=\"url-preview-shows-incorrect-url\">URL Preview Shows Incorrect URL</h3>\n<ul>\n<li><p>✅ Check URL parts field has correct endpoint</p>\n</li>\n<li><p>✅ Verify survey ID parameter is included</p>\n</li>\n<li><p>✅ Make sure URL starts with <code>https://</code></p>\n</li>\n</ul>\n<hr />\n<h2 id=\"security-best-practices\">Security Best Practices</h2>\n<ol>\n<li><p><strong>Never hardcode API keys</strong> in Power BI reports</p>\n</li>\n<li><p><strong>Use Power BI Service credentials</strong> for scheduled refreshes</p>\n</li>\n<li><p><strong>Rotate API keys regularly</strong></p>\n</li>\n<li><p><strong>Monitor API usage</strong> in Developer tab</p>\n</li>\n<li><p><strong>Use separate API keys</strong> for different purposes</p>\n</li>\n<li><p><strong>Revoke unused keys</strong> immediately</p>\n</li>\n</ol>\n<hr />\n<h2 id=\"additional-resources\">Additional Resources</h2>\n<ul>\n<li><p>Power BI Documentation: <a href=\"https://docs.microsoft.com/power-bi/connect-data/desktop-connect-to-web\">Get data from web</a></p>\n</li>\n<li><p>Power BI Advanced Options: <a href=\"https://docs.microsoft.com/power-query/connectors/web\">Advanced web connector options</a></p>\n</li>\n<li><p>BSure API Documentation: See other endpoints in this collection</p>\n</li>\n</ul>\n","urlObject":{"path":["v2","health"],"host":["https://api.bsure.sa"],"query":[],"variable":[]}},"response":[],"_postman_id":"52a5b692-5d22-4d80-8bfe-6779980d38d6"},{"name":"Step-by-Step: Power BI Setup","id":"b8caf96b-a284-4101-b2be-842471705f48","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"auth":{"type":"noauth","isInherited":false},"method":"GET","header":[],"url":"https://api.bsure.sa/v2/health","description":"<h1 id=\"step-by-step-power-bi-setup-guide\">Step-by-Step: Power BI Setup Guide</h1>\n<h2 id=\"quick-start-5-minutes\">Quick Start (5 Minutes)</h2>\n<h3 id=\"1-get-your-credentials\">1. Get Your Credentials</h3>\n<ul>\n<li><p><strong>API Key:</strong> Get from forms.bsure.sa &gt; Profile Settings &gt; Developer Tab &gt; Create Token</p>\n</li>\n<li><p><strong>Survey ID:</strong> Use \"Get All Surveys\" endpoint in Postman to find your survey ID</p>\n</li>\n<li><p><strong>Base URL:</strong> <code>https://api.bsure.sa</code></p>\n</li>\n</ul>\n<h3 id=\"2-open-power-bi-desktop\">2. Open Power BI Desktop</h3>\n<ul>\n<li><p>Launch Power BI Desktop</p>\n</li>\n<li><p>Click <strong>Get Data</strong> button (Home tab)</p>\n</li>\n<li><p>Select <strong>Web</strong> from the data sources list</p>\n</li>\n<li><p>Click <strong>Connect</strong></p>\n</li>\n</ul>\n<h3 id=\"3-configure-advanced-web-source\">3. Configure Advanced Web Source</h3>\n<p>In the <strong>From Web</strong> dialog:</p>\n<ol>\n<li><p><strong>Select \"Advanced\" option</strong> (radio button at the top - NOT Basic)</p>\n</li>\n<li><p><strong>URL Parts Section:</strong></p>\n<ul>\n<li><p>Enter your complete API endpoint URL:</p>\n<pre class=\"click-to-expand-wrapper is-snippet-wrapper\"><code>          https://api.bsure.sa/v2/responses?surveyId=YOUR_SURVEY_ID\n\n</code></pre></li>\n<li><p>Replace <code>YOUR_SURVEY_ID</code> with your actual survey ID</p>\n</li>\n<li><p><strong>Example:</strong></p>\n<pre class=\"click-to-expand-wrapper is-snippet-wrapper\"><code>          https://api.bsure.sa/v2/responses?surveyId=MCvPqNklENCa80hzHk9W\n\n</code></pre></li>\n<li><p>The <strong>URL preview</strong> below will show your complete URL</p>\n</li>\n</ul>\n</li>\n<li><p><strong>HTTP Request Header Parameters Section:</strong></p>\n<ul>\n<li><p><strong>Header Name (dropdown):</strong> Select <strong>\"Authorization\"</strong> from the dropdown menu</p>\n</li>\n<li><p><strong>Header Value (input field):</strong> Enter:</p>\n<pre class=\"click-to-expand-wrapper is-snippet-wrapper\"><code>          sp_xxxxxxxxxxxxx\n\n</code></pre><ul>\n<li><p>Replace <code>sp_xxxxxxxxxxxxx</code> with your actual API key</p>\n</li>\n<li><p><strong>Important:</strong> Must include \"Bearer \" (with space) before your API key</p>\n</li>\n<li><p><strong>Example:</strong> <code>Bearer sp_a1b2c3d4e5f6g7h8i9j0k1l2m3</code></p>\n</li>\n</ul>\n</li>\n</ul>\n</li>\n<li><p><strong>Command Timeout:</strong> Leave empty (uses default)</p>\n</li>\n<li><p><strong>Click OK</strong></p>\n</li>\n</ol>\n<h3 id=\"4-access-web-content-dialog\">4. Access Web Content Dialog</h3>\n<ol>\n<li><p>After clicking OK, you'll see <strong>Access Web content</strong> dialog</p>\n</li>\n<li><p>Select <strong>Anonymous</strong> (authentication is handled via headers)</p>\n</li>\n<li><p>Click <strong>Connect</strong></p>\n</li>\n</ol>\n<h3 id=\"5-transform-data\">5. Transform Data</h3>\n<ol>\n<li><p>Power BI will fetch the JSON response</p>\n</li>\n<li><p>Click <strong>Transform Data</strong> to open Power Query Editor</p>\n<ul>\n<li>Or click <strong>Load</strong> to import directly</li>\n</ul>\n</li>\n<li><p><strong>In Power Query Editor:</strong></p>\n<ul>\n<li><p>Expand the <code>data</code> column (click expand icon ↗)</p>\n</li>\n<li><p>Select columns: <code>response_id</code>, <code>at</code>, <code>context</code>, <code>answers</code></p>\n</li>\n<li><p>Click <strong>OK</strong></p>\n</li>\n<li><p>Expand <code>context</code> column for metadata</p>\n</li>\n<li><p>Expand <code>answers</code> column for question responses</p>\n</li>\n<li><p>Set date columns to <strong>Date/Time</strong> type</p>\n</li>\n<li><p>Click <strong>Close &amp; Apply</strong></p>\n</li>\n</ul>\n</li>\n</ol>\n<hr />\n<h2 id=\"visual-configuration-reference\">Visual Configuration Reference</h2>\n<p>When you see the <strong>From Web</strong> dialog, configure it exactly like this:</p>\n<p><strong>Mode Selection:</strong></p>\n<ul>\n<li><p>✅ <strong>Advanced</strong> (selected)</p>\n</li>\n<li><p>❌ Basic (not selected)</p>\n</li>\n</ul>\n<p><strong>URL Parts:</strong></p>\n<pre class=\"click-to-expand-wrapper is-snippet-wrapper\"><code>https://api.bsure.sa/v2/responses?surveyId=YOUR_SURVEY_ID\n\n</code></pre><p><strong>HTTP Request Header Parameters:</strong></p>\n<ul>\n<li><p><strong>Header Name:</strong> <code>Authorization</code> (from dropdown)</p>\n</li>\n<li><p><strong>Header Value:</strong> <code>Bearer sp_xxxxxxxxxxxxx</code> (your API key with \"Bearer \" prefix)</p>\n</li>\n</ul>\n<p><strong>URL Preview:</strong></p>\n<ul>\n<li>Should show your complete URL with survey ID</li>\n</ul>\n<p><strong>Command Timeout:</strong></p>\n<ul>\n<li>Leave empty</li>\n</ul>\n<hr />\n<h2 id=\"data-transformation-steps\">Data Transformation Steps</h2>\n<h3 id=\"step-1-expand-data-column\">Step 1: Expand Data Column</h3>\n<ol>\n<li><p>In Power Query Editor, find the <code>data</code> column</p>\n</li>\n<li><p>Click the <strong>expand icon</strong> (↗) next to column name</p>\n</li>\n<li><p>Select columns:</p>\n<ul>\n<li><p>✅ <code>response_id</code></p>\n</li>\n<li><p>✅ <code>at</code></p>\n</li>\n<li><p>✅ <code>context</code></p>\n</li>\n<li><p>✅ <code>answers</code></p>\n</li>\n</ul>\n</li>\n<li><p>Uncheck <strong>\"Use original column name as prefix\"</strong></p>\n</li>\n<li><p>Click <strong>OK</strong></p>\n</li>\n</ol>\n<h3 id=\"step-2-expand-context-column\">Step 2: Expand Context Column</h3>\n<ol>\n<li><p>Click expand icon on <code>context</code> column</p>\n</li>\n<li><p>Select:</p>\n<ul>\n<li><p>✅ <code>status</code></p>\n</li>\n<li><p>✅ <code>start_time</code></p>\n</li>\n<li><p>✅ <code>end_time</code></p>\n</li>\n<li><p>✅ <code>duration_seconds</code></p>\n</li>\n<li><p>✅ <code>location</code></p>\n</li>\n<li><p>✅ <code>lang</code></p>\n</li>\n</ul>\n</li>\n<li><p>Click <strong>OK</strong></p>\n</li>\n</ol>\n<h3 id=\"step-3-expand-answers-column\">Step 3: Expand Answers Column</h3>\n<ol>\n<li><p>Click expand icon on <code>answers</code> column</p>\n</li>\n<li><p>Select all question columns (Q1, Q2, Q3, etc.)</p>\n</li>\n<li><p>Click <strong>OK</strong></p>\n</li>\n</ol>\n<h3 id=\"step-4-set-data-types\">Step 4: Set Data Types</h3>\n<ol>\n<li><p>Select <code>at</code> column</p>\n</li>\n<li><p>Right-click &gt; <strong>Change Type</strong> &gt; <strong>Date/Time</strong></p>\n</li>\n<li><p>Repeat for <code>start_time</code> and <code>end_time</code></p>\n</li>\n<li><p>Set numeric columns to <strong>Number</strong> type</p>\n</li>\n<li><p>Set text columns to <strong>Text</strong> type</p>\n</li>\n</ol>\n<h3 id=\"step-5-close--apply\">Step 5: Close &amp; Apply</h3>\n<ol>\n<li><p>Click <strong>Close &amp; Apply</strong></p>\n</li>\n<li><p>Data will load into Power BI</p>\n</li>\n</ol>\n<hr />\n<h2 id=\"scheduled-refresh-setup-power-bi-service\">Scheduled Refresh Setup (Power BI Service)</h2>\n<h3 id=\"1-publish-report\">1. Publish Report</h3>\n<ul>\n<li><p>File &gt; <strong>Publish</strong> &gt; <strong>Publish to Power BI</strong></p>\n</li>\n<li><p>Sign in and select workspace</p>\n</li>\n<li><p>Click <strong>Publish</strong></p>\n</li>\n</ul>\n<h3 id=\"2-configure-data-source\">2. Configure Data Source</h3>\n<ul>\n<li><p>Go to <a href=\"https://app.powerbi.com\">app.powerbi.com</a></p>\n</li>\n<li><p>Navigate to your workspace</p>\n</li>\n<li><p>Click <strong>Datasets</strong> tab</p>\n</li>\n<li><p>Find your dataset</p>\n</li>\n<li><p>Click <strong>...</strong> (more options) &gt; <strong>Settings</strong></p>\n</li>\n</ul>\n<h3 id=\"3-set-credentials\">3. Set Credentials</h3>\n<ul>\n<li><p>Expand <strong>Data source credentials</strong></p>\n</li>\n<li><p>Click <strong>Edit credentials</strong></p>\n</li>\n<li><p><strong>Authentication method:</strong> Anonymous</p>\n</li>\n<li><p>Click <strong>Sign in</strong></p>\n</li>\n</ul>\n<h3 id=\"4-enable-scheduled-refresh\">4. Enable Scheduled Refresh</h3>\n<ul>\n<li><p>Go to <strong>Scheduled refresh</strong> section</p>\n</li>\n<li><p>Toggle <strong>Keep your data up to date</strong> ON</p>\n</li>\n<li><p>Set <strong>Refresh frequency:</strong> Daily (or as needed)</p>\n</li>\n<li><p>Set <strong>Time zone</strong></p>\n</li>\n<li><p>Click <strong>Apply</strong></p>\n</li>\n</ul>\n<hr />\n<h2 id=\"testing-your-connection\">Testing Your Connection</h2>\n<h3 id=\"test-in-power-query-editor\">Test in Power Query Editor</h3>\n<ol>\n<li><p>Click <strong>Home</strong> &gt; <strong>Advanced Editor</strong></p>\n</li>\n<li><p>Review the M query</p>\n</li>\n<li><p>Click <strong>Done</strong></p>\n</li>\n<li><p>Click <strong>Refresh Preview</strong> (right side)</p>\n</li>\n<li><p>Verify data loads correctly</p>\n</li>\n</ol>\n<h3 id=\"test-scheduled-refresh\">Test Scheduled Refresh</h3>\n<ol>\n<li><p>After publishing to Power BI Service</p>\n</li>\n<li><p>Wait for scheduled refresh time</p>\n</li>\n<li><p>Check <strong>Refresh history</strong> in dataset settings</p>\n</li>\n<li><p>Verify <strong>Last refresh</strong> timestamp</p>\n</li>\n<li><p>Check for any errors</p>\n</li>\n</ol>\n<hr />\n<h2 id=\"common-issues--solutions\">Common Issues &amp; Solutions</h2>\n<div class=\"click-to-expand-wrapper is-table-wrapper\"><table>\n<thead>\n<tr>\n<th>Issue</th>\n<th>Solution</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>\"401 Unauthorized\"</td>\n<td>Check API key format: <code>Bearer sp_xxx</code> (with space after Bearer)</td>\n</tr>\n<tr>\n<td>\"404 Not Found\"</td>\n<td>Verify survey ID is correct in URL</td>\n</tr>\n<tr>\n<td>Data not refreshing</td>\n<td>Check scheduled refresh is enabled in Power BI Service</td>\n</tr>\n<tr>\n<td>URL preview incorrect</td>\n<td>Verify URL parts field has complete URL with surveyId parameter</td>\n</tr>\n<tr>\n<td>Header not working</td>\n<td>Ensure \"Authorization\" is selected from dropdown, value is <code>Bearer sp_xxx</code></td>\n</tr>\n<tr>\n<td>Missing columns</td>\n<td>Expand nested columns in Power Query Editor</td>\n</tr>\n<tr>\n<td>Date format issues</td>\n<td>Change column type to Date/Time in Power Query</td>\n</tr>\n</tbody>\n</table>\n</div><hr />\n<h2 id=\"✅-checklist\">✅ Checklist</h2>\n<ul>\n<li><p>API key obtained from forms.bsure.sa Developer tab</p>\n</li>\n<li><p>Survey ID identified from Get All Surveys endpoint</p>\n</li>\n<li><p>Power BI Desktop installed</p>\n</li>\n<li><p>Advanced mode selected in From Web dialog</p>\n</li>\n<li><p>URL entered correctly in URL parts section</p>\n</li>\n<li><p>Authorization header configured (Header Name: Authorization, Value: Bearer sp_xxx)</p>\n</li>\n<li><p>Anonymous authentication selected in Access Web content dialog</p>\n</li>\n<li><p>Data loaded successfully</p>\n</li>\n<li><p>Columns expanded and formatted in Power Query</p>\n</li>\n<li><p>Report published to Power BI Service</p>\n</li>\n<li><p>Scheduled refresh configured</p>\n</li>\n<li><p>Refresh tested and working</p>\n</li>\n</ul>\n<hr />\n<h2 id=\"🎉-youre-done\">🎉 You're Done!</h2>\n<p>Your Power BI report is now connected to BSure API and will automatically refresh with the latest survey responses!</p>\n","urlObject":{"path":["v2","health"],"host":["https://api.bsure.sa"],"query":[],"variable":[]}},"response":[],"_postman_id":"b8caf96b-a284-4101-b2be-842471705f48"}],"id":"096e5163-c7bf-4204-8933-5502b6b76adf","description":"<p>Step-by-step guide for connecting Power BI (or similar tools) to the BSure API. Use this folder together with the Export and Responses endpoints to build reports from your survey data.</p>\n","_postman_id":"096e5163-c7bf-4204-8933-5502b6b76adf","auth":{"type":"bearer","bearer":{"basicConfig":[{"key":"token","value":"sp_xxxxxxxxxxxxx"}]},"isInherited":true,"source":{"_postman_id":"2de804e6-d70c-4e4f-9d9b-0e9a67b10cc1","id":"2de804e6-d70c-4e4f-9d9b-0e9a67b10cc1","name":"BSure API Documentation","type":"collection"}}}],"auth":{"type":"bearer","bearer":{"basicConfig":[{"key":"token","value":"sp_xxxxxxxxxxxxx"}]}},"variable":[{"key":"baseUrl","value":"https://api.bsure.sa","type":"string"},{"key":"apiKey","value":"sp_xxxxxxxxxxxxx","type":"string"},{"key":"surveyId","value":"MCvPqNklENCa80hzHk9W","type":"string"},{"key":"responseId","value":"","type":"string"}]}