# Data Health & Insights API

The Data Health & Insights API lets you extract client data from your Dext account programmatically. It's a RESTful API that returns JSON responses and uses token-based authentication.

To start making requests, you'll need an HTTP client. [Postman](https://www.getpostman.com/downloads/) is a free, ready-to-use option.

**Note:** API tokens are personal. Tokens you create apply to your account only and don't affect other team members.

---

# Managing API tokens

API tokens are created and managed in **Practice settings**. Select **Data Health** in the left navigation, then select **API tokens**.

## Creating a token

1. Enter a name in the **Token Name** field and select **Create**.

2. Your token is displayed once in the **Authentication token** modal. Select **Copy to Clipboard** to copy it.

**Important:** This is the only time the token value is shown. Store it somewhere secure before closing the modal — it can't be retrieved afterwards.

![Data Health API tokens page showing a Token Name field, Create button, and a token listed in the table with cog and delete icons](https://downloads.intercomcdn.eu/i/o/weauzzxo/134814661/37117091645355a777fcd1af83af/image.png?expires=1790962200&amp;signature=ce46875b5d33f75b4ad41bab7358eafb48208f0dbdd975418f71912b82582a50&amp;req=0dZrzVn%2BqjEplxv889ospwJwFNQCR9QJ7fkPhWjHZaILp3dckKswEzcFL3DM%0ADImUM4kK2fOw8CDIKg%3D%3D%0A)

## Renaming a token

Select the cog icon next to a token to open the **Edit token name** modal. Enter a new name and select **Update**.

## Deleting a token

Select the X icon next to a token and confirm by selecting **Delete token**. Deleted tokens are immediately rejected for all API requests.

---

# Authentication

Pass your token in the request header of every API call:

```
Authorization: Bearer <your token>
```

---

# Rate limits

The API is rate-limited to 60 requests per minute. If you exceed this, requests are rejected with an `HTTP 429 Too Many Requests` response. Rate limit details are returned in the response header:

| Key                   | Value                                    |
| --------------------- | ---------------------------------------- |
| X-RateLimit-Limit     | 60                                       |
| X-RateLimit-Remaining | Remaining requests in the current window |

---

# Response codes

| Code | Meaning                                                   |
| ---- | --------------------------------------------------------- |
| 200  | Request accepted and processed successfully               |
| 404  | The requested resource couldn't be found                  |
| 429  | Rate limit exceeded                                       |
| 500  | Server-side error — contact Dext support if this persists |

---

# API endpoints

Base URL: `https://api.precision.dext.com/`

## GET /clients

Returns a summarised list of all clients the token has access to.

**Request:** `https://api.precision.dext.com/clients`

**Response model:**

```
[
  {
    "id": "string",
    "name": "string",
    "practiceCode": "string",
    "providerId": "string",
    "healthScore": integer,
    "alertLevel": "string"
  }
]
```

**Example response:**

```
[
  {
    "id": "loXZq",
    "name": "Demo Company (NZ)",
    "practiceCode": null,
    "providerId": "!-1Tsc",
    "healthScore": 78,
    "alertLevel": "success"
  },
  {
    "id": "qK2Bl",
    "name": "Demo Company Main (UK)",
    "practiceCode": null,
    "providerId": "!jxJgV",
    "healthScore": 52,
    "alertLevel": "warning"
  }
]
```

---

## GET /clients/{clientId}

Returns detailed information about a specific client, including calculated metrics.

**Request:** `https://api.precision.dext.com/clients/{clientId}`

**Response model:**

```
{
  "id": "string",
  "name": "string",
  "providerId": "string",
  "practiceCode": "string",
  "organisationType": "string",
  "companyNumber": "string",
  "healthScore": integer,
  "alertLevel": "string",
  "hmrcStatus": "string",
  "yearEnd": "string",
  "vatDetails": {
    "scheme": "string",
    "number": "string",
    "reportingCycle": "string",
    "periodStart": "string",
    "periodEnd": "string"
  },
  "metrics": {
    "debtorBalance": float,
    "avgDebtorDays": integer,
    "oneDayImpact": float
  },
  "bankReconciliation": {
    "bankAccounts": integer,
    "manualFeeds": integer
  }
}
```

**Example response:**

```
{
  "id": "8r2W8",
  "name": "Demo Company Main (UK)",
  "providerId": "!F-5MP",
  "practiceCode": null,
  "organisationType": "COMPANY",
  "companyNumber": "02181833",
  "healthScore": 71,
  "alertLevel": "success",
  "hmrcStatus": "NOT_CONNECTED",
  "yearEnd": "2021-03-31",
  "vatDetails": {
    "scheme": "CASH",
    "number": "GB 123456789",
    "reportingCycle": "QUARTERLY",
    "periodStart": "2020-07-01",
    "periodEnd": "2020-09-30"
  },
  "metrics": {
    "debtorBalance": 8952.45,
    "avgDebtorDays": 96,
    "oneDayImpact": 93.25
  },
  "bankReconciliation": {
    "bankAccounts": 2,
    "manualFeeds": 1
  }
}
```

---

## GET /clients/{clientId}/activity-stats

Returns rolling annual, monthly average, and quarterly average activity stats for a specific client.

**Request:** `https://api.precision.dext.com/clients/{clientId}/activity-stats`

**Response model:**

```
{
  "annual": {
    "start": "string",
    "end": "string",
    "turnover": float,
    "salesCount": integer,
    "billsCount": integer,
    "creditsCount": integer,
    "manualJournalsCount": integer,
    "bankTransactionsCount": integer,
    "totalCount": integer,
    "turnoverChangeYoY": integer,
    "salesChangeYoY": integer,
    "billsChangeYoY": integer,
    "creditsChangeYoY": integer,
    "manualJournalsChangeYoY": integer,
    "bankTransactionsChangeYoY": integer,
    "totalChangeYoY": integer
  },
  "monthlyAverage": {
    "start": "string",
    "end": "string",
    "turnover": float,
    "salesCount": integer,
    "billsCount": integer,
    "creditsCount": integer,
    "manualJournalsCount": integer,
    "bankTransactionsCount": integer,
    "totalCount": integer,
    "turnoverChangeYoY": integer,
    "salesChangeYoY": integer,
    "billsChangeYoY": integer,
    "creditsChangeYoY": integer,
    "manualJournalsChangeYoY": integer,
    "bankTransactionsChangeYoY": integer,
    "totalChangeYoY": integer
  },
  "quarterlyAverage": {
    "start": "string",
    "end": "string",
    "turnover": float,
    "salesCount": integer,
    "billsCount": integer,
    "creditsCount": integer,
    "manualJournalsCount": integer,
    "bankTransactionsCount": integer,
    "totalCount": integer,
    "turnoverChangeMoM": integer,
    "salesChangeMoM": integer,
    "billsChangeMoM": integer,
    "creditsChangeMoM": integer,
    "manualJournalsChangeMoM": integer,
    "bankTransactionsChangeMoM": integer,
    "totalChangeMoM": integer,
    "turnoverChangeYoY": integer,
    "salesChangeYoY": integer,
    "billsChangeYoY": integer,
    "creditsChangeYoY": integer,
    "manualJournalsChangeYoY": integer,
    "bankTransactionsChangeYoY": integer,
    "totalChangeYoY": integer
  }
}
```

**Example response:**

```
{
  "annual": {
    "start": "2019-07-01",
    "end": "2020-06-30",
    "turnover": 28713.35,
    "salesCount": 33,
    "billsCount": 35,
    "creditsCount": 5,
    "manualJournalsCount": 1,
    "bankTransactionsCount": 69,
    "totalCount": 143,
    "turnoverChangeYoY": 6791.15,
    "salesChangeYoY": 3200,
    "billsChangeYoY": 0,
    "creditsChangeYoY": 0,
    "manualJournalsChangeYoY": 0,
    "bankTransactionsChangeYoY": 0,
    "totalChangeYoY": 14200
  },
  "monthlyAverage": {
    "start": "2019-07-01",
    "end": "2020-06-30",
    "turnover": 2392.78,
    "salesCount": 3,
    "billsCount": 3,
    "creditsCount": 0,
    "manualJournalsCount": 0,
    "bankTransactionsCount": 6,
    "totalCount": 12,
    "turnoverChangeYoY": 474.26,
    "salesChangeYoY": 200,
    "billsChangeYoY": 0,
    "creditsChangeYoY": 0,
    "manualJournalsChangeYoY": 0,
    "bankTransactionsChangeYoY": 0,
    "totalChangeYoY": 1100
  },
  "quarterlyAverage": {
    "start": "2020-04-01",
    "end": "2020-06-30",
    "turnover": 23329.99,
    "salesCount": 24,
    "billsCount": 25,
    "creditsCount": 5,
    "manualJournalsCount": 1,
    "bankTransactionsCount": 51,
    "totalCount": 106,
    "turnoverChangeMoM": 84.4,
    "salesChangeMoM": 60,
    "billsChangeMoM": 38.89,
    "creditsChangeMoM": 66.67,
    "manualJournalsChangeMoM": 0,
    "bankTransactionsChangeMoM": 112.5,
    "totalChangeMoM": 73.77,
    "turnoverChangeYoY": 5451.15,
    "salesChangeYoY": 2300,
    "billsChangeYoY": 0,
    "creditsChangeYoY": 0,
    "manualJournalsChangeYoY": 0,
    "bankTransactionsChangeYoY": 0,
    "totalChangeYoY": 10500
  }
}
```