Managing Metabase API keys

Metabase API keys let scripts and pipelines call your self-hosted instance without a person's login. This page explains how to scope, configure, rotate and protect them, and what to confirm before automation depends on them.

On this page

Managing Metabase API keys for automation on a self-hosted instance

Teams that want scheduled reporting, user provisioning or CI jobs to call a self-hosted Metabase need API keys, and the key process should be set before the first job runs. On self-hosted Pro and Enterprise plans, Metabase's documentation describes creating API keys through the configuration file, so that is the route to plan around. Each key acts on behalf of a group's permissions, so the first decision is which group a job belongs to and what that group can see. Keep the job's needs narrow, and confirm the key's permission scope in the Metabase API keys docs before you grant it anything broader than the job requires.

An API key is a credential that lets a script, scheduler or pipeline call the Metabase API without a person signing in. Typical uses include running a saved question on a schedule, creating or deactivating users from an HR export, or deploying dashboards from version control. Because the key carries access, it should be treated like a database password: stored in your secrets manager, never committed to a repository, and kept out of job output and application logs. Ask whoever runs your Metabase which logs capture request headers and tighten them before automation goes live.

A managed key process becomes necessary once more than a handful of jobs depend on keys, when several teams can request them, or when auditors ask who holds access and when it was last rotated. At that point, record an owner, purpose, group and expiry for each key, and plan rotation as a routine change. Confirm with Metabase which key creation methods, rotation options and audit records apply to your edition and plan, since the docs tie configuration file keys to paid self-hosted tiers. Open source and Starter deployments should verify their options directly before designing automation around them.

Which API key approach fits each automation job

This table compares the three ways to create and scope Metabase API keys: admin-created keys, keys defined in the configuration file on paid self-hosted plans, and shared service accounts tied to a group. Read each column against your automation job, and confirm exact permission behavior in the API keys documentation before you commit to one approach.

ApproachPlan requirementWho creates the keyHow permissions are scopedRotation effortBest-fit use
Admin-created key in the applicationConfirm for your edition and version in the API keys docsAn administrator in the Metabase admin settingsSet by the permissions of the administrator or the chosen configuration; verify in the API keys docsManual: create a new key, update every consumer, then revoke the old oneSmall, one-off scripts run by a single owner
Key defined in the configuration fileSelf-hosted Pro or Enterprise onlyThe platform team, through the Metabase configuration fileDefined in the configuration file; confirm the exact group and scope behavior in the docsChanged through configuration and a restart, so it fits infrastructure-as-code workflowsAutomation managed by the platform team under version control
Shared service account tied to a groupConfirm group and permission features for your planAn administrator creates the account and adds it to a groupInherits the group's data and collection permissions, so keep the group narrowRotate by changing credentials on the account, then update consumersRecurring jobs that need the same read access across several tools
Per-job key with a dedicated ownerDepends on the chosen method aboveThe owner of the automation, recorded in your inventoryLimit to the smallest group or configuration that the job needsTrack an expiry date and an owner for each keyPipelines with a named team accountable for their access

Setting up API keys in a self-hosted Metabase

This sequence takes an API key from plan check to a verified, owned and scheduled review, so each automation job runs with only the data it needs. Work through it once per job, and keep a record of every key your team issues.

  1. Confirm plan and edition before creating keys

    Start by confirming which Metabase plan and edition your instance runs, because the way you create keys depends on it. Open the admin settings and check the license and plan, then note whether you are on Open Source, Starter, Pro or Enterprise. Admin interface key creation is available to all self-hosted instances, while creating keys through the configuration file is available on Pro and Enterprise plans only. Ask your Metabase administrator to record the answer in the change ticket. You are done when the ticket names the plan and the creation method you will use.

  2. Define each automation job and its minimum data

    List every job that will call the Metabase API, such as a nightly export, a report refresh or a sync to a reporting tool. For each job, write the exact endpoints it needs, the databases, collections and saved questions it reads, and whether it ever writes. Give each job its own entry so keys are never shared between unrelated tasks. This list is illustrative of the level of detail to aim for: one job, one data set, read-only. You are done when every job has a written data scope that a reviewer can check.

  3. Create a dedicated group with minimal permissions

    In the admin settings, create a group for each job, named after the job so its purpose is clear in audit logs. Grant data permissions only on the databases and tables the job needs, and collection permissions only on the collections it reads. Leave the group out of the administrators group. Keep the group's permissions read-only unless the job must write. You are done when a test user in the group can see the intended data and the group's permissions screen matches the written scope from the previous step.

  4. Create the key and bind it to the group

    Create the API key from the admin interface, or on Pro and Enterprise plans through the configuration file, and assign it to the dedicated group. Metabase API keys act with the permissions of the group they belong to, so the group assignment is the boundary you are setting. Give the key a name that identifies the job and its owner. Copy the key value once, because you will not be able to view it again in full. You are done when the key appears in the key list with the correct group and name.

  5. Store the key in your secrets manager

    Place the key in the team's approved secrets manager, such as the one your platform team already runs for other service credentials. Do not paste it into scripts, scheduled job definitions, CI variables with broad access, chat messages or tickets. Reference it from the job by name, and restrict read access to the service account that runs the job. Confirm that repository scanning and log redaction are enabled for the job's pipeline. You are done when the job reads the key from the secrets manager and a search of the repository and job logs finds no copy of the value.

  6. Verify scope with a read-only call and a denied request

    Run one read-only API call with the key from the job's environment, such as a request that returns a single known collection or saved question. Confirm the expected data comes back. Then run a second request for a database or collection outside the group's scope and confirm Metabase denies it. A denied response is the check that the boundary works, so record both results. If the out-of-scope request succeeds, remove the key, correct the group permissions and repeat this step. You are done when the allowed call returns data and the out-of-scope call is refused.

  7. Record an owner and schedule the review

    Record the key's owner, the job it serves, the group it belongs to, the secrets manager location and the date it was created in your key register. Set a review date on the owner's calendar or in your ticketing system, and include steps to rotate or revoke the key in the job's runbook. Revisit the register whenever a job changes its data needs or its owner leaves. You are done when the register entry exists, the review is scheduled and the runbook names the revocation steps.

