> ## Documentation Index
> Fetch the complete documentation index at: https://docs.usedatabrain.com/llms.txt
> Use this file to discover all available pages before exploring further.

# List Data Apps

> Retrieve a list of all Data Apps in your organization with their embed configurations.

Get a comprehensive list of all Data Apps in your organization, including their embed configurations, creation timestamps, and embed counts.

<Note>
  This endpoint returns all Data Apps of type "embedded" in your organization. Each Data App includes summary information about its associated embeds.
</Note>

<Warning>
  **Authentication Requirement:** This endpoint requires a **service token** (not a data app API key). Service tokens have elevated permissions to manage Data Apps across your organization.
</Warning>

## Endpoint Formats

<Tabs>
  <Tab title="New Endpoint (Recommended)">
    ```
    GET https://api.usedatabrain.com/api/v2/data-app
    ```

    **Use this endpoint** for all new integrations. This is the recommended endpoint format.
  </Tab>

  <Tab title="Legacy Endpoint (Deprecated Soon)">
    ```
    GET https://api.usedatabrain.com/api/v2/dataApp
    ```

    This endpoint still works but will be deprecated. Please migrate to the new endpoint format.
  </Tab>
</Tabs>

## Authentication

This endpoint requires a service token in the Authorization header. Service tokens differ from data app API keys and provide organization-level permissions.

To access your service token:

1. In **Settings** page, navigate to the **Service Tokens** section.
2. Click the **"Generate Token"** button to create a new service token if you don't have one already.

Use this token as the Bearer value in your Authorization header.

## Headers

<ParamField header="Authorization" type="string" required>
  Bearer token for API authentication. Use your service token (not data app API key).

  ```
  Authorization: Bearer service_token_xyz...
  ```
</ParamField>

## Query Parameters

<ParamField query="isPagination" type="string">
  Whether to paginate results. Pass `"true"` to enable pagination with a limit of 10 per page.

  **Note:** Query parameters are passed as strings. Use `"true"` or `"false"`.
</ParamField>

<ParamField query="pageNumber" type="string">
  Page number to retrieve (1-based). Only used when isPagination is `"true"`. Must be a numeric string (e.g., `"1"`, `"2"`).
</ParamField>

## Response

<ResponseField name="data" type="array">
  Array of Data App objects with their configuration details.
</ResponseField>

<ResponseField name="data[].name" type="string">
  The name of the Data App.
</ResponseField>

<ResponseField name="data[].type" type="string">
  The type of the Data App. Currently always `"embedded"`.
</ResponseField>

<ResponseField name="data[].createdAt" type="string">
  ISO 8601 formatted timestamp indicating when the Data App was created.
</ResponseField>

<ResponseField name="data[].updatedAt" type="string">
  ISO 8601 formatted timestamp indicating when the Data App was last updated.
</ResponseField>

<ResponseField name="data[].embedCount" type="number">
  The total number of embed configurations associated with this Data App.
</ResponseField>

<ResponseField name="data[].embeds" type="array">
  Array of embed configurations associated with this Data App.

  <Expandable title="embed properties">
    <ResponseField name="name" type="string">
      The name of the embed configuration.
    </ResponseField>

    <ResponseField name="embedId" type="string">
      The unique identifier for the embed configuration.
    </ResponseField>

    <ResponseField name="createdAt" type="string">
      ISO 8601 formatted timestamp indicating when the embed was created.
    </ResponseField>

    <ResponseField name="updatedAt" type="string">
      ISO 8601 formatted timestamp indicating when the embed was last updated.
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="error" type="object">
  Error object returned only when the request fails. Not included in successful responses.

  <Expandable title="error properties">
    <ResponseField name="code" type="string">
      Error code identifying the type of error.
    </ResponseField>

    <ResponseField name="message" type="string">
      Human-readable error message describing what went wrong.
    </ResponseField>
  </Expandable>
</ResponseField>

## Examples

