Yalidine API for Node.js and PHP
Create, track and price your Yalidine parcels (and GuepEx, same platform) with the dz-delivery SDK — no hand-written HTTP calls, pagination or status mapping.
Install
npm install @dz-delivery/core
composer require dz-delivery/sdk
Node.js ≥ 18 (zero dependencies) or PHP ≥ 8.2 (Guzzle 7). Every carrier implements the same interface, so the same code works with the others once the client is configured; some operations are not available on every carrier and throw NOT_SUPPORTED (see the capability matrix).
Yalidine credentials
| Option | Header sent | Where to find it |
|---|---|---|
apiId | X-API-ID | Yalidine developer dashboard |
apiToken | X-API-TOKEN | Yalidine developer dashboard |
fromWilayaId or fromWilayaName | — | Your origin wilaya (code 1–58), required for createParcel and getFees |
Yalidine with TypeScript / Node.js
import { createClient, isShippingError } from '@dz-delivery/core'; const yalidine = createClient('yalidine', { apiId: process.env.YALIDINE_API_ID!, apiToken: process.env.YALIDINE_API_TOKEN!, fromWilayaId: 16, // origin wilaya (Algiers) }); try { // Wilayas, communes, offices (stop desks) const wilayas = await yalidine.getWilayas(); // id = official code 1–58 const communes = await yalidine.getCommunes(16); const desks = await yalidine.getStopDesks({ wilayaId: 31 }); // Delivery fees (weight in kg, dimensions in cm) const quote = await yalidine.getFees({ toWilayaId: 31, weight: 2 }); // { deliveryFee, stopDeskFee, returnFee?, currency: 'DZD' } // Create a parcel (cash on delivery) const parcel = await yalidine.createParcel({ recipientName: 'Mohamed Amine', phone: '0550123456', address: 'Cité 221 lots, n°98', wilayaName: 'Oran', communeName: 'Bir El Djir', productName: 'T-shirt', price: 2500, orderId: 'ORDER-1001', }); // Tracking: unified status + history (oldest first) const { parcel: current, events } = await yalidine.track(parcel.trackingNumber); console.log(current.status, events.at(-1)?.label); } catch (err) { if (isShippingError(err)) console.error(err.code, err.message, err.details); }
Yalidine with PHP / Laravel
use DzDelivery\ClientFactory; use DzDelivery\Errors\ShippingError; $yalidine = ClientFactory::create('yalidine', [ 'apiId' => getenv('YALIDINE_API_ID'), 'apiToken' => getenv('YALIDINE_API_TOKEN'), 'fromWilayaId' => 16, // or 'fromWilayaName' => 'Alger' ]); try { $wilayas = $yalidine->getWilayas(); $desks = $yalidine->getStopDesks(['wilayaId' => 31]); $quote = $yalidine->getFees(['toWilayaId' => 31, 'weight' => 2]); $parcel = $yalidine->createParcel([ 'recipientName' => 'Mohamed Amine', 'phone' => '0550123456', 'address' => 'Cité 221 lots, n°98', 'wilayaName' => 'Oran', 'communeName' => 'Bir El Djir', 'productName' => 'T-shirt', 'price' => 2500, 'orderId' => 'ORDER-1001', ]); $result = $yalidine->track($parcel->trackingNumber); echo $result->parcel->status; // pending | in_transit | delivered | ... } catch (ShippingError $e) { echo "{$e->code}: {$e->getMessage()}"; }
Installation, Laravel, errors and testing: see the full PHP guide.
Supported methods
| Method | Support | Notes |
|---|---|---|
createParcel | yes | New parcels are « En préparation » (being prepared) → pending. |
track | yes | Unified status + full history. parcel.labelUrl = link to the shipping label (also returned by createParcel). |
getFees | yes | Volumetric weight is billed when it is higher (length / width / height in cm). |
getWilayas / getCommunes | yes | The wilaya id is the official code. |
getStopDesks | yes | Yalidine offices (centers), communeId optional. |
listParcels | yes | GET /parcels/, up to 1000 per page. keyword → tracking, orderId → order_id; 50 by default. status and updatedSince are filtered by the SDK page by page: a page can be short (or empty) while hasNext is true, so keep following hasNext. |
cancelParcel | yes | Only parcels still « En préparation » (being prepared). |
healthCheck | yes | Checks the credentials (real API call). |
GuepEx API
GuepEx runs the same API as Yalidine on a different domain. Use the yalidine provider with your GuepEx credentials and the GuepEx URL:
import { createClient, GUEPEX_DEFAULT_BASE_URL } from '@dz-delivery/core'; const guepex = createClient('yalidine', { apiId: process.env.GUEPEX_API_ID!, apiToken: process.env.GUEPEX_API_TOKEN!, fromWilayaId: 16, baseUrl: GUEPEX_DEFAULT_BASE_URL, // https://api.guepex.app/v1 });
use DzDelivery\ClientFactory; use DzDelivery\Providers\YalidineProvider; $guepex = ClientFactory::create('yalidine', [ 'apiId' => getenv('GUEPEX_API_ID'), 'apiToken' => getenv('GUEPEX_API_TOKEN'), 'fromWilayaId' => 16, 'baseUrl' => YalidineProvider::GUEPEX_DEFAULT_BASE_URL, ]);
Yalidine statuses → unified statuses
The SDK maps the Yalidine status / last_status (French labels, matched case- and accent-insensitively) to a unified status. GuepEx uses the same mapping.
| Yalidine status | Unified status |
|---|---|
En préparation, A vérifier | pending |
Pas encore expédié, Pas encore ramassé, Prêt à expédier, En passation | created |
Ramassé, Expédié, Centre, En localisation, En transit, Vers Wilaya, Reçu à Wilaya, Transfert, Vers Station, En station, Prêt pour livreur, Dispatché, Sorti en livraison, En attente du client, En attente, Tentative échouée, Echèc livraison, En alerte, Alerte résolue, Bloqué, Débloqué | in_transit |
Livré | delivered |
Retour …, Retourné …, Echange échoué, Colis abandonné | returned |
Annulé, Supprimé | cancelled |
| Any other status | unknown |
What each unified status means: full list of unified statuses.
Good to know about the Yalidine API
- Origin wilaya required: without
fromWilayaId/fromWilayaName,createParcelandgetFeesthrowVALIDATION_ERROR. - Wilaya and commune can be passed by id, official code or name: the SDK resolves them before the HTTP call.
- The Yalidine tracking number doubles as the identifier (
parcel.id === parcel.trackingNumber). - Pagination (
page_size= 1000) and non-deliverable wilayas/communes are handled for you. - When you hit the rate limit, the
RATE_LIMITEDerror tells you how long to wait (retryAfter) when Yalidine sends it.
Detailed native mapping (endpoints, fields, statuses): PROVIDERS.md.
Yalidine FAQ
How do I get a Yalidine API key?
In your Yalidine merchant account, developer section: you will find the API ID and the API token to pass as apiId and apiToken.
How do I calculate Yalidine delivery fees?
getFees({ toWilayaId, weight }) returns deliveryFee (home) and stopDeskFee (office) in DZD, from your origin wilaya.
How do I ship a parcel to a Yalidine office (stop desk)?
List the offices with getStopDesks({ wilayaId }), then create the parcel with isStopDesk: true and stopDeskId = the office id.
Does the SDK work with GuepEx?
Yes, see the GuepEx API section: same provider, different baseUrl.
Other carriers
Same interface, same unified statuses (pending, in_transit, delivered…).