1Base URL & format
Every request and response uses JSON. Send files (like product images) as multipart/form-data.
https://melaapps.com/api/v12Authentication
Every merchant (vendor) authenticates once with their Melaapps email and password, and gets back a bearer token. Use that token on every request that follows.
/vendor/login| Field | Type | Notes |
|---|---|---|
email | string | required |
password | string | required (min. 6 characters) |
vendor_type | string | required — owner |
Response: { "token": "...", "module_type": "..." }. Send that token as Authorization: Bearer <token> on every following request.
curl -X POST https://melaapps.com/api/v1/vendor/login \
-H "Content-Type: application/json" \
-d '{
"email": "vendor@example.com",
"password": "your-password",
"vendor_type": "owner"
}'
<?php
$response = file_get_contents_curl('https://melaapps.com/api/v1/vendor/login', [
'email' => 'vendor@example.com',
'password' => 'your-password',
'vendor_type' => 'owner',
]);
function file_get_contents_curl($url, $data) {
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$body = curl_exec($ch);
curl_close($ch);
return json_decode($body, true);
}
$token = $response['token'];
import requests
resp = requests.post(
"https://melaapps.com/api/v1/vendor/login",
json={
"email": "vendor@example.com",
"password": "your-password",
"vendor_type": "owner",
},
)
token = resp.json()["token"]
using var client = new HttpClient();
var payload = new {
email = "vendor@example.com",
password = "your-password",
vendor_type = "owner"
};
var response = await client.PostAsJsonAsync(
"https://melaapps.com/api/v1/vendor/login", payload);
var json = await response.Content.ReadFromJsonAsync<JsonElement>();
string token = json.GetProperty("token").GetString();
3Create & update products
Use these two endpoints to push your catalog into Melaapps — the same ones our own Shopify, WooCommerce and Meta connectors use internally.
/vendor/item/store — create a new product/vendor/item/update — update an existing product (needs id)| Field | Type | Notes |
|---|---|---|
category_id | int | required |
price | number | required |
discount | number | optional, ≥ 0 |
discount_type | string | optional — amount or percent |
translations | JSON string | required — array of {locale, key, value}, index 0 = name, index 1 = description |
image | file | required on create, unless your store module is "food" |
id | int | required on update only |
translations must be a JSON-encoded string (not a nested object), e.g. [{"locale":"en","key":"name","value":"T-Shirt"},{"locale":"en","key":"description","value":"100% cotton"}].curl -X POST https://melaapps.com/api/v1/vendor/item/store \
-H "Authorization: Bearer $TOKEN" \
-F "category_id=12" \
-F "price=19.99" \
-F "discount=0" \
-F "discount_type=amount" \
-F 'translations=[{"locale":"en","key":"name","value":"T-Shirt"},{"locale":"en","key":"description","value":"100% cotton"}]' \
-F "image=@/path/to/photo.jpg"
<?php
$translations = json_encode([
['locale' => 'en', 'key' => 'name', 'value' => 'T-Shirt'],
['locale' => 'en', 'key' => 'description', 'value' => '100% cotton'],
]);
$ch = curl_init('https://melaapps.com/api/v1/vendor/item/store');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, ["Authorization: Bearer $token"]);
curl_setopt($ch, CURLOPT_POSTFIELDS, [
'category_id' => 12,
'price' => 19.99,
'discount' => 0,
'discount_type' => 'amount',
'translations' => $translations,
'image' => new CURLFile('/path/to/photo.jpg'),
]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$body = curl_exec($ch);
import requests, json
translations = json.dumps([
{"locale": "en", "key": "name", "value": "T-Shirt"},
{"locale": "en", "key": "description", "value": "100% cotton"},
])
with open("/path/to/photo.jpg", "rb") as f:
resp = requests.post(
"https://melaapps.com/api/v1/vendor/item/store",
headers={"Authorization": f"Bearer {token}"},
data={
"category_id": 12,
"price": 19.99,
"discount": 0,
"discount_type": "amount",
"translations": translations,
},
files={"image": f},
)
print(resp.json())
using var client = new HttpClient();
client.DefaultRequestHeaders.Authorization =
new AuthenticationHeaderValue("Bearer", token);
var translations = JsonSerializer.Serialize(new[] {
new { locale = "en", key = "name", value = "T-Shirt" },
new { locale = "en", key = "description", value = "100% cotton" },
});
using var form = new MultipartFormDataContent();
form.Add(new StringContent("12"), "category_id");
form.Add(new StringContent("19.99"), "price");
form.Add(new StringContent("0"), "discount");
form.Add(new StringContent("amount"), "discount_type");
form.Add(new StringContent(translations), "translations");
form.Add(new StreamContent(File.OpenRead("photo.jpg")), "image", "photo.jpg");
var response = await client.PostAsync(
"https://melaapps.com/api/v1/vendor/item/store", form);
4Point-of-sale orders
Have your own POS software? These endpoints let you push a sale straight into Melaapps as an order, and look up existing customers.
/vendor/pos/place-order| Field | Type | Notes |
|---|---|---|
store_id | int | required |
payment_method | string | required |
paid_amount | number | required |
cart | JSON string | required — array of line items |
/vendor/pos/orders — list your POS/take-away orders/vendor/pos/customers?search= — look up an existing customer by name or phone5Other useful endpoints
| Endpoint | Notes |
|---|---|
GET/vendor/categories | Your store's real category tree in Melaapps — use it to map your own categories before syncing products. |
DELETE/vendor/item/delete | Remove a product — send its id. |
GET/vendor/item/status | Enable/disable a product — send id and status (0 or 1). |
6Errors
Validation errors come back as HTTP 402/403/422 with a JSON body shaped like this — check errors[].message for a human-readable reason:
{
"errors": [
{ "code": "category_id", "message": "The category id field is required." }
]
}
DEVELOPERS