Security & accessBeginnerSDK v4.2 · 4 min read

Generate and scope an API key

API keys authenticate your server-side requests to the Meridian platform. This guide walks through creating a least-privilege key, restricting it to specific endpoints and IP ranges, and rotating it without downtime.

support engineer headshot

Written by Dana Whitfield

Updated Jun 14, 2026

Before you begin

You'll need workspace admin rights and the Meridian CLI installed. Confirm your version with meridian --version — this guide assumes v4.2.0 or later.

Note: Keys created in the sandbox environment are prefixed mk_test_ and never touch live data. Swap to a production key only after you've verified the flow end-to-end.

Create a scoped key

Run the create command with an explicit scope. Meridian keys are deny-by-default, so a key with no scopes can read nothing — you grant exactly the permissions each service needs.

bash

# create a read-only key scoped to two endpoints

meridian keys create \

--name "reporting-service" \

--scope invoices:read,usage:read \

--allow-ip 203.0.113.0/24

→ key created: mk_live_a91f… (store it now — shown once)

Available scopes

Each scope maps to a read or write permission on a resource group. Combine only what a service needs — over-broad keys are the most common finding in security reviews.

ScopeMethodGrants
invoices:readGETList and retrieve invoices
webhooks:writePOSTRegister and update webhook endpoints
keys:deleteDELETERevoke keys — grant sparingly

Rotate without downtime

Meridian supports overlapping keys: create the replacement, deploy it, then revoke the old one once traffic has fully shifted. There is never a window where both are invalid.

  1. Create the new key with the same scope set as the outgoing one.
  2. Roll it out to every service reading from your secrets manager.
  3. Confirm zero requests on the old key in the audit log, then revoke it.

Feedback

Was this article helpful?

Dual7 template preview — this is a fictional demonstration business.
TemplateMeridian Help Center
Theme
Remix this siteExit