/sigma-authoring:sigma-apifrom Sigma Authoring (Workbooks + Data Models)
Authenticate against the Sigma Computing REST API and obtain a bearer token. Use whenever the user wants to call the Sigma API directly with curl/HTTP, exchange OAuth client credentials for an access token, sign in interactively via a browser OAuth login (authorization-code + PKCE), configure SIGMA_BASE_URL / SIGMA_CLIENT_ID / SIGMA_CLIENT_SECRET, troubleshoot 401/403 responses, or pick the right Sigma API hostname for their cloud. Use as a prerequisite when another Sigma skill needs an SIGMA_API_TOKEN.
Ships in Sigma Authoring (Workbooks + Data Models). Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
Authenticate against the Sigma Computing REST API and obtain a bearer token. This skill is a prerequisite for any skill that calls the Sigma API directly with curl.
The preferred get-token.sh path uses the stdlib-only Python 3 provider.
Interactive browser setup additionally requires curl, jq, and openssl;
automatic refresh-token reuse requires macOS security or Linux
secret-tool. Without a keychain, the initial browser access token still
works but cannot be refreshed. If Python is unavailable, get-token.sh
retains safe Sigma CLI and client-credentials fallbacks (the latter using
curl, jq, and base64).
Browser launch supports macOS, Linux, and Windows/Git Bash, although Windows
does not currently have a keychain persistence backend. Run
scripts/check-prerequisites.sh sigma-api from the repository root for a
read-only check.
| File | When to load |
|---|---|
| reference/browser-oauth-login.md | The user wants an interactive browser sign-in (OAuth authorization-code + PKCE) instead of a client ID/secret — the discovery-driven flow, code exchange, and encrypted refresh-token storage. |
The host depends on the user's Sigma cloud and region. Confirm with the user before exporting. The user can also look up their base URL in Administration → Developer Access in the Sigma app.
The authoritative list lives in the Sigma help docs: Supported regions, data platforms, and features. Mirror below:
| Cloud | Region | Base URL |
|---|---|---|
| AWS | US West (Oregon) | https://aws-api.sigmacomputing.com |
| AWS | US East (N. Virginia) | https://api.us-a.aws.sigmacomputing.com |
| AWS | Canada (Central) | https://api.ca.aws.sigmacomputing.com |
| AWS | Europe (Frankfurt) | https://api.eu.aws.sigmacomputing.com |
| AWS | Asia Pacific (Sydney) | https://api.au.aws.sigmacomputing.com |
| AWS | UK (London) | https://api.uk.aws.sigmacomputing.com |
| Azure | US (Virginia) | https://api.us.azure.sigmacomputing.com |
| Azure | Europe (Netherlands) | https://api.eu.azure.sigmacomputing.com |
| Azure | Canada (Toronto) | https://api.ca.azure.sigmacomputing.com |
| Azure | UK (London) | https://api.uk.azure.sigmacomputing.com |
| Azure | Australia | https://api.au.azure.sigmacomputing.com |
| GCP | US (Iowa) | https://api.sigmacomputing.com |
| GCP | Saudi Arabia (Dammam) | https://api.sa.gcp.sigmacomputing.com |
SIGMA_BASE_URLis the API host, not the app URL —https://aws-api.sigmacomputing.com, nothttps://app.sigmacomputing.com.
SIGMA_BASE_URL is always required:
export SIGMA_BASE_URL="https://aws-api.sigmacomputing.com" # adjust per cloud; pragma: allowlist secret
For an interactive terminal, prefer a one-time browser sign-in:
eval "$(bash scripts/browser-login.sh)"
It stores the refresh token only in the OS keychain. For unattended hosts, configure client credentials as the fallback instead:
export SIGMA_CLIENT_ID="your-client-id"
export SIGMA_CLIENT_SECRET="your-client-secret"
Find client credentials in Sigma Administration → APIs and Tokens (also surfaced as Developer Access → API credentials).
Call the same helper for initial minting and refresh:
eval "$(${CLAUDE_PLUGIN_ROOT}/skills/sigma-api/scripts/get-token.sh)"eval "$(bash <repo-root>/skills/sigma-api/scripts/get-token.sh)"In the default auto mode, get-token.sh delegates to
scripts/get_token.py: it first serves or refreshes the browser session in the
OS keychain, then the Sigma CLI (sigma auth token for the profile named by
SIGMA_CLI_PROFILE, else the CLI default; its Base URL must match
SIGMA_BASE_URL when that is set), then SIGMA_CLIENT_ID /
SIGMA_CLIENT_SECRET. The provider never runs sigma auth login. A valid token already held by a caller should be reused
by that caller until refresh is needed.
Explicit profile exception. When the caller sets SIGMA_CLI_PROFILE in the
process environment (a profile merely persisted in ~/.sigma-migration/env does
not count; the settings-file loaders record it in SIGMA_CLI_PROFILE_FROM_FILE),
that profile chooses the org. In auto mode the browser keychain and client
credentials are skipped, the settings file's SIGMA_BASE_URL, client
credentials, SIGMA_API_TOKEN and SIGMA_AUTH_MODE are not loaded, and a Sigma
CLI failure is an error naming the profile and both hosts instead of a
fall-through to another org. An auth.json in SIGMA_WORKDIR or the cwd is
read by the REST clients before the provider and still wins over the profile.
Before returning a browser, Sigma CLI, or client-credentials result, the Python provider
verifies the token with GET /v2/whoami. It never follows redirects for this
request, so the bearer cannot be forwarded to a redirect target. A 401, 403,
non-JSON response, or redirect fails closed without emitting the token or
writing auth.json.
Every successfully verified mint emits:
| Variable | Meaning |
|---|---|
SIGMA_API_TOKEN | Short-lived access token |
SIGMA_TOKEN_MINTED_AT | UTC ISO-8601 mint timestamp |
SIGMA_AUTH_METHOD | browser, sigma-cli, or client-credentials |
Select a mode explicitly with SIGMA_AUTH_MODE or --auth-mode:
eval "$(bash scripts/get-token.sh --auth-mode browser)"
eval "$(SIGMA_AUTH_MODE=client-credentials bash scripts/get-token.sh)"
Allowed values are auto, browser, sigma-cli, and client-credentials;
the CLI flag overrides the environment variable. browser and sigma-cli
never fall back to another source, and client-credentials never reads the
keychain or the Sigma CLI.
auth.jsonPowerShell, cmd.exe, and agent subprocesses need no eval:
python3 scripts/get_token.py --workdir /tmp/sigma-run
After /v2/whoami succeeds, this writes backward-compatible
/tmp/sigma-run/auth.json with mode 0600. It contains the access token, base
URL, mint timestamp, and auth method—never the refresh token. --print-token
prints only the bare token;
--print-export prints the three shell exports.
CREDENTIALS=$(printf '%s:%s' "$SIGMA_CLIENT_ID" "$SIGMA_CLIENT_SECRET" | base64)
export SIGMA_API_TOKEN=$(curl -sf -X POST \
-H "Authorization: Basic ${CREDENTIALS}" \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "grant_type=client_credentials" \
"$SIGMA_BASE_URL/v2/auth/token" \
| jq -r '.access_token')
[ -z "$SIGMA_API_TOKEN" ] || [ "$SIGMA_API_TOKEN" = "null" ] && { echo "Token exchange failed" >&2; exit 1; }
Sigma supports interactive OAuth 2.1 authorization-code + PKCE login—no pre-issued credentials, because the client registers itself. This is the preferred setup when a human is at the keyboard; client credentials remain the fallback for unattended automation.
scripts/browser-login.sh packages the whole flow: it reads SIGMA_BASE_URL,
discovers the OAuth endpoints, opens your browser, captures the callback,
exchanges the code, stores the refresh token in the OS keychain, and emits the
same token/mint/auth-method exports as get-token.sh.
eval "$(${CLAUDE_PLUGIN_ROOT}/skills/sigma-api/scripts/browser-login.sh)"eval "$(bash <repo-root>/skills/sigma-api/scripts/browser-login.sh)"The script picks a random high loopback port that nothing is currently listening on for its redirect URI, so the one-time authorization code is never delivered to another local process. It strips Windows CRLF from PKCE/state values and opens the system browser on macOS, Linux, or Windows/Git Bash. Prompts go to stderr; only the export line reaches stdout.
Full discovery-driven walkthrough (including the refresh-token storage the script performs) in reference/browser-oauth-login.md — read it to understand or customize what the script does.
Normally, rerun get-token.sh; its default mode already prefers the saved
browser session. scripts/refresh-token.sh remains available as a
browser-only compatibility helper. It serves a valid cache and otherwise
redeems—and safely rotates—the keychain refresh token.
eval "$(${CLAUDE_PLUGIN_ROOT}/skills/sigma-api/scripts/refresh-token.sh)"eval "$(bash <repo-root>/skills/sigma-api/scripts/refresh-token.sh)"Run it once per shell (or per phase) and reuse the exported token. If it
reports that the refresh token is expired or revoked, run browser-login.sh
again.
API-dependent skills use scripts/list-table-columns.sh <table-inode-id> to
retrieve complete warehouse-table metadata. The underlying endpoint defaults
to 50 columns; the helper requests 1,000 per page and follows the opaque
nextPageToken as pageToken until it is absent.
bash scripts/list-table-columns.sh "$INODE_ID" |
jq '.entries[] | {name, type, visibility}'
Never conclude that a warehouse column is missing from only the first API
response. The helper emits one object containing all entries, pageCount,
and totalCount.
GET /v2/whoami is the canonical sanity check that the token is valid and the
base URL is correct. scripts/get_token.py performs this check automatically,
without following redirects, after both browser and client-credentials auth.
Use the manual check below only for a token obtained elsewhere or when
diagnosing a later response:
curl -sf -H "Authorization: Bearer $SIGMA_API_TOKEN" \
"$SIGMA_BASE_URL/v2/whoami" | jq .
The response includes userId, organizationId, and accountType.
Tokens last about an hour. Re-eval the helper (or repeat the manual exchange)
to refresh. The bundled Ruby sigma_rest wrappers proactively refresh tokens
whose SIGMA_TOKEN_MINTED_AT / auth.json metadata is at least 50 minutes old,
then still refresh and retry once on 401. Tokens supplied by callers without
valid mint-age metadata are preserved until the server returns 401.
SIGMA_BASE_URL for the user's cloud, or the resource doesn't exist.$SIGMA_API_TOKEN, $SIGMA_CLIENT_SECRET, or any other secret to logs the user can share.Authorization header, never on a query string.generated/cline/sigma-api.md (opens in a new tab)generated/codex/AGENTS.md (opens in a new tab)generated/continue/sigma-api.md (opens in a new tab)generated/cursor/rules/sigma-api.mdc (opens in a new tab)reference/browser-oauth-login.md (opens in a new tab)scripts/browser-login.sh (opens in a new tab)scripts/get-token.sh (opens in a new tab)scripts/get_token.py (opens in a new tab)scripts/lib/browser-login-platform.sh (opens in a new tab)scripts/list-table-columns.sh (opens in a new tab)scripts/refresh-token.sh (opens in a new tab)scripts/test-browser-login-platform.rb (opens in a new tab)scripts/test_get_token.py (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub sigmacomputing/sigma-migration-skills --plugin sigma-authoringOther plugins' skills for the same job
5 skills in this plugin
/custom-sql-to-data-modelScan Sigma workbooks for custom SQL elements, dedupe across workbooks, build or reuse Sigma data models, then repoint the workbooks via the v3alpha `:swapSources` endpoint. Use when you want to find ad-hoc SQL in workbooks and promote it to one reusable data model per unique query./sigma-data-modelsAuthor, retrieve, or modify a Sigma data model spec (the JSON/YAML semantic-layer definition with sources, columns, metrics, relationships, filters, controls, folder groupings, and column-level security) by calling the Sigma REST API directly. Use when the user wants to build a new data model from existing warehouse tables, add metrics or relationships to an existing model, change a model's source, edit columns, or round-trip a data model spec through code. **Out of scope: converting from another BI tool's format (dbt, LookML, Tableau, Power BI, Alteryx, etc.).** Those conversions are handled by the Sigma data-model converter (browser tool + MCP) — point users there when they paste source-format input. Requires an SIGMA_API_TOKEN — obtain via the sigma-api skill first./sigma-plugin-authoringBuild, register, host, embed, and data-bind a bespoke Sigma custom plugin (@sigmacomputing/plugin) to recreate a source visualization for which Sigma has no native chart/KPI/table equivalent — a radial gauge, a custom heatmap, a sankey, or any bespoke viz kind outside Sigma's native element set. **Use when a source viz has no native Sigma equivalent and should be recreated as a bespoke plugin** — not when a native Sigma chart, KPI, or table kind already covers it (that's the `sigma-workbooks` skill). Covers the full lifecycle: writing the single-file plugin, registering it via `POST /v2/plugins`, hosting it, embedding it in a workbook spec bound to real data, and verifying value parity. Ships a worked example (a radial gauge / "value vs. target" plugin) and the `plugin_embed` emitter. Requires an SIGMA_API_TOKEN — obtain via the sigma-api skill first.