How API key access follows group permissions

The most important control over what an API key can do is not the key itself but the permissions of the group and the data and collections it is granted. Metabase's people and groups documentation describes how groups carry access to data and collections, so key scope should be designed alongside your access model rather than added afterward. Before creating any key, map each automation job to the data it reads or writes, then confirm which group or groups that job needs. A key that works through a group with broad data access exposes that access to whatever script holds the key, regardless of how narrowly the script was written.

The central decision is between one broad automation key and several narrow keys, one per job. A single broad key is simpler to provision and rotate, but a leak exposes everything it can reach, and it is hard to tell from logs which job made a given call. Several narrow keys limit the blast radius and make audit trails easier to read, at the cost of more keys to rotate and track. A reasonable starting point is one key per job or per team, with each key tied to a dedicated group that holds only the access that job requires. Illustrative example: a nightly export job gets its own group with read access to one reporting collection, so compromising it does not expose the finance schemas.

Group membership changes later can alter what a key does, so review them as part of key governance. Ask your Metabase administrator or test in a staging instance how a key behaves after its group gains or loses access, and whether removing a user from a group affects keys created under that user's identity. Also confirm whether a key inherits its group's permissions or can be restricted independently of that group, since this determines whether you can narrow a key without changing shared access. Document the answer for your environment, because the behavior determines whether a permission review must include the key inventory as well as the user list.

Protecting keys from logs, repositories and over-broad access

An API key is a standing credential that acts with the permissions of the group it belongs to, so its exposure matters as much as its creation. The cards below cover where keys leak, how they are stored and injected, who can manage them and how their use is traced. Each control can be checked on your own instance, and the notes say where a paid plan changes what you can do.

Keep keys out of repositories and CI logs

Treat every Metabase API key as a secret from the moment it is created. Scan commits, pull requests and CI configuration for strings that match the key format before merge, and enable push protection in your Git host if it offers one. Mask the key variable in CI so the runner never prints it, and confirm that failed jobs do not echo environment variables. If a key appears in a repository, revoke it first and then clean the history, because the old value stays usable until revoked.

Inject keys from a secrets manager

Store each key in your organization's secrets manager and have automation read it at runtime, so the value is never written into scripts, images or deployment manifests. Give each job its own key where possible, so that revoking one integration does not break others. Check that the secret is delivered through an environment variable or a file with restricted permissions, and that the manager logs who read it. The secrets manager itself becomes a dependency for every script that calls Metabase.

Keep keys out of logs and shell history

Keys often leak through reverse proxy access logs, application logs and debug output that records request headers. Configure the proxy to omit or redact the Authorization and X-API-Key headers, and confirm that Metabase log output at your chosen level does not print them. Avoid passing keys as command-line arguments, because they land in shell history and process listings. Use an environment variable or a file read by the client instead, and test by searching recent logs for a known test key.

Limit who can view and create keys

Decide which administrators may create API keys, since a key carries the permissions of the group it is tied to and should never be issued from an administrator account. Keep the admin group small and review its membership on a schedule. Confirm that ordinary users cannot reach the API key settings page or the admin endpoints that list keys. Assign each key to a dedicated group with only the data and collection permissions its job requires.

