Neptune Integration API

Sync products, stock and orders between your system and Neptune: Neptune Shopping (the marketplace) and Neptune App Manager (branded mobile apps).

Overview

The API serves two kinds of integrators with the same endpoints:

You areHow you connectCredential
A commerce platform (a SaaS store builder, an ERP, a marketplace connector) that wants its merchants to sell on NeptuneRegister an app with Neptune, then each merchant approves it through OAuthOne access token per merchant, npat_…
A merchant with your own website or back officeCreate a key in Neptune Partner > API and integrationsA custom key, npk_…

Every credential acts on exactly one account: one Neptune Shopping store, or one App Manager brand. No endpoint takes a store or brand id; the token decides. Base URL:

https://neptune.tn/api/integrations/v1
Only approved accounts can use the API. A store must be approved to sell on Neptune Shopping, a brand must be active, and the person granting access must be its owner. If the store is suspended or ownership changes, every token for it stops working immediately (403 store_not_approved, brand_inactive or owner_changed).

Getting access

Merchants (custom integration)

  1. Sign in to Neptune Partner and open API and integrations.
  2. Choose the store or brand, tick the permissions (scopes) your integration needs, and create the key.
  3. Copy the key and the webhook signing secret. They are shown once; Neptune only keeps a hash of the key.

You can rotate a key (the old one stops at once) or revoke it at any time from the same page. Up to 10 active keys per account.

Platforms (app)

Write to contact@neptune.tn with your company name, website, support email, logo, the exact redirect URLs you will use, the scopes you need and whether you connect stores, brands or both. Neptune reviews the request and gives you a client_id and a client_secret (shown once). Until the app is approved, authorization requests are refused.

Scopes

ScopeAllows
read_productsView your products
write_productsCreate and edit your products
read_inventoryView your inventory
write_inventoryUpdate your inventory
read_ordersView your orders and your customers' delivery details
write_ordersUpdate the status of your orders

A write_ scope includes the matching read_ scope.

Authentication

Send the token on every request, over HTTPS:

curl https://neptune.tn/api/integrations/v1/shop \
  -H "Authorization: Bearer npk_your_key"

Keys are server-side secrets. Never put them in a mobile app, a browser, a public repository or a URL.

OAuth for platforms

Standard OAuth 2.0 authorization code flow. PKCE (S256) is supported and recommended.

1. Send the merchant to Neptune

https://partner.neptune.tn/integrations/oauth/authorize/?response_type=code
  &client_id=npapp_…
  &redirect_uri=https://yourplatform.com/neptune/callback
  &scope=write_products write_inventory write_orders
  &state=RANDOM_VALUE_YOU_CHECK_LATER
  &target=store            (optional: store or brand)
  &code_challenge=…        (optional, PKCE)
  &code_challenge_method=S256

The merchant signs in, picks which of their accounts to connect and approves. redirect_uri must match one of your registered URLs exactly.

2. Neptune redirects back

https://yourplatform.com/neptune/callback?code=…&state=RANDOM_VALUE_YOU_CHECK_LATER

Check that state is the value you sent. If the merchant refused: ?error=access_denied&state=….

3. Exchange the code from your server

curl -X POST https://neptune.tn/api/integrations/v1/oauth/token \
  -d grant_type=authorization_code \
  -d code=… \
  -d redirect_uri=https://yourplatform.com/neptune/callback \
  -d client_id=npapp_… \
  -d client_secret=npsec_… \
  -d code_verifier=…
{
  "access_token": "npat_…",
  "token_type": "bearer",
  "scope": "read_products write_products read_inventory write_inventory read_orders write_orders",
  "installation_id": "3f0c…",
  "target": "store",
  "store_id": "42",
  "store_name": "Boutique Exemple",
  "webhook_secret": "npwhs_…"
}

Codes are single use and expire after 10 minutes. Access tokens do not expire; they end when the merchant disconnects your app, when you call /oauth/revoke, or when the merchant installs your app again (the new token replaces the old one).

Conventions

Shop

GET /shop: the installation (scopes, kind) and the account it acts on: store (id, name, slug, url, currency) or brand (id, name, slug, currency, business_type). Needs no scope. Call it first to know which account a token belongs to.

