Administer MotherDuck service accounts, tokens, Ducklings, and Dive embed sessions through the control-plane REST API.
Getting started
Full instructionsInstall the skill, then ask your AI tool for the task in plain words. The full SKILL.md below shows what it covers.
Instructions: SKILL.mdv1.0.51
REST API Administration
Source Of Truth
- Prefer current MotherDuck REST API documentation, the public OpenAPI spec at
https://api.motherduck.com/docs/specs, or an explicit OpenAPI spec supplied by the user. - For token scope and embed behavior, cross-check the REST API docs and the Embedded Dives docs because they include operational constraints not obvious from the raw schema.
- If the MotherDuck MCP
ask_docs_questionfeature is available, use it to check whether public REST API guidance has changed. - Treat endpoint availability, preview status, token fields, and role requirements as current only when backed by the supplied spec or current docs.
Default Posture
- Treat the REST API as the control plane; SQL and data-plane queries go through a database connection, not the REST API.
- Use
https://api.motherduck.comas the base URL unless the user provides another environment. - Authenticate with
Authorization: Bearer ${MOTHERDUCK_ADMIN_TOKEN}and keep admin read-write tokens in backend-managed secrets. - Never use read-scaling tokens for REST API administration.
- Prefer read-before-write flows for configuration changes so the current account, service account, Duckling config, or Dive metadata is known before mutation.
- Treat
POST /v1/usersas service-account creation unless current docs explicitly broaden the API.GET /v1/userslists every user and service account in the org; filter withis_service_accountandis_deprovisionedand page withlimit/offset. Use it for access reviews and to find a service account before creating a duplicate. - Service accounts and access tokens accept an optional, searchable description. Set one that names the workload and owner; check the current API spec for the field name.
- For the Terraform resources, state rules, and setup archetypes, read
references/ACCESS_CONTROL_SETUPS.mdinmotherduck-security-governance. - For repeatable provisioning (environments, partner or per-customer setups), prefer the Terraform provider
motherduckdb/motherduckover scripted REST calls. It authenticates withMOTHERDUCK_TOKEN, plusMOTHERDUCK_ADMIN_TOKENfor service accounts, tokens, and Duckling configuration. - Assume active-account, Duckling configuration, service-account creation, service-account token creation, and Dive embed-session endpoints require an organization admin bearer token unless current docs say otherwise.
- Never expose generated access tokens in logs, browser code, client bundles, or committed files.
- Confirm destructive deletes with the user. Deleting a user permanently deletes that user and all of their data.
- Treat agent/account signup (
motherduck newor the public signup flow) as separate from the organization Admin REST API. Never create an account because an admin token is unavailable. - To give an end user or tenant a token that only sees its own rows, mint a read-scaling token with
POST /v1/tokens/short-livedand acontextmap, called with the service account's own token (not the admin token); secure views filter onsession_context(). Embed sessions take the samecontext. - For Dive embed sessions, share the Dive with the target service account first (new Dives are private), use
session_namerather than the legacysession_hint, and keepinitial_stateJSON-serializable and within the documented size limits; validate iframe state, navigation, and export messages in the host application.
Workflow
- Identify whether the task is service-account provisioning, token management, Duckling sizing, active-account inspection, or Dive embedding.
- Resolve the admin token from the existing environment and identify the target
usernameordive_id; ask only when a required value cannot be discovered, and never invent production identifiers. - Check token scope before calling token endpoints: users can create tokens for themselves, and admins can create tokens for service accounts, but admins cannot create tokens for other non-service-account members through the API.
- For Duckling config changes, read the current config first, then update both
read_writeandread_scalingbecause thePUTpayload requires both. - Preserve response fields that are only returned once, especially newly created token strings and embed session strings.
- Surface API errors by status and response body; do not hide
400,401,403,404, or500responses behind success-shaped fallbacks. - If the connected MotherDuck MCP server lists user-admin tools (such as
create_service_account), prefer them over raw HTTP and callget_user_admin_guidefirst when it is listed. Many MCP setups do not expose them; then use the REST API directly. The MCP column inreferences/REST_API_GUIDE.mdmaps the names.
For answer, review, or planning requests, inspect and report without mutating the control plane. For create or update requests, perform the requested in-scope operation and verify the response; retain confirmation for destructive deletes or broader administrative changes.
References
Read only the reference sections needed for the current task.
- Read
references/REST_API_GUIDE.mdfor endpoint summaries, MCP tool mapping, curl examples, validation limits, and operational gotchas.
Related Skills
Load related skills only for missing capabilities; reuse established context.
motherduck-queryfor SQL and data-plane query workmotherduck-connectfor connection tokens and application connection posturemotherduck-security-governancefor admin-token handling, service-account posture, and access-boundary questionsmotherduck-create-divefor designing Dives before minting embed sessions
Explore more skills
Browse all- Motherduck Design DiveDesign or improve a MotherDuck Dive’s layout, responsive behavior, themes, filters, and visual accessibility.
- Motherduck Build Malleable DiveBuild a generative MotherDuck Dive where a Flight writes a daily briefing and question-to-page specs from a semantic…
- Motherduck Manage GuidesRead or maintain MotherDuck Guides for business definitions, join rules, and reusable warehouse conventions.
- Motherduck Model DataDesign or implement MotherDuck analytical schemas and transformation models, including grain, types, and…
- Motherduck ExploreFind and understand MotherDuck databases, tables, columns, shares, and sample data, including which tables hold a given…
- Motherduck Share DataCreate, consume, or manage MotherDuck data shares, including audience grants, table filters, and refresh policy.
Security
Reviews (0)
More from MotherDuck Agent Skills
View source →Frequently asked questions about motherduck-rest-api
What does the motherduck-rest-api skill do?
Administer MotherDuck service accounts, tokens, Ducklings, and Dive embed sessions through the control-plane REST API. It's a reusable SKILL.md instruction set that loads into your AI coding assistant on demand, no prompt engineering, no copy-pasting every session.
How do I install the motherduck-rest-api skill?
Run `npx @skills-hub-ai/cli install motherduck-rest-api` from your terminal. The CLI writes the SKILL.md to the correct location for your AI tool (e.g. ~/.claude/skills/motherduck-rest-api/ for Claude Code or ~/.cursor/skills/ for Cursor with --target cursor) and adds it to your project's .skills.json lockfile.
Which AI tools does motherduck-rest-api work with?
motherduck-rest-api runs in Claude Code. It follows the open Agent Skills standard (SKILL.md), so the same skill works in every supported tool without modification.
Is the motherduck-rest-api skill free?
Yes. Every skill on skills-hub.ai is free and open-source. There are no premium tiers, paywalls, or usage limits. You only pay for whatever AI assistant you're already using.
How do I use motherduck-rest-api after installing it?
In Claude Code, type `/motherduck-rest-api` (or whatever slash command the skill registers) and the AI follows the skill's instructions immediately. You can also reference it by name in natural language, your AI loads the skill into context when relevant.
Can I share the motherduck-rest-api skill with my team?
Yes. Commit your project's .skills.json lockfile and teammates run `npx @skills-hub-ai/cli install` (no args) to install every skill at the exact version you pinned. Organization-scoped installs work via skills-hub.ai organizations.
Badge for your README
Show that this skill is on Skills Hub. The badge links back to this page and shows the live install count.
[](https://skills-hub.ai/skills/motherduck-rest-api)<a href="https://skills-hub.ai/skills/motherduck-rest-api"><img src="https://skills-hub.ai/api/badges/skill/motherduck-rest-api" alt="Install on Skills Hub"></a>More options in the badge docs.