Rotate keys after staff or vendor changes

Rotate any key that a departing employee, contractor or vendor knew about, and rotate keys that were shared through chat or tickets even if no leak is known. Record an owner, a purpose and a rotation date for each key in your inventory. Rotation means creating the replacement, switching the consumer to it, confirming the old key no longer works, and then revoking it. Ask whether your Metabase edition exposes key creation through the configuration file, which is available on self-hosted Pro and Enterprise plans, because that changes how keys are provisioned and rotated.

Metabase API keys docs

Audit key use where logging is available

Find out what your Metabase edition records about API requests and which identity appears in those records, because a shared key can hide which job made a change. Pair the application records with your reverse proxy and secrets manager logs to reconstruct who used a key and from where. Usage analytics and auditing are part of the Pro and Enterprise plans, so open source and Starter deployments need to rely on proxy and infrastructure logs. Set an alert for requests from unexpected addresses.

Key creation paths by plan and deployment

On self-hosted Pro and Enterprise plans, API keys can be created through the configuration file. This lets the platform team declare keys as part of the deployment definition instead of creating them by hand in the admin settings, so the keys can be reviewed with the rest of the infrastructure code and reissued on a schedule. Start by deciding which automation jobs need keys and which group each key should belong to, because a key's access follows its group permissions.

  • Group first: Create a dedicated group for each automation job with the narrowest data and collection permissions it needs before writing any key definition.
  • Storage of the file: Keep the configuration file in your configuration management system with restricted read access, and confirm in the docs how key values are stored and whether they can be read back.
  • Secret delivery: Inject key values from your secrets manager at deploy time so they never appear in a repository or a container image.
  • Rotation record: Log the key name, owning team, group, consuming job, creation date and next rotation date.
  • Negative test: Call a read-only endpoint with each key and confirm it cannot reach data outside its group.

Check the API keys documentation for the current file format and for how a key defined this way is revoked.

Limits to confirm before automation depends on keys

API keys are only as safe as the access they carry, and the documentation for each limit below should be checked against a test instance before a script, pipeline or integration depends on a key. Each card names one question to settle with Metabase's documentation or a running test instance, so the answers can shape group design, rotation runbooks and logging requirements.

Exact permission scope of a key

Confirm what a key can actually read, write and administer when it is tied to a group. Group-based permissions cover data, collections and admin settings, but the effective result for an API key may differ from a user account in the same group. Create a test key in a restricted group, run representative calls, and record which succeed and which return errors. Treat that record as the baseline for access review.

API keys docs

Expiry and individual revocation

Check whether a key has an expiry date and whether one key can be revoked without disturbing others. Automation often shares a single service identity, so revoking one key should not break unrelated jobs. Confirm the revocation steps in the admin interface on your plan, and test that a revoked key fails on its next request. Write down who can perform the revocation and how quickly it must happen during an incident.

Rotating configuration file keys

Keys created through the configuration file on self-hosted Pro and Enterprise plans may not rotate the same way as keys created in the admin interface. Confirm how to replace such a key, whether the old value must be removed from the file, and whether a restart is required. Rehearse the change on a test instance, because a failed rotation can stop scheduled reports and syncs that depend on the key.

Reachable API endpoints

Confirm which API endpoints a key can call, particularly endpoints for user management, database settings, permissions and the application database. A key scoped to read queries should be unable to change settings. Build a short list of the endpoints your automation uses, test each one with the key, and also test two or three administrative endpoints to confirm they are refused.

Key identity in audit and usage data

Check how API calls appear in audit logs and usage analytics. Confirm whether the log records the key, the owning group or a generic service identity, and whether the source address is kept. Usage analytics and auditing are listed as Pro and Enterprise features, so verify the plan before you plan log review around them. If a key's activity cannot be attributed, the incident response plan needs a different identity model.

Metabase pricing

How an automation job authenticates to Metabase with an API key

The job starts in the team's infrastructure, where the secrets manager holds the API key and hands it to the CI or scheduler job at run time, so the key never sits in the repository. The job sends an HTTPS request to the reverse proxy on the Metabase host, which terminates TLS and forwards the request to the Metabase API. Metabase then checks which group the key belongs to and reads that group's grants from the application database. Requests inside the group's scope return data. Requests outside it receive a denied response, which the job should log as a failure. Confirm that the permission check runs on every request, not only at key creation.

Request path from a job's secrets manager to Metabase's group permission check.

Common questions about Metabase API key management

What does it cost to set up Metabase API key management?

