License integration for MT5

Full interactive reference: OpenAPI / Swagger · ReDoc · openapi.json

1. Validate a license

POST https://pipdepot.com/api/v1/license/validate
Content-Type: application/json

{"license_key":"PD-XXXXX-XXXXX-XXXXX-XXXXX-XXXXX","product":"trade-copier-master-slave","account":"12345678"}

→ {"valid":true,"reason":"ok","product":"trade-copier-master-slave","expires_at":"2026-12-15 10:00:00","accounts_used":1,"max_accounts":4,"server_time":"…"}

Reasons when valid=false: not_found, wrong_product, revoked, expired, account_limit.

Simpler for MQL5: GET /api/v1/license/validate?key=…&product=…&account=…&format=text → VALID|2026-12-15 10:00:00 or INVALID|expired.

2. MQL5 snippet

In MT5: Tools → Options → Expert Advisors → tick "Allow WebRequest for listed URL" and add https://pipdepot.com.

input string LicenseKey = "";
string LicenseUrl = "https://pipdepot.com/api/v1/license/validate";
string ProductSlug = "your-product-slug";

bool CheckLicense()
{
   string url = LicenseUrl + "?format=text&key=" + LicenseKey + "&product=" + ProductSlug +
                "&account=" + IntegerToString(AccountInfoInteger(ACCOUNT_LOGIN));
   char post[], result[]; string headers;
   ResetLastError();
   int code = WebRequest("GET", url, "", 5000, post, result, headers);
   if(code != 200) { Print("License check failed, HTTP ", code, " err ", GetLastError()); return false; }
   string body = CharArrayToString(result);
   if(StringFind(body, "VALID|") == 0) return true;
   Print("License invalid: ", body);
   return false;
}

int OnInit()
{
   if(!CheckLicense()) return INIT_FAILED;
   EventSetTimer(3600);           // re-check hourly
   return INIT_SUCCEEDED;
}
void OnTimer() { if(!CheckLicense()) ExpertRemove(); }

3. Seller API (X-API-Key)

curl -H "X-API-Key: thk_…" https://pipdepot.com/api/v1/seller/products
curl -H "X-API-Key: thk_…" "https://pipdepot.com/api/v1/seller/licenses?product=your-product-slug"
curl -X POST -H "X-API-Key: thk_…" -H "Content-Type: application/json" \
     -d '{"license_key":"PD-…"}' https://pipdepot.com/api/v1/seller/licenses/revoke

Create keys in your seller dashboard.