GET /categories: Neptune Shopping categories, for category_id. Stores only.

Products

PUT/products/external/{external_id}Create or replace. write_products. 201 when created, 200 when updated.
GET/products/external/{external_id}Read by your id. read_products.
DELETE/products/external/{external_id}Archive: off sale, kept for past orders. write_products.
GET/productsEvery product of the account, including the ones the merchant created on Neptune. read_products.
GET/products/{id}Read by Neptune id.

Product body

PUT https://neptune.tn/api/integrations/v1/products/external/SKU-1001
{
  "title": "Sneakers Atlas",
  "description": "Light running shoe.\n\nLeather upper.",
  "price": "189.00",
  "compare_at_price": "229.00",
  "status": "active",
  "track_inventory": true,
  "images": ["https://cdn.example.com/atlas-1.jpg", "https://cdn.example.com/atlas-2.jpg"],
  "options": [
    {"name": "Size", "values": ["40", "41", "42"]},
    {"name": "Color", "values": ["Black", "White"]}
  ],
  "variants": [
    {"external_id": "SKU-1001-40-BLK", "option1": "40", "option2": "Black", "quantity": 3, "sku": "AT40B"},
    {"external_id": "SKU-1001-41-BLK", "option1": "41", "option2": "Black", "quantity": 0, "price": "195.00"}
  ]
}
FieldRules
titleRequired, up to 200 characters.
descriptionPlain text, up to 20,000 characters. HTML tags are removed; blank lines make paragraphs.
priceRequired. With variants, the product shows the lowest variant price.
compare_at_priceOptional "was" price. Ignored unless above the price.
statusactive (on sale), draft (hidden, the default) or archived.
track_inventoryWhen false, the product never runs out (a stock of 999 is shown).
quantityStock for a product without variants.
imagesUp to 10 public https URLs. Store images are downloaded by Neptune within a minute (JPEG, PNG, WebP or GIF, 10 MB max); photos the merchant added on Neptune are kept.
optionsUp to 3, each with up to 100 values. Neptune Shopping shows two of them, size and colour, recognised by name (Size/Taille/Pointure, Color/Couleur); other options are folded into the size label.
variantsUp to 100. Each needs your external_id and one value per option. A variant without price uses the product price.
category_idStores only, from GET /categories.
weightKilograms, optional.
What Neptune keeps for the merchant: homepage placement of store products, and the visibility, position and collections of App Manager products. A PUT never changes them. Brands have a plan product limit: creating past it returns 409 plan_limit_reached; updates always work.

Inventory

POST /inventory/set with write_inventory: absolute stock levels, up to 250 per call.

{
  "items": [
    {"product_external_id": "SKU-1001", "variant_external_id": "SKU-1001-40-BLK", "quantity": 7},
    {"product_external_id": "MUG-7", "quantity": 120}
  ]
}

The answer lists every item with result: updated, product_not_found, variant_not_found, or variant_required (the product has variants; send the variant). One bad item does not stop the others.

Neptune also lowers stock itself when it sells. Push your levels after every change on your side, and use the order webhooks to lower stock in your system when Neptune sells.

Orders

GET/ordersOrders containing the account's products. Filters: status, updated_at_min, cursor. read_orders.
GET/orders/{id}One order. Brands also accept the order number.
PATCH/orders/{id}Change status, payment_status (brands) and your external_id. write_orders.

An order shows only the lines of the account's own products, the customer's name and phone, and the delivery address: what the merchant sees in their dashboard. Each line carries your product_external_id and variant_external_id when the product came from you.

Neptune Shopping store orders

Statuses: pending → processing → shipped → delivered, or cancelled.

App Manager brand orders

Statuses: pending, confirmed, processing, ready (restaurants), shipped, delivered, cancelled, failed, refunded. Payment statuses: pending, authorized, paid, failed, refunded. Restaurants follow their kitchen flow: a change it does not allow returns 409 invalid_status_transition with the allowed next statuses. The customer gets a push notification on every status change, exactly as when the merchant changes it in App Manager.

