API

Shape Leaf Left
Shape Leaf Right

HECMS API – Try It Yourself

Upload your own image and see HECMS in action.

πŸ“· Upload your image
(Max: 15MB, JPEG/PNG)

πŸ“Š 2500 Public API calls remaining today
Usage date: 2025-06-21 (UTC)

πŸ“’ We provide 2500 public API calls per day for testing. This quota is shared across all users, so please use it wisely and responsibly.

API Response:
{ "response": "Waiting for input..." }

Need Enterprise API Access or Want to Build Your Own API?

We help businesses scale with secure, high-performance APIs β€” or bring your custom ideas to life with full-cycle API development.

Developer Guides: Build, Integrate, Deploy

Explore the Mpowerr Docs to learn how to connect, send API requests, and handle responses. These guides are built to help developers integrate and deploy quickly.

πŸ”— API Endpoint

POST https://api.hecms.mpowerr.com/public/v1/detect

πŸ“₯ Request Format

POST /public/v1/detect HTTP/1.1
Host: api.hecms.mpowerr.com
Content-Type: multipart/form-data

Form Data:
  image:    (Required. JPEG or PNG image)

πŸ“€ Example API Response – Success

This is the typical response when elephants are successfully detected in the uploaded image.

{
  "elephant_count": 2,
  "coordinates": [
    { "x1": 120, "y1": 80, "x2": 340, "y2": 400 },
    { "x1": 450, "y1": 90, "x2": 700, "y2": 410 }
  ],
  "message": "Elephants detected"
}

πŸ“€ Example API Response – No Elephants Detected

If no elephants are found in the uploaded image, the API returns the following structure:

{
  "elephant_count": 0,
  "coordinates": [],
  "message": "No elephants detected"
}

🐧 cURL Example (Linux Terminal)

curl -X POST https://api.hecms.mpowerr.com/public/v1/detect \
  -H "Content-Type: multipart/form-data" \
  -F "image=@image-1.png"

πŸͺŸ cURL Example (Windows CMD)

curl -X POST https://api.hecms.mpowerr.com/public/v1/detect ^
  -H "Content-Type: multipart/form-data" ^
  -F "image=@image-1.png"

🧩 cURL Example (Windows CMD + SSL Fix)

Use --ssl-no-revoke if you're encountering SSL certificate issues on Windows environments.

curl -X POST https://api.hecms.mpowerr.com/public/v1/detect ^
  -H "Content-Type: multipart/form-data" ^
  -F "image=@image-1.png" ^
  --ssl-no-revoke

🐍 Python Example (Using requests)

Here's how to send an image to the API using Python and the requests library.

import requests

url = "https://api.hecms.mpowerr.com/public/v1/detect"
files = {
    "image": open("image-1.png", "rb")
}

response = requests.post(url, files=files)

if response.ok:
    print(response.json())
else:
    print("Error:", response.status_code)

🟨 JavaScript Example (Using Fetch)

Here's how to upload an image to the API using JavaScript's fetch method in the browser.

const formData = new FormData();
formData.append("image", document.querySelector("#imageInput").files[0]);

fetch("https://api.hecms.mpowerr.com/public/v1/detect", {
  method: "POST",
  body: formData
})
.then(response => response.json())
.then(data => {
  console.log("Success:", data);
})
.catch(error => {
  console.error("Error:", error);
});

🐘 PHP Example (Using cURL)

Here's how to send an image to the API using PHP and the built-in cURL extension.

<?php
$api_url = "https://api.hecms.mpowerr.com/public/v1/detect";
$image_path = "image-1.png";

$curl = curl_init();

curl_setopt_array($curl, [
    CURLOPT_URL => $api_url,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_POST => true,
    CURLOPT_POSTFIELDS => [
        "image" => new CURLFile($image_path)
    ]
]);

$response = curl_exec($curl);

if (curl_errno($curl)) {
    echo "cURL Error: " . curl_error($curl);
} else {
    echo "<pre>" . json_encode(json_decode($response), JSON_PRETTY_PRINT) . "</pre>";
}

