Skip to content

Pull export in Power BI Desktop

Load response rows directly in Power BI Desktop using your external access token. No Microsoft connection is required in the portal for this method.

Related: Power BI overview · Push to Power BI

Before you start

  1. Publish the survey and collect responses through a distribution channel.
  2. Copy the survey short code from the survey URL or Integrations tab.
  3. Get your external access token from Profile.

Portal shortcut

  1. Open IntegrationsPower BI → expand Method 2: Pull export in Power BI Desktop.
  2. Copy the Export endpoint, Authorization header, and Power Query (M) snippet.
  3. Paste the Power Query into Power BI Desktop (see below).

1. Export endpoint

Replace {short_code} with the survey short code.

Endpoint
GET https://api-cxm.akwad.sa/api/v1/integrations/surveys/{short_code}/responses/export

2. Headers

Accept
Accept: application/json
Authorization
X-External-Access-Token: {your_token}

3. Query parameters

ParameterDefaultDescription
page1Page number
per_page100Rows per page (max 100)
sortcreated_atcreated_at, start_time, or end_time
directiondescasc or desc
search-Optional text search on response id, contact, or collector name
since-ISO8601 timestamp - return rows with created_at >= since (incremental refresh)
include_piitrueWhen false, omit email, phone, and ip columns

Example incremental request:

GET
https://api-cxm.akwad.sa/api/v1/integrations/surveys/{short_code}/responses/export?since=2026-06-01T00:00:00Z&include_pii=false

4. Response shape

Success payload (product contract):

JSON
{
  "success": true,
  "message": "Export completed.",
  "data": {
    "columns": [
      "response_id",
      "created_at",
      "status",
      "collector_name",
      "q_nps",
      "q_feedback"
    ],
    "rows": [
      {
        "response_id": "01932a1b-2c3d-7890-abcd-ef1234567890",
        "created_at": "2026-06-08T12:00:00+00:00",
        "status": "pending",
        "collector_name": "Web Link 1",
        "q_nps": 9,
        "q_feedback": "Great service"
      }
    ],
    "meta": {
      "current_page": 1,
      "per_page": 100,
      "total": 250,
      "last_page": 3
    }
  }
}
  • columns - fixed metadata columns plus one column per survey question (question code when set, otherwise q_{question_id}).
  • rows - flat objects keyed by column name (no nested answers[]).
  • meta - pagination for full exports; use since for incremental refresh in custom queries.

5. Power BI Desktop (manual)

  1. Get dataWeb.
  2. Choose Advanced and paste the export URL (add ?page=1&per_page=100 if needed).
  3. Add header X-External-Access-Token with your token.
  4. Expand datarows, or use the Power Query snippet below (recommended - loads all pages automatically).

6. Power Query (M) - all pages

Replace {short_code} and {your_token}. This matches the snippet generated in the CXM portal dialog.

Power Query
powerquery
let
    // Step 1: Define API base URL
    baseUrl = "https://api-cxm.akwad.sa/api/v1/integrations/surveys/{short_code}/responses/export",

    // Step 2: Define headers with your token
    headers = [
        #"Content-Type" = "application/json",
        #"X-External-Access-Token" = "{your_token}"
    ],

    // Step 3: Set up request options
    options = [
        Headers = headers,
        ManualStatusHandling = {400, 401, 403, 404}
    ],

    // Step 4: Fetch and expand a single page
    GetPage = (page as number) as table =>
    let
        pageUrl = baseUrl & "?page=" & Number.ToText(page) & "&per_page=100",
        response = Web.Contents(pageUrl, options),
        json = Json.Document(response),
        data = json[data],
        columnsList = data[columns],
        rows = data[rows],
        toTable = Table.FromList(rows, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
        expanded = Table.ExpandRecordColumn(toTable, "Column1", columnsList, columnsList)
    in
        expanded,

    // Step 5: Read total pages from the first page
    firstJson = Json.Document(Web.Contents(baseUrl & "?page=1&per_page=100", options)),
    lastPage = try firstJson[data][meta][last_page] otherwise 1,
    safeLastPage = if lastPage < 1 then 1 else lastPage,

    // Step 6: Fetch all pages and combine rows
    pages = List.Numbers(1, safeLastPage),
    #"Combined Pages" = Table.Combine(List.Transform(pages, each GetPage(_)))
in
    #"Combined Pages"

Power BI Desktop privacy

If prompted about privacy levels, set the API endpoint to Organizational or adjust privacy settings so Web.Contents can combine pages.

7. Security and PII

  • Treat your external access token like a password. Rotate it from Profile if it is exposed.
  • Set include_pii=false when email, phone, or IP are not required in reports.
  • Export access follows the same workspace permissions as viewing the survey in the portal.

AKWAD CXM - help center