PATCH https://neptune.tn/api/integrations/v1/orders/1234
{"status": "processing", "external_id": "WEB-55012"}

Webhooks

Subscribe once per topic. Neptune POSTs JSON to your HTTPS URL.

TopicNeedsSent when
order.createdread_ordersA new order contains the account's products
order.updatedread_ordersAn order's status changes
order.cancelledread_ordersAn order is cancelled (also sent as order.updated)
app.uninstallednoneThe merchant disconnected your app; the token no longer works
POST https://neptune.tn/api/integrations/v1/webhooks
{"topic": "order.created", "url": "https://yourplatform.com/hooks/neptune"}

GET    https://neptune.tn/api/integrations/v1/webhooks
DELETE https://neptune.tn/api/integrations/v1/webhooks/{id}

Delivery

POST https://yourplatform.com/hooks/neptune
Content-Type: application/json
X-Neptune-Topic: order.created
X-Neptune-Event-Id: 7c1d…            (same for every retry of this event)
X-Neptune-Installation-Id: 3f0c…
X-Neptune-Signature: t=1767225600,v1=5f2b…

{"id": "7c1d…", "topic": "order.created", "created_at": "…", "installation_id": "3f0c…", "data": { …order… }}

Verifying the signature

Compute HMAC-SHA256 of "<t>.<raw body>" with your webhook secret, compare in constant time with v1, and reject timestamps older than 5 minutes.

# Python
import hashlib, hmac, time

def verify(secret: str, header: str, raw_body: bytes) -> bool:
    parts = dict(p.split("=", 1) for p in header.split(","))
    if abs(time.time() - int(parts["t"])) > 300:
        return False
    expected = hmac.new(secret.encode(), f'{parts["t"]}.'.encode() + raw_body, hashlib.sha256).hexdigest()
    return hmac.compare_digest(expected, parts["v1"])
// Node.js
const crypto = require("crypto");
function verify(secret, header, rawBody) {
  const parts = Object.fromEntries(header.split(",").map(p => p.split("=")));
  if (Math.abs(Date.now() / 1000 - Number(parts.t)) > 300) return false;
  const expected = crypto.createHmac("sha256", secret).update(`${parts.t}.`).update(rawBody).digest("hex");
  return crypto.timingSafeEqual(Buffer.from(expected), Buffer.from(parts.v1));
}
// PHP
function verify(string $secret, string $header, string $rawBody): bool {
    parse_str(str_replace(',', '&', $header), $parts);
    if (abs(time() - (int)$parts['t']) > 300) return false;
    $expected = hash_hmac('sha256', $parts['t'] . '.' . $rawBody, $secret);
    return hash_equals($expected, $parts['v1']);
}

Uninstalling

When a merchant removes the Neptune connection on your side, call POST /oauth/revoke with their token. The token stops working at once. When they disconnect your app on Neptune's side, you receive app.uninstalled.

Products already created stay on Neptune: a disconnected store's products remain in the merchant's catalog, where they manage them by hand.

Errors

{"error": {"code": "validation_failed", "message": "Some fields are invalid.",
           "details": {"fields": {"price": "This field is required.", "variants[1].option2": "Must be one of the values of option \"Color\"."}}}}
HTTPcodeMeaning
400invalid_json, invalid_body, invalid_parameterThe request itself is malformed.
401missing_token, invalid_tokenNo token, or a revoked one.
403missing_scopeThe token lacks the scope in details.required_scope.
403store_not_approved, brand_inactive, owner_changed, app_suspendedThe account or app may not use the API right now.
404not_foundUnknown id, or one that belongs to another account.
409plan_limit_reached, managed_by_neptune, already_collected, invalid_transition, invalid_status_transition, limit_reachedValid request, refused by the business rules.
422validation_failedSee details.fields.
429rate_limitedWait Retry-After seconds.

Retry 429 and 5xx with exponential backoff. Do not retry other 4xx without fixing the request.

Security checklist

Version 1. Changes that could break an integration will ship under /api/integrations/v2/; v1 then stays available for at least 6 months. New fields may be added to responses at any time: ignore fields you do not know.