mindra

Authentication

How to authenticate with the Mindra API

1 min read

Authentication

All Mindra API requests require authentication using an API key passed in the x-api-key header.

Obtaining an API Key

  1. Log in to the Mindra Console
  2. Navigate to your project
  3. Go to Settings → API Keys
  4. Click Create New Key
  5. Copy the key immediately — it won't be shown again

Using Your API Key

Include your API key in the x-api-key header of every request:

curl -X POST https://api.mindra.co/v1/workflows/your-workflow-slug/run \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"task": "Your task description here"}'

Environment Variables

Store your API key securely using environment variables:

# .env
MINDRA_API_KEY=your_api_key_here

Then reference it in your code:

const response = await fetch(
  "https://api.mindra.co/v1/workflows/your-workflow-slug/run",
  {
    method: "POST",
    headers: {
      "x-api-key": process.env.MINDRA_API_KEY,
      "Content-Type": "application/json",
    },
    body: JSON.stringify({ task: "Your task description here" }),
  }
);

Security Best Practices

  • Never commit API keys to version control
  • Use environment variables for all sensitive values
  • Rotate keys regularly from the Console
  • Use separate keys for development and production
  • Scope API keys to specific projects or workflows when possible