The cost is mostly the time of the people doing the work, plus any tooling you already pay for. Internal staff spend time on group design, deciding which keys each automation needs, wiring keys into your secrets manager, testing that jobs still run, and writing the rotation runbook. If you hire a partner, the fee follows from a written scope that lists those same tasks. The cost is largely one-time, but rotation and access reviews recur on a schedule you set. No price figures apply here. When you request a quote, ask which tasks are included, who holds the secrets tooling licenses, and what evidence you receive at handover.

How long does it take to set up API keys and rotation?

Duration depends mainly on how many automations use the instance, how many groups and data permissions already exist, and whether your secrets manager is ready to hold keys. A single integration with clean permissions is quick to set up. Many scripts, CI jobs and BI tools that each need different scopes take longer because every one needs its own key, group and test. Change windows and approval steps can add waiting time. Ask any provider for a timeline tied to a named list of integrations and environments, and confirm which of those are in scope.

Can our own team manage Metabase API keys without a partner?

Yes, if the team has the skills to run a self-hosted application, administer Metabase groups and permissions, and handle secrets. Useful skills include Linux and container operations, familiarity with your secrets manager, basic HTTP and API testing, and a clear understanding of your data access model. Someone also needs to own the rotation schedule and the incident steps for a leaked key. A partner is most useful when the team lacks one of these skills or when deadlines for a security review are fixed. Check the Metabase API keys documentation before planning the work.

What do we need to provide before key management work starts?

You need to provide decisions and access. Decisions include which automations need API access, which Metabase groups they should belong to, and which data each group can read. You also need someone who approves the scope of each key and who can be reached for change windows. Access includes an administrator account on the instance, read access to the application database and logs where needed, and a place in your secrets manager to store keys. If you use configuration file keys on a paid plan, you also need access to the server or container configuration. Agree on these items in writing before work begins.

Do API keys work the same on Open Source and paid Metabase plans?

The API key feature exists on self-hosted instances, but creating keys through the configuration file is documented only for self-hosted Pro and Enterprise plans. On Open Source and Starter, you create and manage keys through the admin interface and must plan for that path. Group-based permissions also differ in what they can control: row and column level permissions, which affect what a key can reach, are included only in Pro and Enterprise. Confirm which plan you run before designing key scopes, because the plan decides which provisioning and permission options you can use.

How do we rotate Metabase API keys without downtime?

Rotate by creating a new key, updating the consuming job or service to use it, verifying the job works, and then revoking the old key. Running both keys briefly avoids a gap in automation. Store the new key in your secrets manager before changing the consumer, and record the change in your runbook. Test each rotation in a non-production instance first. Rotation is a recurring task, so schedule it and assign an owner. The steps should match your deployment tooling, so ask any partner to demonstrate them on your own automations before go-live.

How do we keep API keys out of logs and repositories?

Keep keys in a secrets manager or the environment of the runtime, never in source code, notebooks or shared chat. Pass keys as headers from the secret store at runtime, and configure your reverse proxy and logging pipeline so request headers are not written to logs. Add secret scanning to your repositories and CI, and check that build logs mask variables. When a key appears in a log or commit, revoke it, issue a replacement and review who could have read it. Your security team should confirm these controls during a penetration test of the instance.

How DeployOpen works on this

DeployOpen treats Metabase API keys as access that needs an owner, a narrow purpose and a rotation plan before any automation depends on them. We scope the keys, build the group permissions and configuration around them, and hand over a runbook your team can operate after the engagement ends.

How we scope

  • Inventory every automation that will call the Metabase API and name the owner of each one.
  • Map each planned key to the permissions it needs, using Metabase groups and collection access.
  • Confirm with you whether your plan supports keys created through the configuration file before the design is fixed.
  • Agree the scope, deliverables and timeline in writing before any work starts, as all engagements are fixed-scope.

How we build

  • Create a dedicated group for each automation so keys inherit only the access its task requires.
  • Set up key creation through the configuration file on self-hosted Pro or Enterprise plans where that route fits your process.
  • Keep key values in your secrets store and out of Git repositories, CI logs, shell history and application logs.
  • Test that each key can reach its intended data and is refused for everything outside its scope.

How we hand over

  • Deliver the key inventory with owners, group assignments, permission summaries and the planned expiry or rotation date for each key.
  • Document the rotation procedure, including who approves a change, how the new key is deployed and how the old key is revoked.
  • Walk your platform and security teams through the runbook and the checks used to detect keys in logs and repositories.
  • Provide the configuration and group settings as written artifacts your team can review and version.

How we support

  • Offer ongoing support, key reviews and rotation assistance as a retainer after the initial handover.
  • Re-test permissions after Metabase upgrades, group changes or new automations are added.
  • Include key review in continuous testing if your organization wants periodic confirmation that scopes still match need.
  • Confirm with your team which support boundaries and response expectations apply before the retainer is signed.

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.