Skip to content

Commit dabf49a

Browse files
Add service accounts documentation (#267)
* Update self-host/customize-deployment/service-accounts.mdx Co-Authored-By: mintlify[bot] <109931778+mintlify[bot]@users.noreply.github.com> * Update docs.json Co-Authored-By: mintlify[bot] <109931778+mintlify[bot]@users.noreply.github.com> * updated & moved zservice account docs --------- Co-authored-by: mintlify[bot] <109931778+mintlify[bot]@users.noreply.github.com> Co-authored-by: Jess Hitchcock <jessica.kaari.hitchcock@gmail.com>
1 parent 2947e3f commit dabf49a

File tree

3 files changed

+62
-24
lines changed

3 files changed

+62
-24
lines changed

docs.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,7 @@
159159
"references/spaces",
160160
"guides/pinning",
161161
"references/personal_tokens",
162+
"references/service-accounts",
162163
"references/personal-warehouse-connections",
163164
{
164165
"group": "Admin",

images/new-service-account.jpg

25.3 KB
Loading

references/service-accounts.mdx

Lines changed: 61 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -3,46 +3,83 @@ title: "Service accounts"
33
description: "Service accounts provide a userless alternative to Personal Access Tokens (PATs) when working with the Lightdash CLI or the API. They are created and managed at the organization level, can be assigned granular scopes, and remain valid even if the administrator who created them leaves the organization."
44
---
55

6+
<Info>
7+
Service accounts require an **Enterprise License Key**.
8+
</Info>
9+
10+
## Overview
11+
12+
Service accounts provide machine-to-machine authentication for automated access to the Lightdash API. Unlike personal access tokens which are tied to individual users, service accounts are organization-level entities designed for applications, CI/CD pipelines, and automated workflows.
13+
14+
Service accounts allow you to:
15+
16+
- Authenticate API requests without using personal user credentials
17+
- Grant specific permission scopes (read, edit, or admin)
18+
- Set expiration dates for tokens
19+
20+
## Enabling service accounts (self-hosted only)
21+
22+
If you're self-hosting Lightdash, you will need to add the following environment variable to your configuration:
23+
24+
```bash
25+
SERVICE_ACCOUNT_ENABLED=true
26+
```
27+
28+
After enabling, restart your Lightdash instance for the change to take effect.
29+
630
## Creating a Service Account
731

832
1. Navigate to **General Settings****Service Accounts**
933
2. Click **Add Service Account**
1034

11-
![Screenshot from 2025-06-20 09-05-15.png](/images/Screenshotfrom2025-06-2009-05-15.png)
12-
3. Enter a **Description** optional **Expiry**
35+
![New Service Account](/images/new-service-account.jpg)
36+
3. Enter a **Description** and optional **Expiry**
1337
4. Select one or more **Scopes** to grant
1438
5. Click **Create service account**
15-
6. **Copy** the generated token. This is the only time it will be shown. All service accounts tokens will be prefixed with `ldsvc_`
16-
7. Use it to login on the CLI using _``lightdash login https://your-lightdash-cloud --token your-token``_
17-
8. Or in the API like
18-
19-
```
20-
GET https://your-lightdash-cloud/api/v1/org/projects
21-
Authorization: Bearer ldsvc_9649663ed1f1897221da9d8db09b961f
22-
```
39+
6. **Copy** the generated token. This is the only time it will be shown. All service account tokens will be prefixed with `ldsvc_`
2340

2441
## Scopes
2542

26-
> Scopes are hierarchical: granting a higher-level scope (e.g. `org:admin`) automatically includes all lower-level permissions (e.g. `org:edit`, `org:view`).
43+
Scopes are hierarchical - granting a higher-level scope (e.g. `org:admin`) automatically includes all lower-level permissions (e.g. `org:edit`, `org:view`).
2744

2845
| Scope | Description |
2946
| ----------- | --------------------------------------------------------------------------------------------------------------------------------------------- |
30-
| `org:admin` | Full organization-level control. Includes deploy, preview, download/upload, user-management, **and** all `org:edit` & `org:view` permissions. |
31-
| `org:edit` | Can create/modify Lightdash content (charts and dashboards), **and** all `org:view` permissions. |
3247
| `org:view` | Read-only access to Lightdash content. |
48+
| `org:edit` | Can create/modify Lightdash content (charts and dashboards), **and** all `org:view` permissions. |
49+
| `org:admin` | Full organization-level control. Includes deploy, preview, download/upload, user-management, **and** all `org:edit` & `org:view` permissions. |
50+
51+
## Using service accounts
52+
53+
### With Lightdash CLI
54+
55+
You can use service account tokens to authenticate with the Lightdash CLI:
56+
57+
```bash
58+
lightdash login https://your-lightdash-cloud --token ldsvc_your-token
59+
```
60+
61+
### With the API
62+
63+
Service account tokens use the `Authorization` header:
64+
65+
```bash
66+
curl -H "Authorization: ldsvc_abc123xyz..." \
67+
"$LIGHTDASH_URL/api/v1/..."
68+
```
69+
70+
For full API documentation, see the [API Reference](/api-reference/v1/introduction).
71+
72+
## Example Use cases
73+
74+
### CI/CD automation
75+
76+
Use service accounts to automatically deploy dbt changes to Lightdash in your CI/CD pipeline. See [deploying with GitHub Actions](https://docs.lightdash.com/references/dbt-projects#1-automatically%3A-deploy-your-changes-to-lightdash-using-a-github-action) for implementation details.
3377

34-
## Use cases
78+
### Instance initialization
3579

36-
### I want to create a service account to refresh my dbt changes on Lightdash on CI
80+
When setting up a new self-hosted instance, configure `LD_SETUP_SERVICE_ACCOUNT_TOKEN` to initialize with a service account. See the [environment variables guide](https://docs.lightdash.com/self-host/customize-deployment/environment-variables#initialize-instance) for details.
3781

38-
1. Create a service account (see above)
39-
2. Create a CI pipeline using [github actions](https://docs.lightdash.com/references/dbt-projects#1-automatically%3A-deploy-your-changes-to-lightdash-using-a-github-action)
40-
3. Make sure you change the `yaml` on github to use your service account token _``lightdash login https://your-lightdash-cloud --token your-token``_
82+
### Automated reporting
4183

42-
### I want to create a new instance using service accounts
84+
Use service accounts to programmatically export dashboard data, schedule reports, or integrate Lightdash data into other systems via the API.
4385

44-
1. Follow [this guide to initialize an instance using environment variables](https://docs.lightdash.com/self-host/customize-deployment/environment-variables#initialize-instance)
45-
2. Make sure you configure the `LD_SETUP_SERVICE_ACCOUNT_TOKEN` (must start with the prefix `ldsvc_`)
46-
3. Initialize instance
47-
4. Login on the CLI using this token _``lightdash login https://your-lightdash-cloud --token your-token``_
48-
5. Update content from templates using `lighdash upload`

0 commit comments

Comments
 (0)