# Get Analytics Data Source

Get one of the creator's data sources in full: the app, action, connection, arguments, options and query a sync or live source fetches with; the inputs and code of a merge; the data a fixed source holds; its refresh schedule and incremental refreshes; and its latest fetch. Send what you change back to Update Analytics Data Source.

`GET https://connect.mindcloud.co/v2/analytics/data-sources/:dataSourceId`

Permissions: `analytics:page:view`.

## Parameters

### Path

- `dataSourceId` (string, required): The data source id, from List Analytics Data Sources.

### Headers

- `X-Company-Id` (string): Optional. The id of the organization to act in. Leave it out to act in the API key's own organization. Here a key acts in another organization only as one of its members: with "Use this key across all of your organizations" on, in an organization its creator belongs to with a role. Child organizations and MindCloud staff access do not reach this endpoint. Every response's X-Company-Id header names the organization it acted in. See [Organizations](https://mindcloud.co/docs/api/rest/introduction/organizations).

## Example request

```bash
curl --request GET \
  --url 'https://connect.mindcloud.co/v2/analytics/data-sources/Ds3Hq9Lp2WxM' \
  --header 'Authorization: Bearer $MINDCLOUD_API_TOKEN'
```

## Response fields

- `id` (string): The data source's id.
- `name` (string): The data source's name.
- `description` (string): What the data holds, in a sentence.
- `createdBy` (string): The userId of the member who created it, from List Members: the key's creator for their own sources.
- `type` (string): sync: fetched from an app action on a schedule and stored; live: fetched from an app action when a drill-down opens, with its values, and never stored; merge: combines other sources with SQL and code; fixed: rows you supply, never refetched.
  Allowed values:
    - `sync`
    - `live`
    - `merge`
    - `fixed`
- `appId` (string): The app a sync or live source fetches from, from List Universal Apps. Null for merge and fixed sources.
- `actionId` (string): The app action it fetches with, from List Universal Actions. Null for merge and fixed sources.
- `actionName` (string): The app action's name.
- `connectionId` (string): The connection it fetches with, from List Connections. Null for merge and fixed sources.
- `status` (string): Where its data stands. live: a live source, which has no stored data; neverFetched: no fetch has run yet; noData: a fixed source with no rows yet; draft: waiting for its first fetch; queued: a fetch is waiting to start; refreshing: a fetch is running; ready: its rows are stored; empty: the last fetch returned no rows; failed: the last fetch failed (see message).
  Allowed values:
    - `live`
    - `neverFetched`
    - `noData`
    - `draft`
    - `queued`
    - `refreshing`
    - `ready`
    - `empty`
    - `failed`
- `rowCount` (number): How many rows the last fetch stored.
- `fetchedOn` (date): When the stored rows were fetched.
- `message` (string): Why the last fetch failed, when it did.
- `refreshIntervalSeconds` (number): How often a sync or merge source refreshes in full, in seconds. Null for live and fixed sources.
- `isIncrementalEnabled` (boolean): For a sync source, whether incremental refreshes (fetching only changed records between full refreshes) are switched on. Null for other types.
- `incrementalIntervalSeconds` (number): How often incremental refreshes run, in seconds, while they run. Null otherwise.
- `isPaused` (boolean): True when every page that uses it is paused or deleted, so its scheduled refresh is skipped.
- `panelCount` (number): How many panels on its owner's pages read it.
- `isUnused` (boolean): True when no panel reads it and it has not changed for a day: the sources the app's cleanup offers to delete.
- `createdOn` (date): When it was created.
- `updatedOn` (date): When it last changed.
- `appVersion` (string): The app version a sync or live source is pinned to.
- `latestAppVersion` (string): The app's current published version, when the source is pinned to an older one. Null when it is current.
- `arguments` (object): The action's arguments, as stored: each value in its stored form. Send them back as they are, or as plain values. Null for merge and fixed sources.
- `options` (object): The action's options, such as pagination. Null for merge and fixed sources.
- `query` (object): The filter and sort the app applies before the rows are stored: { filter, sort }. Null when there is none.
- `inputs` (array of objects): For a merge source, the sources it combines. Null for other types.
  - `dataSourceId` (string): The input source, from List Analytics Data Sources.
  - `alias` (string): The name the merge SQL and code read this input by.
  - `query` (string): The SQL that shapes this input, reading it as `src`. Empty when it is used as is.
- `transformCode` (string): For a merge source, the code that combines its inputs. Null for other types.
- `file` (object): For a fixed source, the data it holds. Null for other types, or before any data is stored.
  - `origin` (string): Where the rows came from. rows: rows sent in a request; attachment: an uploaded file; tableEditor: an edit to the table.
    Allowed values:
      - `rows`
      - `attachment`
      - `tableEditor`
  - `filename` (string): The file's name, or the label given to rows sent in a request.
  - `format` (string): The file format, such as csv, xlsx or json.
  - `mimeType` (string): The file's media type.
  - `sizeBytes` (number): The size of the stored data in bytes.
  - `uploadedOn` (date): When the data was stored.
  - `rowCount` (number): How many rows the data holds.
  - `sheetName` (string): For a spreadsheet, the sheet the rows are read from.
  - `useHeader` (boolean): For a spreadsheet, whether its first row holds the column names.
  - `removeTopRows` (number): For a spreadsheet, how many rows above the header are skipped.
- `dateKeys` (object): Which columns hold dates, for page date filters. Null until they are known.
  - `primaryDateKey` (string): The column page date filters use for this source.
  - `primaryDateKeyGrain` (string): The primary date column's grain: day for dates, timestamp for dates with times.
  - `createdDateKey` (string): The column holding when each record was created.
  - `updatedDateKey` (string): The column holding when each record last changed.
  - `hasNoDates` (boolean): True when the source has no date column.
- `isIncrementalActive` (boolean): For a sync source, whether incremental refreshes actually run: switched on, and the source can fetch only changed records. Null for other types.
- `incremental` (object): For a sync source, how it fetches only changed records. Null when that was never set up.
  - `status` (string): Whether this source can fetch only changed records. active: it can; unavailable: it cannot.
    Allowed values:
      - `active`
      - `unavailable`
  - `dedupKey` (array): The field paths that identify a record, used to replace changed records.
  - `sinceArguments` (object): The extra action arguments that ask the app for records changed since the last check.
  - `catches` (string): What the change check finds. newAndChanged: new and edited records; newOnly: new records only.
    Allowed values:
      - `newAndChanged`
      - `newOnly`
  - `overlapSeconds` (number): How far back before the last check each check looks, in seconds.
  - `reason` (string): Why changed records cannot be fetched, when status is unavailable.
  - `checkedOn` (date): When these details were last checked against the source.
- `coverage` (object): For a sync source, how much time its stored rows span. Null when not measured.
  - `code` (string): The coverage verdict, such as COVERED, TRUNCATED or FILTER_NOT_APPLIED.
  - `level` (string): How the verdict reads: ok, info or warn.
    Allowed values:
      - `ok`
      - `info`
      - `warn`
  - `message` (string): The verdict in words.
  - `coverageFrom` (date): The earliest record date the data holds.
  - `coverageTo` (date): The latest record date the data holds.
