Launch Platforms apps superfast. Headless. API First
The flexible and modular infrastructure to launch marketplace, community and commerce apps.
See demo videos
Tradly helps developers / non technical founders with low-code/no-code solution
to launch marketplaces, Ecosystem for SaaS and commerce apps.
Features
- ✅ 100+ API Endpoints - Comprehensive coverage of all Tradly platform
features
- ✅ Automatic Key Management - Integrates with
@tradly/auth for automatic
key injection
- ✅ Multi-Environment Support - Production, Development, Sandbox
- ✅ Domain-Based Configuration - Support for multiple domains
- ✅ Error Handling - Consistent error-first callback pattern
- ✅ TypeScript Ready - Works with TypeScript projects
Installation
npm install tradly
Optional: Install with Auth Package
For automatic key management, also install @tradly/auth:
npm install tradly @tradly/auth
Quick Start
Option 1: With @tradly/auth (Recommended)
Simplest approach - just initialize auth, then use tradly sdk directly:
import { initializeAuth, emailLogin } from "@tradly/auth";
import TradlySDK from "tradly";
initializeAuth("beauty.tradly.co", "production");
await emailLogin("user@example.com", "password");
const [error, response] = await TradlySDK.app.getListings({
bodyParam: {},
});
Benefits:
- ✅ No need to call
init_v2.config()
- ✅ Keys automatically injected
- ✅ Environment and base URL synced from auth
- ✅ Simplest usage
Option 2: Standalone (Without Auth Package)
import TradlySDK from "tradly";
await TradlySDK.init_v2.config({
domain: "beauty.tradly.co",
env: "production",
});
const [error, response] = await TradlySDK.app.getListings({
authKey: "your-auth-key",
bodyParam: {},
});
Option 3: With Both (Explicit Control)
import { initializeAuth, emailLogin } from "@tradly/auth";
import TradlySDK from "tradly";
initializeAuth("beauty.tradly.co", "production");
await emailLogin("user@example.com", "password");
await TradlySDK.init_v2.config({
domain: "beauty.tradly.co",
env: "production",
});
const [error, response] = await TradlySDK.app.getListings({
bodyParam: {},
});
Initialization
Using InitV2 (Recommended)
import TradlySDK from "tradly";
await TradlySDK.init_v2.config({
domain: "beauty.tradly.co",
env: "production",
custom_header: {},
is_skip_pk_by_domain: false,
});
Note: If @tradly/auth is initialized, init_v2.config() will
automatically use auth's cached PK key (no duplicate API call).
Using Legacy Init (Deprecated)
import TradlySDK from "tradly";
await TradlySDK.init.config({
token: "your-pk-key",
environment: "production",
custom_header: {},
});
Integration with @tradly/auth
tradly automatically integrates with @tradly/auth when available:
Automatic Features
-
PK Key Auto-Injection:
- If
APPCONSTANT.TOKEN is empty, gets PK key from auth's cache
- Caches it for future use
-
Auth Key Auto-Injection:
- If
authKey not provided in method params, gets from auth package
- Adds to
x-auth-key header automatically
-
Environment Sync:
- Syncs environment from auth config if
APPCONSTANT.ENVIRONMENT is empty
-
Base URL Sync:
- Uses auth's
baseUrl if available (preferred over tradly's Environment
function)
Backward Compatibility
- ✅ Works without
@tradly/auth package
- ✅ Manual
authKey passing still works
- ✅ No breaking changes
API Methods
All methods return [error, response] format (error-first callback pattern).
Response Format
const [error, response] = await TradlySDK.app.getListings({});
if (error) {
console.error("Error:", error);
} else {
console.log("Data:", response.data);
}
API Reference
Configuration & Setup
init_v2.config() | Initialize SDK (new way) | { domain, env, custom_header?, is_skip_pk_by_domain? } |
init.config() | Initialize SDK (legacy) | { token, environment, custom_header? } |
init.refreshAPI() | Refresh auth token | { refreshKey } |
User Management
app.getUserDetail() | Get user by ID | { authKey, id } |
app.getUserProfile() | Get current user profile | { authKey, id? } |
app.getUsersList() | Get users list | { authKey, bodyParam? } |
app.updateUserInfo() | Update user info | { authKey, id, data } |
app.deleteUser() | Delete user | { authKey, id } |
app.getUserAttributes() | Get user attributes | { authKey, id, recaptcha_token } |
app.userFollow() | Follow a user | { authKey, data } |
app.getUserFollowings() | Get user followings | { authKey, bodyParam? } |
app.getUserFollowers() | Get user followers | { authKey, bodyParam? } |
Listings
app.getListings() | Get listings | { authKey?, bodyParam? } |
app.getListingDetail() | Get listing detail | { authKey?, id, slug? } |
app.postListing() | Create/Update listing | { authKey?, id?, data } |
app.deleteListing() | Delete listing | { authKey?, id } |
app.likeListing() | Like/Unlike listing | { authKey?, id, isLiked } |
app.unlikeListing() | Unlike listing | { authKey?, id, isUnLiked } |
app.bulkLikeListings() | Bulk like listings | { authKey?, data } |
app.getMyListingsLikes() | Get my liked listings | { authKey?, bodyParam? } |
app.reportListing() | Report listing | { authKey?, id, data } |
app.getListingsLocations() | Get listings locations | { authKey?, bodyParam? } |
app.FollowingAccountsListings() | Get following accounts listings | { authKey?, bodyParam? } |
Note: authKey is optional if @tradly/auth is initialized - it will be
auto-injected.
Listings - Pricing Rules
app.postPricingRules() | Create/Update pricing rule | { authKey?, listing_id, rule_id?, data } |
app.getListingsPricingRules() | Get pricing rules | { authKey?, listing_id, bodyParam? } |
app.getListingSinglePricingRule() | Get single pricing rule | { authKey?, listing_id, rule_id, bodyParam? } |
app.deleteListingPricingRule() | Delete pricing rule | { authKey?, listing_id, rule_id } |
Listings - Negotiations
app.addNegotiation() | Add negotiation | { authKey?, id, data } |
app.updateNegotiation() | Update negotiation | { authKey?, id, negotiation_id, data } |
app.getNegotiationList() | Get negotiations list | { authKey?, id, bodyParam? } |
Listings - Schedules
app.createSchedule() | Create schedule | { authKey?, id, data } |
app.getSchedule() | Get schedule | { authKey?, id, bodyParam? } |
Variants
app.getVariants() | Get variants | { authKey? } |
app.getListingVariants() | Get listing variants | { authKey?, listingId } |
app.getListingVariantDetails() | Get variant details | { authKey?, listingId, variant_id } |
app.addEditVariants() | Create/Update variant | { authKey?, listingId, id?, data } |
app.deleteVariant() | Delete variant | { authKey?, listingId, id } |
Variant Types
app.getVariantTypes() | Get variant types | { authKey? } |
app.addEditVariantsTypes() | Create/Update variant type | { authKey?, id?, data } |
app.deleteVariantType() | Delete variant type | { authKey?, id } |
app.getVariantTypeValues() | Get variant type values | { authKey?, id } |
app.getVariantTypeValuesDetail() | Get variant type value detail | { authKey?, id, valueID } |
app.addEditVariantTypeValues() | Create/Update variant type value | { authKey?, id, valueID?, data } |
app.deleteVariantTypeValues() | Delete variant type value | { authKey?, id, valueID } |
Categories
app.getCategory() | Get categories | { authKey?, bodyParam? } |
app.getSingleCategoryByID() | Get category by ID | { authKey?, categoryID, bodyParam? } |
app.getSingleCategoryBySlug() | Get category by slug | { authKey?, slug, bodyParam? } |
app.addEditCategory() | Create/Update category | { authKey?, id?, data } |
app.deleteCategory() | Delete category | { authKey?, id } |
Attributes
app.getAttribute() | Get attributes | { authKey?, bodyParam? } |
app.getAttributesGrouped() | Get grouped attributes | { authKey?, bodyParam? } |
app.getUserAttributeValues() | Get user attribute values | { authKey?, id, bodyParam? } |
app.addEditAttribute() | Create/Update attribute | { authKey?, id?, data } |
app.deleteAttribute() | Delete attribute | { authKey?, id } |
app.getAttributeValues() | Get attribute values | { authKey?, id } |
app.getAttributeValuesDetail() | Get attribute value detail | { authKey?, id, valueID } |
app.addEditAttributeValues() | Create/Update attribute value | { authKey?, id, valueID?, data } |
app.deleteAttributeValues() | Delete attribute value | { authKey?, id, valueID } |
Accounts
app.getAccounts() | Get accounts | { authKey?, bodyParam? } |
app.getAccountDetail() | Get account detail | { authKey?, id, slug? } |
app.postAccounts() | Create/Update account | { authKey?, id?, data } |
app.activeInactiveAccounts() | Activate/Deactivate account | { authKey?, id, data } |
app.followUnfollowAccounts() | Follow/Unfollow account | { authKey?, id, isFollowing } |
app.blockAccount() | Block/Unblock account | { authKey?, id, isBlocked } |
app.reportAccount() | Report account | { authKey?, id, data } |
app.getBlockAccounts() | Get blocked accounts | { authKey?, bodyParam? } |
app.getFollowingAccounts() | Get following accounts | { authKey?, bodyParam? } |
app.getAccountsLocations() | Get accounts locations | { authKey?, bodyParam? } |
Cart & Checkout
app.getCarts() | Get cart | { authKey?, bodyParam?, currency? } |
app.addToCart() | Add to cart | { authKey?, data } |
app.deleteFromCart() | Remove from cart | { authKey?, data } |
app.deleteAllCartDetail() | Clear cart | { authKey?, bodyParam? } |
app.checkout() | Checkout from cart | { authKey?, data, currency? } |
app.listingDirectCheckout() | Direct checkout | { authKey?, id, data, currency? } |
app.applyCoupon() | Apply coupon | { authKey?, data } |
app.removeCoupon() | Remove coupon | { authKey?, data } |
Orders
app.getOrders() | Get orders | { authKey?, bodyParam? } |
app.getOrderDetail() | Get order detail | { authKey?, id, bodyParam? } |
app.updateOrderStatus() | Update order status | { authKey?, id, data, bodyParam? } |
app.updateOrderDetail() | Update order details | { authKey?, id, data, bodyParam? } |
app.updateOrderShipment() | Update order shipment | { authKey?, order_id, shipment_id, data, bodyParam? } |
app.updateShipmentStatus() | Update shipment status | { authKey?, id, shipment_id, data, bodyParam? } |
app.verifyOrderDetails() | Verify order details | { authKey?, data, bodyParam? } |
app.confirmOrderByUser() | Confirm order | { authKey?, order_ref, access_key?, data, bodyParam? } |
app.getOrderInvoice() | Get order invoice | { authKey?, order_id, bodyParam? } |
app.getDonationsList() | Get donations list | { authKey?, listing_id, bodyParam? } |
Shipments
app.getSendCloudShipmentsMethods() | Get SendCloud shipping methods | { authKey?, bodyParam? } |
app.getSendCloudShipmentLabel() | Get SendCloud shipping label | { authKey?, bodyParam? } |
app.getExternalShipmentMethods() | Get external shipping methods | { authKey?, shipping_method_id, bodyParam? } |
app.getExternalShipmentLabel() | Get external shipping label | { authKey?, order_id, shipment_id } |
Reviews
app.getReviewList() | Get reviews | { authKey?, bodyParam? } |
app.addReview() | Add review | { authKey?, data } |
app.likeReview() | Like review | { authKey?, id, data } |
Payments
app.getPaymentMethods() | Get payment methods | { authKey? } |
app.getEphemeralKey() | Get Stripe ephemeral key | { authKey?, id, data } |
app.getPaymentIntentKey() | Get Stripe payment intent | { authKey?, id, data } |
MangoPay
app.getKycDetails() | Get KYC details | { authKey?, id } |
app.savePerSonalDetails() | Save personal details | { authKey?, data } |
app.cardRegistration() | Register card | { authKey?, data } |
app.confirmCardRegistration() | Confirm card registration | { authKey?, data } |
app.PayINMangoPayCalc() | Calculate pay-in | { authKey?, data } |
app.PayINMangoPayByCards() | Pay-in by cards | { authKey?, data } |
app.PayINMangoPayPayPal() | Pay-in by PayPal | { authKey?, data } |
app.PayINMangoPayByBank() | Pay-in by bank | { authKey?, data } |
app.mangoPayWithdrawCalc() | Calculate withdrawal | { authKey?, data } |
app.mangoPayWithdrawInit() | Initiate withdrawal | { authKey?, data } |
app.mangoPayWithdrawConfirm() | Confirm withdrawal | { authKey?, data } |
app.getMangopayWalletTransactions() | Get wallet transactions | { authKey?, bodyParam? } |
app.getMangoPayWalletBalance() | Get wallet balance | { authKey?, bodyParam? } |
Stripe Connect
app.getStripeConnectAccount() | Get Stripe Connect account | { authKey?, id } |
app.createAccountLink() | Create account link | { authKey?, data } |
app.createExpressLoginLink() | Create express login link | { authKey?, data } |
Saved Cards
app.getSavedCards() | Get saved cards | { authKey? } |
app.deleteSavedCard() | Delete saved card | { authKey?, card_id } |
Addresses
app.getAddress() | Get addresses | { authKey?, bodyParam? } |
app.addEditAddress() | Create/Update address | { authKey?, id?, data } |
app.deleteAddress() | Delete address | { authKey?, id } |
app.searchAddress() | Search address | { authKey?, searchKey } |
app.reverseGeoCodingAddress() | Reverse geocoding | { authKey?, lat, long } |
app.getPlacesAddress() | Get places address | { authKey?, bodyParam? } |
app.getPlacesAddressDetails() | Get place address details | { authKey?, bodyParam? } |
app.getStates() | Get states | { authKey?, bodyParam? } |
Shipping Methods
app.getShippingMethods() | Get shipping methods | { authKey?, type?, account_id? } |
Currency
app.getCurrency() | Get currencies | { authKey? } |
app.addEditCurrency() | Create/Update currency | { authKey?, id?, data } |
app.deleteCurrency() | Delete currency | { authKey?, id } |
Collections
app.getCollection() | Get collections | { authKey? } |
app.getCollectionDetail() | Get collection detail | { authKey?, id } |
app.addEditCollection() | Create/Update collection | { authKey?, id?, data } |
app.deleteCollections() | Delete collection | { authKey?, id } |
app.getCollectionData() | Get collection data | { authKey?, bodyParam? } |
Promo Banners
app.getPromoBanner() | Get promo banners | { authKey?, bodyParam? } |
app.addPromoBanner() | Create/Update promo banner | { authKey?, id?, data } |
app.deletePromoBanner() | Delete promo banner | { authKey?, id } |
Transactions & Earnings
app.getTransactions() | Get transactions | { authKey?, bodyParam? } |
app.getEarning() | Get earnings | { authKey?, bodyParam? } |
Commissions
app.getCommissions() | Get commissions | { authKey?, bodyParam? } |
app.getCommissionDetail() | Get commission detail | { authKey?, id } |
Subscriptions
app.subscribe() | Get subscriptions | { authKey?, bodyParam? } |
app.productSubscription() | Get product subscriptions | { authKey?, bodyParam? } |
app.subscriptionConfirm() | Confirm subscription | { authKey?, data } |
app.manageSubscriptionLink() | Manage subscription link | { authKey?, data } |
app.getSubscriptionList() | Get subscription listings | { authKey?, bodyParam? } |
app.getSubscriptionDetails() | Get subscription details | { authKey?, listing_id } |
app.subscribeByMangopay() | Subscribe via MangoPay | { authKey?, listing_id, data, currency? } |
Layers
app.getLayer() | Get layers | { authKey?, bodyParam? } |
app.getLayerDetail() | Get layer detail | { authKey?, id } |
app.getLayerDetailBySlug() | Get layer by slug | { authKey?, id } |
app.addEditLayer() | Create/Update layer | { authKey?, id?, data } |
app.deleteLayer() | Delete layer | { authKey?, id } |
Taxes
app.getListingTaxes() | Get listing taxes | { authKey?, bodyParam? } |
app.addEditListingTax() | Create/Update tax | { authKey?, id?, data } |
app.deleteListingTax() | Delete tax | { authKey?, id } |
Translations
app.getTranslations() | Get translations | { authKey?, bodyParam? } |
app.translateData() | Translate data | { authKey?, id, data } |
app.getClientTranslationsGroups() | Get client translation groups | { authKey?, paramBody? } |
app.getClientTranslationsValues() | Get client translation values | { authKey?, bodyParam? } |
app.clientTranslationsValuesByGroup() | Get translations by group | { authKey?, bodyParam? } |
app.getFeedbackCategories() | Get feedback categories | { authKey?, bodyParam? } |
app.createFeedback() | Create feedback | { authKey?, data } |
app.getComments() | Get comments | { authKey?, bodyParam? } |
app.addEditComments() | Create/Update comment | { authKey?, id?, data } |
app.likeUnlikeComments() | Like/Unlike comment | { authKey?, id, isLike, isDowngrade } |
Activities
app.getActivities() | Get activities | { authKey?, bodyParam? } |
Languages & Countries
app.getLanguages() | Get languages | { authKey? } |
app.getTenantLanguages() | Get tenant languages | { authKey? } |
app.getCountries() | Get countries | {} |
app.getTenantCountries() | Get tenant countries | { authKey? } |
Configuration
app.getConfigList() | Get config list | { authKey?, paramBody, domain_id? } |
app.getGroupedConfigList() | Get grouped config list | { authKey?, paramBody, domain_id? } |
app.getGroupedSecureConfigList() | Get grouped secure config | { authKey?, paramBody, domain_id?, access_key? } |
app.home() | Get home data | { authKey? } |
S3 & Media
app.generateS3ImageURL() | Generate S3 signed URL | { authKey?, data } |
app.uploadS3Image() | Upload image to S3 | { signedUrl, mime, blob_body } |
app.getS3SignedURL() | Get S3 signed URL | { authKey?, data } |
Digital Content
app.getDigitalContents() | Get digital contents | { authKey?, listing_id, bodyParam? } |
app.postAndEditDigitalContent() | Create/Update digital content | { authKey?, listing_id, content_id?, data } |
app.deleteDigitalContent() | Delete digital content | { authKey?, listing_id, content_id } |
SSO
app.postSsoReturn() | SSO return | { authKey?, data, currency? } |
app.postSsoEnabled() | Check SSO enabled | { authKey?, data, currency? } |
Wallet
app.getWalletBalance() | Get wallet balance | { authKey? } |
app.getWalletTransactions() | Get wallet transactions | { authKey?, bodyParam? } |
OPP Merchant
app.getMerchantDetails() | Get merchant details | { authKey?, bodyParam? } |
app.createNewMerchant() | Create merchant | { authKey?, data } |
Time Slots
app.getTimeSlots() | Get time slots | { authKey?, bodyParam? } |
AI Services
app.getAiPromptResponse() | Get AI prompt response | { authKey?, data, currency? } |
Device Management
app.updateDeviceInfo() | Update device info | { authKey?, data } |
Usage Examples
Example 1: Get Listings
import TradlySDK from "tradly";
const [error, response] = await TradlySDK.app.getListings({
bodyParam: {
page: 1,
per_page: 20,
type: "listings",
},
});
if (error) {
console.error("Error:", error);
} else {
console.log("Listings:", response.data);
}
Example 2: Create Listing
const [error, response] = await TradlySDK.app.postListing({
data: {
title: "My Product",
description: "Product description",
price: 99.99,
},
});
if (!error) {
console.log("Listing created:", response.data);
}
Example 3: Add to Cart
const [error, response] = await TradlySDK.app.addToCart({
data: {
listing_id: 123,
quantity: 2,
},
});
Example 4: Checkout
const [error, response] = await TradlySDK.app.checkout({
data: {
},
currency: "USD",
});
Example 5: Get Orders
const [error, response] = await TradlySDK.app.getOrders({
bodyParam: {
page: 1,
per_page: 10,
status: "pending",
},
});
Parameters
Common Parameters
Most methods accept these optional parameters:
authKey - User authentication key (auto-injected if @tradly/auth is used)
currency - Currency code (e.g., "USD", "EUR")
language - Language code (e.g., "en", "fr")
bodyParam - Query parameters object (converted to URL query string)
bodyParam Example
const [error, response] = await TradlySDK.app.getListings({
bodyParam: {
page: 1,
per_page: 20,
search: "laptop",
category_id: 5,
},
});
Error Handling
All methods return error-first callback pattern:
const [error, response] = await TradlySDK.app.getListings({});
if (error) {
console.error("Error Code:", error.code);
console.error("Error Message:", error.message);
console.error("Full Error:", error);
} else {
console.log("Status:", response.status);
console.log("Data:", response.data);
}
Integration with @tradly/auth
Automatic Key Injection
When @tradly/auth is installed and initialized:
- PK Key: Automatically injected from auth's cache
- Auth Key: Automatically injected from auth's storage
- Environment: Synced from auth config
- Base URL: Uses auth's baseUrl
Manual Override
You can still manually provide authKey to override auto-injection:
const [error, response] = await TradlySDK.app.getListings({
authKey: "custom-key",
bodyParam: {},
});
Environment Variables
Tradly sdk supports these environments:
Best Practices
- Initialize Once: Initialize auth or tradly once at app startup
- Use Auth Package: For automatic key management, use
@tradly/auth
- Error Handling: Always check for errors before using response
- TypeScript: Use TypeScript for better type safety
- Async/Await: Use async/await for cleaner code
TypeScript Support
While tradly is written in JavaScript, it works with TypeScript:
import TradlySDK from "tradly";
const [error, response]: [any, any] = await TradlySDK.app.getListings({
bodyParam: {},
});
For general help using Tradly:
License
ISC
Repository
https://github.com/TRADLY-PLATFORM
Note: This SDK automatically integrates with @tradly/auth when available.
For authentication, we recommend using @tradly/auth package which provides
automatic key management, storage, and better developer experience.