The official PHP SDK for the ZalTrack Zalando price tracking API.
Track Zalando prices and products with a scheduled watchlist, price history and alerts.
The SDK exposes 9 methods, one per documented endpoint (with array-shape PHPDoc for static analysis), plus clearTargetPrice() and a generic request(). It sends requests through any PSR-18 client and uses Guzzle by default.
- PHP 8.1 or newer
composer require zaltrack/sdkSign up for ZalTrack or sign in, then copy your API key from the dashboard. The client reads the ZALTRACK_API_KEY environment variable when no key is passed.
<?php
require 'vendor/autoload.php';
use ZalTrack\Client;
$client = new Client(getenv('ZALTRACK_API_KEY') ?: null);
$response = $client->searchZalando(['query' => 'nike trainers']);
print_r($response->data);Parameter arrays use the names of the API reference. Unknown names throw a SerializationException; use request() for undocumented parameters.
Each method uses the HTTP verb of its endpoint. GET and DELETE send parameters in the query string; POST and PATCH send them as a JSON body, except wait on /products/{id}/check, which stays in the query string. Null values are never sent; to remove a product's target price, call $client->clearTargetPrice($id), which sends PATCH /products/{id} with {"target_price": null}.
null values are omitted, false and 0 are sent, and lists repeat the parameter name.
$response = $client->request('GET', '/account');use ZalTrack\Exception\ApiException;
try {
$client->searchZalando(['query' => 'nike trainers']);
} catch (ApiException $exception) {
echo $exception->status, ': ', $exception->getMessage();
}| Exception | When |
|---|---|
ConfigurationException |
Missing API key, invalid options or unsupported method. |
SerializationException |
A required parameter is missing, unknown or can't be sent. |
TransportException |
Network failure or timeout. |
ApiException |
Non-2xx status (status, errorCode, errorMessage, responseBody, rawResponse). |
ResponseDecodingException |
A success response could not be decoded. |
errorCode is the API's error.code, such as insufficient_credits, product_limit or not_found (null when the body has none).
All of them extend ZalTrack\Exception\ZalTrackException.
Requests are retried up to 3 times after a network error, a 408, 500, 502, 503 or 504. Other statuses, such as 400, 401, 402, 404 or 429, and client-side timeouts are not retried: the API's rate limits last until the hour (or the day) is over, and on the free plan every retry would count as a request. The delay starts at 1 second and grows 1.5× per retry (capped at 30 seconds); a Retry-After header wins.
$client = new Client(null, ['max_retries' => 5, 'retry_delay' => 0.5]);
$client->searchZalando(['query' => 'nike trainers'], new RequestOptions(maxRetries: 0)); // one request without retriesbatch() sends several calls with at most 10 requests in flight ($concurrency), through Guzzle's connection pool, and returns one BatchResult per call in input order. A failing call never stops the others. With a custom PSR-18 client the calls run one after another.
$inputs = ['nike trainers', 'rain jacket', 'leather boots'];
$calls = array_map(static fn(string $value): array => ['searchZalando', ['query' => $value]], $inputs);
foreach ($client->batch($calls, concurrency: 5) as $result) {
if ($result->ok()) {
print_r($result->value->data);
} else {
echo $inputs[$result->index], ': ', $result->error->getMessage(), "\n";
}
}| Constant | Default | Description |
|---|---|---|
Client::DEFAULT_CONCURRENCY |
10 |
Tasks run at the same time by batch |
Client::DEFAULT_TIMEOUT |
120.0 |
Request timeout (seconds) |
Client::MAX_RETRIES |
3 |
Retry attempts after a network error, a 408/5xx |
Client::RETRY_BACKOFF_FACTOR |
1.5 |
Exponential backoff multiplier |
Client::DEFAULT_RETRY_DELAY |
1.0 |
Delay before the first retry (seconds) |
$client = new Client(null, [
'timeout' => 60.0, // seconds, default 120 (default Guzzle client only)
'headers' => ['X-Trace' => 'abc'],
'http_client' => $psr18Client, // optional: any PSR-18 client
]);9 methods, generated from the OpenAPI document.
| Method | HTTP | Description |
|---|---|---|
checkProduct() |
POST /products/{id}/check |
Asks for a check right away (1 credit), at most once per 5 minutes; earlier calls return the product unchanged. A paused product has to be… |
deleteProduct() |
DELETE /products/{id} |
Removes the product and its price history. |
getAccount() |
GET /account |
Your plan, the credits left (monthly allowance and packs), how many products you track and the credits they use per month, the credits each… |
getArticleHistory() |
GET /history |
Every price ZalTrack read for an article reference on a marketplace over the period, whoever tracks it, oldest first, with the lowest, high… |
getProduct() |
GET /products/{id} |
The product's latest state and every price read of the period, oldest first. The history covers every read of this article reference on thi… |
listProducts() |
GET /products |
Your watchlist, newest first, with each product's latest state and its recent prices (trend). Filter with article_id (and marketplace) to k… |
searchZalando() |
GET /search |
Zalando search results (sponsored included), to find the article reference of a product. Free, limited to 30 searches per hour. |
trackProduct() |
POST /products |
Adds an article reference or a Zalando link to your watchlist. The first check runs in the background within seconds (checking is true unti… |
updateProduct() |
PATCH /products/{id} |
Target price, drop alerts, check interval, or pause. Send only what changes. On the free plan, alerts (price drop, back in stock, target pr… |
| SDK | Package | Install |
|---|---|---|
| Node.js | @zaltrack/sdk |
npm install @zaltrack/sdk |
| Python | zaltrack |
pip install zaltrack |
| Go | zaltrack-go |
go get github.com/zaltrackdev/zaltrack-go |
| .NET | ZalTrack |
dotnet add package ZalTrack |
| Ruby | zaltrack |
gem install zaltrack |
| PHP | zaltrack/sdk |
composer require zaltrack/sdk |
| Java | zaltrack-java |
build from source, see its README |
| CLI | @zaltrack/cli |
npm install -g @zaltrack/cli |
| MCP server | @zaltrack/mcp |
npx -y @zaltrack/mcp |
ZALANDO® is a registered trademark of Zalando SE. ZalTrack is not affiliated with, endorsed or sponsored by Zalando.
MIT — see LICENSE.