SDKs
Official SDKs for JS and Python.
The repsapi packages on npm and PyPI: one method per endpoint, typed responses, automatic retries and safe handling of your key. Any other language can call the HTTP API directly.
- One method per API: tracking, QC, lookup, convert, shipping, haul and usage
- Types for every response and clear error classes (RateLimitError, AuthenticationError ...)
- Retries network errors, 5xx answers and short rate limits on its own
- Your key only travels in the Authorization header: https only, redirects never followed
JavaScript / TypeScript
Node 18+, Bun and Deno · ESM and CommonJS · zero dependencies
terminal
npm install repsapiindex.ts
import { RepsApi } from "repsapi";
// CommonJS: const { RepsApi } = require("repsapi");
const api = new RepsApi(); // reads REPSAPI_KEY
// where is my parcel?
const parcel = await api.tracking("YT2530998211074512");
console.log(parcel.summary?.status_en);
// a product with prices in PLN
const item = await api.lookup("https://weidian.com/item.html?itemID=7779617259", { currency: "PLN" });
console.log(item.title_en, item.price_local?.low);
// shipping lines for a 1.2 kg parcel to Poland
const { lines, cheapest } = await api.shippingEstimate({ country: "PL", weight: 1200, currency: "PLN" });Keep the key on your server. In a browser every visitor could read it, so the JS client refuses to start there with a key.
Python
Python 3.9+ · sync and async (discord.py, FastAPI) · one dependency: httpx
terminal
pip install repsapimain.py
from repsapi import RepsApi
with RepsApi() as api: # reads REPSAPI_KEY
qc = api.qc("https://weidian.com/item.html?itemID=7779617259")
print(qc["total_photos"])
item = api.lookup(platform="1688", id="678091425228", currency="PLN")
print(item["title_pl"], item.get("price_local"))
# async (discord.py, FastAPI ...)
from repsapi import AsyncRepsApi
async with AsyncRepsApi() as api:
parcel = await api.tracking("YT2530998211074512")Any other language
Every endpoint is one HTTPS request with a Bearer key that returns JSON.
bash
curl --get https://repsapi.pl/v1/lookup \
--data-urlencode "url=https://weidian.com/item.html?itemID=7779617259" \
-H "Authorization: Bearer $REPSAPI_KEY"Read the full endpoint reference to see every method.
API reference