curl_close($curl);
?>

🟩 Node.js Example (Axios + FormData)

Upload an image to the API in Node.js using axios and form-data.

const axios = require("axios");
const FormData = require("form-data");
const fs = require("fs");

const form = new FormData();
form.append("image", fs.createReadStream("image-1.png"));

axios.post("https://api.hecms.mpowerr.com/public/v1/detect", form, {
  headers: form.getHeaders()
})
.then(response => {
  console.log("Response:", response.data);
})
.catch(error => {
  console.error("Error:", error.message);
});

πŸ“± React Native Example (Fetch)

Upload an image from a React Native app using fetch.

const formData = new FormData();
formData.append("image", {
  uri: "file:///path/to/image.png",
  name: "image.png",
  type: "image/png"
});

fetch("https://api.hecms.mpowerr.com/public/v1/detect", {
  method: "POST",
  body: formData,
  headers: {
    "Content-Type": "multipart/form-data"
  }
})
.then(res => res.json())
.then(data => console.log(data))
.catch(err => console.error(err));

πŸ’™ Flutter Example (Dart)

Upload an image using Flutter with the http package.

import 'package:http/http.dart' as http;
import 'dart:io';

final request = http.MultipartRequest(
  'POST',
  Uri.parse('https://api.hecms.mpowerr.com/public/v1/detect'),
);

request.files.add(await http.MultipartFile.fromPath(
  'image',
  '/path/to/image.png',
  contentType: MediaType('image', 'png'),
));

final response = await request.send();
final respStr = await response.stream.bytesToString();
print(respStr);

β˜• Java Example (CLI-style, Shortened)

A simple way to call the API using Java and HttpURLConnection with an image file.

String boundary = "===" + System.currentTimeMillis() + "===";
URL url = new URL("https://api.hecms.mpowerr.com/public/v1/detect");
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestMethod("POST");
conn.setDoOutput(true);
conn.setRequestProperty("Content-Type", "multipart/form-data; boundary=" + boundary);

OutputStream out = conn.getOutputStream();
PrintWriter writer = new PrintWriter(new OutputStreamWriter(out, "UTF-8"), true);
writer.append("--" + boundary + "\r\n");
writer.append("Content-Disposition: form-data; name=\"image\"; filename=\"image-1.png\"\r\n");
writer.append("Content-Type: image/png\r\n\r\n").flush();

Files.copy(Paths.get("image-1.png"), out);
out.flush();
writer.append("\r\n--" + boundary + "--\r\n").flush();
writer.close();

BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream()));
String line; while ((line = in.readLine()) != null) System.out.println(line);
in.close();

πŸ€– Kotlin Example (Android + OkHttp)

Send an image file using OkHttp in a native Android app (Kotlin).

val client = OkHttpClient()

val file = File("/path/to/image.png")
val requestBody = MultipartBody.Builder()
    .setType(MultipartBody.FORM)
    .addFormDataPart("image", file.name, file.asRequestBody("image/png".toMediaType()))
    .build()

val request = Request.Builder()
    .url("https://api.hecms.mpowerr.com/public/v1/detect")
    .post(requestBody)
    .build()

client.newCall(request).enqueue(object : Callback {
    override fun onFailure(call: Call, e: IOException) {
        e.printStackTrace()
    }

    override fun onResponse(call: Call, response: Response) {
        println(response.body?.string())
    }
})

🧩 C# Example (HttpClient)

Upload an image to the API using HttpClient in .NET.

using var client = new HttpClient();
var form = new MultipartFormDataContent();
var image = new ByteArrayContent(File.ReadAllBytes("image-1.png"));
image.Headers.ContentType = new MediaTypeHeaderValue("image/png");
form.Add(image, "image", "image-1.png");

var response = await client.PostAsync("https://api.hecms.mpowerr.com/public/v1/detect", form);
var result = await response.Content.ReadAsStringAsync();
Console.WriteLine(result);

🐹 Go Example (net/http)

Call the API in Go using multipart.Writer and http.NewRequest.

package main

