# Get a dashboard theme

Gets a dashboard theme from a DataView.

Adam Robertson · Updated 20 November 2026 · [Dashboard themes](<https://help.apteco.com/en/admin/orbit-api/?category=Dashboard themes>)[Dashboards](<https://help.apteco.com/en/admin/orbit-api/?category=Dashboards>)

## How it works

Uses a valid access token to GET a dashboard theme from `/{dataViewName}/Themes/{themeId}`.

## Before you start

You need:

- The base URL of the Orbit API (see [Find your API URLs](<https://help.apteco.com/en/admin/orbit-api/getting-started/#find-your-api-urls>))
- An access token, from [Log in and get an access token](<https://help.apteco.com/en/admin/orbit-api/cookbook/login/index.md>)

This script works on its own: download it, plus `Login.ps1` to get an access token.

## Parameters

| Parameter | Description |
| --- | --- |
| `-BaseUrl` | The base URL of the Orbit API, for example `https://example.com/OrbitAPI` |
| `-DataViewName` | The name of the DataView to act on, for example `holidays` |
| `-AccessToken` | A valid access token (gained from the `Login.ps1` script) to authenticate with. |
| `-ThemeId` | The ID of the dashboard theme to retrieve. |

## Example

PowerShell

```powershell
.\GetDashboardTheme.ps1 `
    -BaseUrl "https://example.com/OrbitAPI" `
    -DataViewName "holidays" `
    -AccessToken "your_access_token_here" `
    -ThemeId 12345
```

## Script

The script from the repository at commit `b732915`. Its built-in help is left out here, because this page shows it above. The download and the copy on GitHub include it.

> [!WARNING]
>
> Apteco provides these scripts as examples only. They're not officially supported. Review each script and test it on a non-production system before you run it against live data.

PowerShell

```powershell
[CmdletBinding()]
param (
    [Parameter(Mandatory = $true)]
    [string]$BaseUrl,

    [Parameter(Mandatory = $true)]
    [string]$DataViewName,

    [Parameter(Mandatory = $true)]
    [string]$AccessToken,

    [Parameter(Mandatory = $true)]
    [int]$ThemeId
)

# ---------------------------------------------------------------------------
# Helper: exit with a clear error message
# ---------------------------------------------------------------------------
function Stop-WithError {
    param([string]$Message)
    Write-Error $Message
    exit 1
}

# ---------------------------------------------------------------------------
# Get the dashboard theme
# ---------------------------------------------------------------------------
$themeUrl  = "$BaseUrl/$DataViewName/Themes/$ThemeId"

Write-Host "Getting dashboard theme..." -ForegroundColor Cyan

$headers = @{
    Authorization = "Bearer $AccessToken"
}

try {
    $themeResponse = Invoke-RestMethod `
        -Uri         $themeUrl `
        -Method      GET `
        -ContentType 'application/json' `
        -Headers     $headers `
        -ErrorAction Stop
}
catch {
    $statusCode = if ($_.Exception.Response) { $_.Exception.Response.StatusCode.value__ } else { $null }
    $errorBody  = if ($_.ErrorDetails) { $_.ErrorDetails.Message } else { $null }
    Stop-WithError "Dashboard GET failed (HTTP $statusCode). Response: $errorBody`nError: $_"
}

$themeResponse | ConvertTo-Json -Depth 10

Write-Host "Got dashboard theme $($themeResponse.id): $($themeResponse.name)" -ForegroundColor Green
```