<Panel>
  <RequestExample>
    ```bash cURL - Get All Data Apps theme={"dark"}
    curl --request GET \
      --url 'https://api.usedatabrain.com/api/v2/data-app' \
      --header 'Authorization: Bearer service_token_xyz...'
    ```

    ```bash cURL - With Pagination theme={"dark"}
    curl --request GET \
      --url 'https://api.usedatabrain.com/api/v2/data-app?isPagination=true&pageNumber=1' \
      --header 'Authorization: Bearer service_token_xyz...'
    ```

    ```javascript Node.js icon="fa-brands fa-node-js" theme={"dark"}
    const response = await fetch('https://api.usedatabrain.com/api/v2/data-app', {
      method: 'GET',
      headers: {
        'Authorization': 'Bearer service_token_xyz...'
      }
    });

    const data = await response.json();
    console.log('Found Data Apps:', data.data.length);

    data.data.forEach(app => {
      console.log(`- ${app.name} (${app.embedCount} embeds)`);
    });
    ```

    ```python Python icon="fa-brands fa-python" theme={"dark"}
    import requests

    url = "https://api.usedatabrain.com/api/v2/data-app"
    headers = {
        "Authorization": "Bearer service_token_xyz..."
    }
    params = {
        "isPagination": "true",
        "pageNumber": "1"
    }

    response = requests.get(url, headers=headers, params=params)
    data = response.json()

    print(f"Found Data Apps: {len(data['data'])}")
    for app in data['data']:
        print(f"- {app['name']} ({app['embedCount']} embeds)")
    ```

    ```java Java icon="fa-brands fa-java" theme={"dark"}
    import java.net.http.HttpClient;
    import java.net.http.HttpRequest;
    import java.net.http.HttpResponse;
    import java.net.URI;

    public class ListDataApps {
        public static void main(String[] args) throws Exception {
            HttpClient client = HttpClient.newHttpClient();
            
            String url = "https://api.usedatabrain.com/api/v2/data-app" +
                "?isPagination=true&pageNumber=1";
            
            HttpRequest request = HttpRequest.newBuilder()
                .uri(URI.create(url))
                .header("Authorization", "Bearer service_token_xyz...")
                .GET()
                .build();
                
            HttpResponse<String> response = client.send(request, 
                HttpResponse.BodyHandlers.ofString());
                
            System.out.println("Response: " + response.body());
        }
    }
    ```

    ```go Go icon="fa-brands fa-golang" theme={"dark"}
    package main

    import (
        "encoding/json"
        "fmt"
        "net/http"
        "net/url"
    )

    type Embed struct {
        Name      string `json:"name"`
        EmbedId   string `json:"embedId"`
        CreatedAt string `json:"createdAt"`
        UpdatedAt string `json:"updatedAt"`
    }

    type DataApp struct {
        Name       string  `json:"name"`
        Type       string  `json:"type"`
        CreatedAt  string  `json:"createdAt"`
        UpdatedAt  string  `json:"updatedAt"`
        EmbedCount int     `json:"embedCount"`
        Embeds     []Embed `json:"embeds"`
    }

    type ListDataAppsResponse struct {
        Data  []DataApp   `json:"data"`
        Error interface{} `json:"error"`
    }

    func main() {
        baseURL := "https://api.usedatabrain.com/api/v2/data-app"
        params := url.Values{}
        params.Add("isPagination", "true")
        params.Add("pageNumber", "1")
        
        fullURL := fmt.Sprintf("%s?%s", baseURL, params.Encode())
        
        req, _ := http.NewRequest("GET", fullURL, nil)
        req.Header.Set("Authorization", "Bearer service_token_xyz...")
        
        client := &http.Client{}
        resp, err := client.Do(req)
        if err != nil {
            panic(err)
        }
        defer resp.Body.Close()
        
        var result ListDataAppsResponse
        json.NewDecoder(resp.Body).Decode(&result)
        
        fmt.Printf("Found Data Apps: %d\n", len(result.Data))
        for _, app := range result.Data {
            fmt.Printf("- %s (%d embeds)\n", app.Name, app.EmbedCount)
        }
    }
    ```

    ```php PHP icon="fa-brands fa-php" theme={"dark"}
    <?php
    $params = http_build_query([
        'isPagination' => 'true',
        'pageNumber' => '1'
    ]);

    $url = 'https://api.usedatabrain.com/api/v2/data-app?' . $params;

    $options = [
        'http' => [
            'header' => 'Authorization: Bearer service_token_xyz...',
            'method' => 'GET'
        ]
    ];

    $context = stream_context_create($options);
    $result = file_get_contents($url, false, $context);
    $response = json_decode($result, true);

    echo "Found Data Apps: " . count($response['data']) . "\n";
    foreach ($response['data'] as $app) {
        echo "- " . $app['name'] . " (" . $app['embedCount'] . " embeds)\n";
    }
    ?>
    ```

    ```ruby Ruby icon="fa-solid fa-gem" theme={"dark"}
    require 'net/http'
    require 'json'

    uri = URI('https://api.usedatabrain.com/api/v2/data-app')
    params = { isPagination: 'true', pageNumber: '1' }
    uri.query = URI.encode_www_form(params)

    http = Net::HTTP.new(uri.host, uri.port)
    http.use_ssl = true

    request = Net::HTTP::Get.new(uri)
    request['Authorization'] = 'Bearer service_token_xyz...'

    response = http.request(request)
    result = JSON.parse(response.body)

    puts "Found Data Apps: #{result['data'].length}"
    result['data'].each do |app|
      puts "- #{app['name']} (#{app['embedCount']} embeds)"
    end
    ```
  </RequestExample>

  <ResponseExample>
    ```json 200 - Success theme={"dark"}
    {
      "data": [
        {
          "name": "Customer Portal Analytics",
          "type": "embedded",
          "createdAt": "2024-01-15T10:30:00Z",
          "updatedAt": "2024-01-20T14:45:00Z",
          "embedCount": 3,
          "embeds": [
            {
              "name": "Sales Dashboard Embed",
              "embedId": "sales-dashboard-123",
              "createdAt": "2024-01-15T11:00:00Z",
              "updatedAt": "2024-01-18T09:30:00Z"
            },
            {
              "name": "Revenue Metrics Embed",
              "embedId": "revenue-metrics-456",
              "createdAt": "2024-01-16T14:15:00Z",
              "updatedAt": "2024-01-19T16:00:00Z"
            },
            {
              "name": "Customer Overview",
              "embedId": "customer-overview-789",
              "createdAt": "2024-01-17T08:45:00Z",
              "updatedAt": "2024-01-20T11:20:00Z"
            }
          ]
        },
        {
          "name": "Partner Dashboard",
          "type": "embedded",
          "createdAt": "2024-01-10T09:00:00Z",
          "updatedAt": "2024-01-15T12:30:00Z",
          "embedCount": 1,
          "embeds": [
            {
              "name": "Partner Analytics",
              "embedId": "partner-analytics-001",
              "createdAt": "2024-01-10T10:00:00Z",
              "updatedAt": "2024-01-15T12:30:00Z"
            }
          ]
        }
      ]
    }
    ```

    ```json 400 - Invalid Service Token theme={"dark"}
    {
      "error": {
        "code": "AUTHENTICATION_ERROR",
        "message": "Invalid Service Token"
      }
    }
    ```

    ```json 500 - Internal Server Error theme={"dark"}
    {
      "error": {
        "code": "INTERNAL_SERVER_ERROR",
        "message": "INTERNAL_SERVER_ERROR"
      }
    }
    ```
  </ResponseExample>
