Ordexs API v1 Get an API key

Get started

Quickstart

Create a test key, add a product, price an order and place it, in about ten minutes.

This walks through the calls almost every integration makes, in test mode, so nothing reaches a real customer or courier. Every step is a plain HTTPS request: use curl as shown, or the Node, PHP and Python versions on each reference page.

1. Create a test key

In the Ordexs dashboard open Settings → Developers → API keys → Create key. Pick Test, choose the Full access preset, and copy the key. It is shown once.

export ORDEXS_API_KEY="ordx_test_…"

2. Check the key

curl https://api.ordexs.com/v1/store \
  -H "Authorization: Bearer $ORDEXS_API_KEY"

The response tells you the store's country and currency. Note the currency's exponent: it is how many decimals every amount has.

3. Add a product

A test store starts with no products, so create one with two variants:

curl -X POST https://api.ordexs.com/v1/products \
  -H "Authorization: Bearer $ORDEXS_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
    "title": "Linen shirt",
    "status": "published",
    "options": [{ "name": "Size", "values": ["M", "L"] }],
    "variants": [
      { "options": { "Size": "M" }, "price": "3500.00", "inventory_quantity": 10 },
      { "options": { "Size": "L" }, "price": "3500.00", "inventory_quantity": 6 }
    ]
  }'

Keep the id of one variant (var_…) from the response.

4. Find the delivery price

Cash-on-delivery orders need a destination the store delivers to. List the regions of the store's country, then ask what delivery to one of them costs:

curl "https://api.ordexs.com/v1/regions?country=DZ" \
  -H "Authorization: Bearer $ORDEXS_API_KEY"

curl "https://api.ordexs.com/v1/delivery/rates?region=16" \
  -H "Authorization: Bearer $ORDEXS_API_KEY"

Each rate has a mode (home or pickup_point), a price and the courier that delivers it.

5. Preview, then place the order

POST /v1/orders/preview prices an order exactly as checkout would (offers, discount code, delivery, stock) without saving anything. Show the total to the customer, then send the same body to POST /v1/orders:

curl -X POST https://api.ordexs.com/v1/orders \
  -H "Authorization: Bearer $ORDEXS_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
    "customer": { "name": "Yacine Benali", "phone": "0551234567" },
    "shipping_address": { "region": "16", "city": "Bab El Oued", "address1": "12 rue Ali Boumendjel" },
    "delivery": { "mode": "home" },
    "line_items": [{ "variant_id": "var_…", "quantity": 1 }],
    "external_id": "my-system-1001",
    "source_name": "quickstart"
  }'

You never send a price: the store prices every line. The order arrives as pending with a number like ORD-00042, exactly like a storefront order.

6. Listen for what happens next

Create a test webhook endpoint under Settings → Developers → Webhooks and subscribe it to order.status_changed. When the order is confirmed, shipped or delivered, Ordexs posts the order to your URL. Read Receiving webhooks and Verifying signatures.

Going live

When it all works, create a live key with only the scopes your integration needs, and a live webhook endpoint. The code doesn't change: the key decides which store you talk to.