Connect your website (API)
Your own website (WooCommerce, Shopify, a custom site…) can show your products with their real stock and send its orders to AFASIN Pro. Give your web developer an API key and this page.
1. Create a key (shop Admin)
- Go to Settings → Website Settings → Website & API and click Create API Key.
- Name it (e.g. “My website”) and choose Read only (products and stock) or Read & orders.
- Copy the key at once (it starts with
afk_): it is shown only once. Revoke it from the same page if it leaks.
2. Call the API (developer)
Base URL https://pro.afasin.com/api/v1, header Authorization: Bearer afk_…, JSON in and out. Call it from the website's server only. Limit: 120 requests per minute per key.
GET /products?updated_since=…&limit=100&offset=0 | Products: sku, barcode, name, description, category, sub_category, brand, unit, price, stock, image_url, variant_of, variant_values. With updated_since, removed products come back with "active": false. |
GET /products/{sku} | One product by SKU, barcode or id. |
GET /stock?sku=AF000001,AF000002 | Stock and price of up to 200 products (or ?barcode=). |
POST /orders | Creates an order and takes the stock. Answers 409 insufficient_stock if a product is short, 409 duplicate if the reference was already sent. |
GET /orders/{ref} | Status: new, accepted, ready, shipped, completed, cancelled or refused. |
POST /orders/{ref}/cancel | Cancels an order not shipped yet (the stock comes back). |
Example of order:
curl -X POST https://pro.afasin.com/api/v1/orders \
-H "Authorization: Bearer afk_…" -H "Content-Type: application/json" \
-d '{ "external_ref": "WC-1042", "fulfilment": "delivery",
"customer": { "name": "Awa Diop", "email": "awa@example.com", "phone": "0600000000" },
"delivery": { "address": "12 rue …", "postal_code": "68100", "city": "Mulhouse", "country": "FR" },
"items": [ { "sku": "AF000092", "quantity": 2 } ], "shipping": 4.90 }'Prices: an item without
unit_price takes your AFASIN Pro price. Products with variants are ordered by the SKU of the variant.