Public API — Beta

Connect your own system, in any language

This is a plain REST API over HTTP/JSON — it doesn't matter if your POS, ERP or custom software is written in PHP, Python, .NET, Java or anything else. If it can make an HTTP request, it can talk to Melaapps.

Direct integration requires approval

The endpoints below are documented so you can see exactly what you'd be building against, but connecting your own system requires our sign-off first. Tell us about your integration and we'll get back to you.

1Base URL & format

Every request and response uses JSON. Send files (like product images) as multipart/form-data.

https://melaapps.com/api/v1

2Authentication

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.

POST/vendor/login
FieldTypeNotes
emailstringrequired
passwordstringrequired (min. 6 characters)
vendor_typestringrequiredowner

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.

POST/vendor/item/store — create a new product
PUT/vendor/item/update — update an existing product (needs id)
FieldTypeNotes
category_idintrequired
pricenumberrequired
discountnumberoptional, ≥ 0
discount_typestringoptionalamount or percent
translationsJSON stringrequiredarray of {locale, key, value}, index 0 = name, index 1 = description
imagefilerequired on create, unless your store module is "food"
idintrequired on update only
Note: 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.

POST/vendor/pos/place-order
FieldTypeNotes
store_idintrequired
payment_methodstringrequired
paid_amountnumberrequired
cartJSON stringrequiredarray of line items
GET/vendor/pos/orders — list your POS/take-away orders
GET/vendor/pos/customers?search= — look up an existing customer by name or phone

5Other useful endpoints

EndpointNotes
GET/vendor/categoriesYour store's real category tree in Melaapps — use it to map your own categories before syncing products.
DELETE/vendor/item/deleteRemove a product — send its id.
GET/vendor/item/statusEnable/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." }
  ]
}

Building an integration?

Tell us what you're connecting — POS, ERP, or your own platform — and we'll help you get a vendor token to test against.

Get in touch