API Referencev1.0

Programmatic access to the Mindlyr Decision Engine.

Authentication

All API requests must be authenticated using an API Key. You can generate keys in your Dashboard Settings.

Header
x-api-key: mk_live_xxxxxxxxxxxxxxx

Executing a Decision

Post/api/v1/execute

The primary endpoint for Mindlyr. Evaluates a rule against the provided context.

Request Body

rule_aliasRequired
string

The unique identifier (SLUG) of the rule (e.g., "lead-scoring").

contextRequired
object

The input data to be evaluated. Can be any valid JSON object.

environment
string

Optional. "PRODUCTION" (default) or "STAGING".

Example CURL
curl -X POST https://api.mindlyr.com/api/v1/execute \
  -H "x-api-key: pk_live_your_key" \
  -H "Content-Type: application/json" \
  -d '{
    "rule_alias": "pricing-engine",
    "context": {
      "quantity": 10,
      "user_plan": "pro"
    }
  }'
Success Response
{
  "success": true,
  "result": {
    "discount": 0.15,
    "final_price": 85.00
  },
  "metadata": {
    "decision_id": "dec_abc123",
    "executed_at": "2024-12-16T20:00:00Z",
    "duration_ms": 12,
    "trace_id": "req_xyz789"
  }
}

Error Handling

Mindlyr uses standard HTTP response codes.

400

Bad Request

Invalid JSON payload or failed schema validation.

401

Unauthorized

Invalid or missing x-api-key.

404

Not Found

The rule slug provided does not exist.

429

Too Many Requests

Rate limit exceeded for your organization.

500

Server Error

An unexpected error occurred in Mindlyr.