</Panel>

## HTTP Status Code Summary

| Status Code | Description                                       |
| ----------- | ------------------------------------------------- |
| `200`       | **OK** - Data Apps retrieved successfully         |
| `400`       | **Bad Request** - Invalid request parameters      |
| `500`       | **Internal Server Error** - Server error occurred |

## Possible Errors

| Error Code              | HTTP Status | Description                      |
| ----------------------- | ----------- | -------------------------------- |
| `AUTHENTICATION_ERROR`  | 400         | Invalid or missing service token |
| `INTERNAL_SERVER_ERROR` | 500         | Server error                     |

## Quick Start Guide

<Steps>
  <Step title="Get your service token">
    In **Settings** page, navigate to the **Service Tokens** section. Click the **"Generate Token"** button to create a new service token if you don't have one already.
  </Step>

  <Step title="List all Data Apps">
    Make a GET request to retrieve all Data Apps:

    ```bash theme={"dark"}
    curl --request GET \
      --url 'https://api.usedatabrain.com/api/v2/data-app' \
      --header 'Authorization: Bearer service_token_xyz...'
    ```
  </Step>

  <Step title="Use pagination for large lists">
    If you have many Data Apps, use pagination:

    ```bash theme={"dark"}
    curl --request GET \
      --url 'https://api.usedatabrain.com/api/v2/data-app?isPagination=true&pageNumber=1' \
      --header 'Authorization: Bearer service_token_xyz...'
    ```
  </Step>

  <Step title="Process the results">
    Use the response to manage your Data Apps:

    ```javascript theme={"dark"}
    const dataApps = await listDataApps();

    dataApps.data.forEach(app => {
      console.log(`Data App: ${app.name}`);
      console.log(`  Type: ${app.type}`);
      console.log(`  Embeds: ${app.embedCount}`);
      console.log(`  Created: ${app.createdAt}`);
      
      app.embeds.forEach(embed => {
        console.log(`    - ${embed.name} (${embed.embedId})`);
      });
    });
    ```
  </Step>
</Steps>

## Next Steps

<CardGroup cols={2}>
  <Card title="Create Data App" icon="plus" href="/developer-docs/helpers/api-reference/create-data-app">
    Create new Data Apps for your organization
  </Card>

  <Card title="Delete Data App" icon="trash" href="/developer-docs/helpers/api-reference/delete-data-app">
    Remove Data Apps you no longer need
  </Card>

  <Card title="Create API Token" icon="key" href="/developer-docs/helpers/api-reference/create-api-token">
    Generate API tokens for your Data Apps
  </Card>

  <Card title="List API Tokens" icon="list" href="/developer-docs/helpers/api-reference/list-api-tokens">
    View API tokens for a specific Data App
  </Card>
</CardGroup>