import (
  "bytes"
  "fmt"
  "io"
  "mime/multipart"
  "net/http"
  "os"
)

func main() {
  file, _ := os.Open("image-1.png")
  defer file.Close()

  body := &bytes.Buffer{}
  writer := multipart.NewWriter(body)
  part, _ := writer.CreateFormFile("image", "image-1.png")
  io.Copy(part, file)
  writer.Close()

  req, _ := http.NewRequest("POST", "https://api.hecms.mpowerr.com/public/v1/detect", body)
  req.Header.Set("Content-Type", writer.FormDataContentType())

  client := &http.Client{}
  resp, _ := client.Do(req)
  defer resp.Body.Close()
  io.Copy(os.Stdout, resp.Body)
}

πŸ’Ž Ruby Example (Net::HTTP)

Use Net::HTTP to send an image via multipart form.

require "net/http"
require "uri"

uri = URI("https://api.hecms.mpowerr.com/public/v1/detect")
request = Net::HTTP::Post::Multipart.new(uri.path, {
  "image" => UploadIO.new(File.open("image-1.png"), "image/png", "image-1.png")
})

response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
  http.request(request)
end

puts response.body

🍏 Swift Example (URLSession)

Upload an image using Swift and URLSession.

let url = URL(string: "https://api.hecms.mpowerr.com/public/v1/detect")!
var request = URLRequest(url: url)
request.httpMethod = "POST"

let boundary = UUID().uuidString
request.setValue("multipart/form-data; boundary=\(boundary)", forHTTPHeaderField: "Content-Type")

var body = Data()
// Append image file (image-1.png)
let fileURL = Bundle.main.url(forResource: "image-1", withExtension: "png")!
if let imageData = try? Data(contentsOf: fileURL) {
  body.append("--\(boundary)\r\n".data(using: .utf8)!)
  body.append("Content-Disposition: form-data; name=\"image\"; filename=\"image-1.png\"\r\n".data(using: .utf8)!)
  body.append("Content-Type: image/png\r\n\r\n".data(using: .utf8)!)
  body.append(imageData)
  body.append("\r\n--\(boundary)--\r\n".data(using: .utf8)!)
}

let task = URLSession.shared.uploadTask(with: request, from: body) { data, response, error in
  if let data = data {
    print(String(data: data, encoding: .utf8)!)
  }
}
task.resume()

πŸ’» C/C++ Example (Using libcurl)

Send an image to the API in C or C++ using libcurl for lightweight, embedded, or native system integration.

#include <curl/curl.h>

int main() {
    CURL *curl = curl_easy_init();
    if (!curl) return 1;

    curl_mime *form = curl_mime_init(curl);
    curl_mimepart *field = curl_mime_addpart(form);
    curl_mime_name(field, "image");
    curl_mime_filedata(field, "image-1.png");

    curl_easy_setopt(curl, CURLOPT_URL, "https://api.hecms.mpowerr.com/public/v1/detect");
    curl_easy_setopt(curl, CURLOPT_MIMEPOST, form);

    curl_easy_perform(curl);

    curl_mime_free(form);
    curl_easy_cleanup(curl);
    return 0;
}

πŸ“Š 2500 Public API calls remaining today
Usage date: 2025-06-21 (UTC)

πŸ“’ We provide 2500 public API calls per day for testing. This quota is shared across all users, so please use it wisely and responsibly.

πŸ“Œ Final Note:
We’ve included practical examples in several widely-used programming languages to help you get started quickly β€” including Python, JavaScript, PHP, Java, C/C++, Swift, Dart, Node.js, and more.

Since this API follows standard HTTP protocols and accepts multipart/form-data for file uploads, it is universally compatible with any language or platform that supports HTTP requests. Whether you're developing for web, mobile, desktop, or embedded systems, this flexibility allows seamless integration into any environment.

Feel free to adapt, extend, or automate the workflow to fit your specific use case β€” from AI-powered mobile apps to backend inference pipelines. Build with confidence across your entire tech stack.

For any issues, feedback, or support, please contact us.