# Mangrove Strategy Ensure

> Mangrove Strategy Ensure is a paid API for AI agents from api.mangrovedeveloper.ai, paid per call via x402, $0.005/call, status unknown (last checked 2026-11-04).

Creates or updates a named trading strategy definition with entry/exit rules, execution config, and risk parameters on the Mangrove platform.

## Facts

- Endpoint: POST https://api.mangrovedeveloper.ai/api/v1/strategies/ensure?utm_source=zero.xyz
- Price: $0.005/call
- Payment: x402
- Status: unknown
- Last checked: 2026-11-04
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/mangrove-strategy-ensure-48ea6575
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_ibeyPptWylABXRpg395cH

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability mangrove-strategy-ensure-48ea6575 -d '<json body>'
```

Example prompt: Ensure a Mangrove trading strategy called 'BTC-Momentum-v1' for asset BTC with USDC as the quote token, strategy type 'momentum', using v2 position sizing, an ATR period of 14, max drawdown limit of 0.15, and max trades per day of 5 — with the entry rules set to buy on 20-day breakout and exit on trailing stop.

## When to prefer this

Use this endpoint when you need to idempotently create or update a fully-specified algorithmic trading strategy on Mangrove, including its entry/exit logic, risk parameters, and execution configuration. Prefer this over a plain create when you want upsert semantics — the strategy will be created if it doesn't exist or updated if it does. This is the right endpoint when configuring automated crypto trading agents that need reproducible, version-controlled strategy definitions.

## Known failure modes

- Invalid asset or quote token symbol returns a validation error
- Missing required fields like name or strategy_type may return 400 Bad Request
- Conflicting parent_strategy_id or org_id returns a not-found or authorization error
- Malformed entry/exit rule objects return schema validation errors
- Payment not included or insufficient USDC balance returns 402 Payment Required

## How this service works

Developer references for Mangrove Agent, API contracts, MCP and AI integrations.

## Output

Returns the persisted strategy object including its assigned strategy ID, current status, execution state, and all configured fields such as entry/exit rules, execution config parameters, position sizing method, and metadata like org_id and session_id.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "exit": {
   "type": "array",
   "items": {
    "type": "object"
   }
  },
  "name": {
   "type": "string"
  },
  "asset": {
   "type": "string"
  },
  "entry": {
   "type": "array",
   "items": {
    "type": "object"
   }
  },
  "rules": {
   "type": "array",
   "items": {
    "type": "object"
   }
  },
  "org_id": {
   "type": "string"
  },
  "status": {
   "type": "string"
  },
  "timeframe": {
   "type": "string"
  },
  "exit_short": {
   "type": "array",
   "items": {
    "type": "object"
   }
  },
  "session_id": {
   "type": "string"
  },
  "description": {
   "type": "string"
  },
  "entry_short": {
   "type": "array",
   "items": {
    "type": "object"
   }
  },
  "quote_token": {
   "type": "string"
  },
  "reward_factor": {
   "type": "number"
  },
  "strategy_type": {
   "type": "string"
  },
  "execution_state": {
   "type": "object"
  },
  "execution_config": {
   "type": "object",
   "properties": {
    "atr_period": {},
    "stop_model": {},
    "cooldown_bars": {},
    "max_hold_bars": {},
    "reward_factor": {},
    "cooldown_model": {},
    "rebalance_band": {},
    "taker_fee_rate": {},
    "atr_long_weight": {},
    "circuit_breaker": {},
    "cooldown_config": {},
    "initial_balance": {},
    "volatility_mode": {},
    "atr_short_weight": {},
    "max_trade_amount": {},
    "min_balance_days": {},
    "min_cash_balance": {},
    "min_trade_amount": {},
    "min_asset_balance": {},
    "target_volatility": {},
    "volatility_window": {},
    "atr_cap_multiplier": {},
    "max_drawdown_limit": {},
    "max_open_positions": {},
    "max_risk_per_trade": {},
    "max_trades_per_day": {},
    "position_size_calc": {},
    "stop_gap_allowance": {},
    "max_hold_time_hours": {},
    "max_units_per_trade": {},
    "target_asset_weight": {},
    "daily_momentum_limit": {},
    "profit_threshold_pct": {},
    "volatility_tolerance": {},
    "atr_volatility_factor": {},
    "min_balance_threshold": {},
    "min_stop_distance_pct": {},
    "weekly_momentum_limit": {},
    "exit_on_loss_after_bars": {},
    "max_drawdown_halt_limit": {},
    "exit_on_profit_after_bars": {},
    "enable_volatility_adjustment": {}
   }
  },
  "market_data_venue": {
   "type": "string"
  },
  "parent_strategy_id": {
   "type": "string"
  },
  "position_size_calc": {
   "enum": [
    "v1",
    "v2",
    "v3"
   ],
   "type": "string"
  }
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/mangrove-strategy-ensure-48ea6575/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from api.mangrovedeveloper.ai](https://www.zero.xyz/host/api.mangrovedeveloper.ai/llms.txt)
