Skip to main content
Every request to the Minns Memory Layer API must include a valid API key. Keys are scoped to a project and carry the permissions you assign on the project page.

Getting your API key

1

Open the project page

Navigate to your project dashboard at minns.ai and select the project you want to authenticate against.
2

Go to API Keys

Click SettingsAPI Keys. You’ll see your active keys and their creation dates.
3

Create a new key

Click Create Key. Give it a descriptive name (e.g., production-backend, staging-agent) so you can identify it later. Copy the key immediately — it won’t be shown again.
Your API key is a secret. Never commit it to source control, embed it in client-side code, or share it in logs.

Using your API key

Include the key in the Authorization header of every request:
curl -X GET https://minns.ai/api/api/health \
  -H "Authorization: Bearer mk_live_abc123..."

With the SDK

Pass your API key when creating the client:
import { createClient } from 'minns-sdk';

const client = createClient({
  baseUrl: "https://minns.ai/api/",
  apiKey: process.env.MINNS_API_KEY,  // Always use environment variables
  autoBatch: true,
  batchInterval: 100,
  batchMaxSize: 20,
});
The SDK automatically attaches the Authorization: Bearer <key> header to every request.

Environment variables

Store your key in an environment variable — never hardcode it:
MINNS_API_KEY=mk_live_abc123...
Then reference it in your code:
const client = createClient({
  baseUrl: "https://minns.ai/api/",
  apiKey: process.env.MINNS_API_KEY,
});

Key rotation

Rotating API keys regularly is a security best practice. Minns Memory Layer supports seamless rotation with zero downtime — you can have multiple active keys at the same time during the transition period.

How to rotate

1

Create a new key

On the project page, go to SettingsAPI Keys and click Create Key. Name it something like production-v2 so you can track the rotation.
2

Deploy the new key

Update your application’s environment variables with the new key. Deploy the change to all instances.
3

Verify the new key is working

Monitor your application logs to confirm requests are succeeding with the new key. Check the API Keys page — you’ll see request counts incrementing on the new key.
4

Revoke the old key

Once you’re confident all traffic has migrated, click the Revoke button next to the old key on the project page. It takes effect immediately.
During rotation, both the old and new keys are valid simultaneously. This gives you time to roll out the new key across all services without any downtime.

Rotation checklist

StepActionVerification
1Create new key on project pageKey appears in the API Keys list
2Update MINNS_API_KEY in all environmentsEnvironment variable updated
3Redeploy applicationAll instances using new key
4Monitor for 24 hoursNo 401 errors in logs
5Revoke old keyOld key shows “Revoked” status

Key types

PrefixEnvironmentUse case
mk_live_ProductionLive agent traffic — full access
mk_test_TestingDevelopment and staging — same API, isolated data
Test keys operate against the same API but use an isolated data namespace. Events ingested with a test key won’t appear in production queries.

Error responses

If authentication fails, the API returns a 401 Unauthorized response:
{
  "error": "unauthorized",
  "message": "Invalid or missing API key. Include a valid key in the Authorization header."
}
Common causes:
ErrorCauseFix
401 UnauthorizedMissing or invalid Authorization headerCheck that the header is Bearer <key> with no extra spaces
401 UnauthorizedKey has been revokedCreate a new key on the project page
403 ForbiddenKey doesn’t have permission for this endpointCheck key permissions in project settings

Security best practices

Use environment variables

Never hardcode API keys. Use .env files locally and secrets managers in production (AWS Secrets Manager, Vault, etc.).

Rotate regularly

Rotate keys every 90 days, or immediately if you suspect a key has been compromised.

Use separate keys per environment

Create distinct keys for development, staging, and production. Revoke dev keys freely without affecting prod.

Audit key usage

Check the project page periodically to see which keys are active and how much traffic each one handles.

Next steps

Quickstart

Get your first event logged in under 5 minutes.

SDK installation

Set up the full SDK with all configuration options.