ArunsYoga Partner API
List our products on your own website, app or newsletter, and earn a commission when your visitors buy online. Everything is a simple JSON API over HTTPS.
Getting started
- Create a partner account You must be logged in to generate keys.
- In the portal, click "Create API key" and copy it. It is shown only once.
- Call the API from your server and show the products on your site. Link each product to its buy_url.
- Visitors who buy online after clicking buy_url earn you commission. Track it in the portal or through the API.
Base URL
https://arunsyoga.in/wp-json/psw/v1
Authentication
Send your key in the Authorization header on every request:
Authorization: Bearer psw_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx If your host strips the Authorization header, use this instead: X-PSW-API-Key: YOUR_KEY
List products
GET/products
| Parameter | Meaning |
|---|---|
page | Page number, starting at 1. Default 1. |
per_page | 1 to 50. Default 20. |
search | Words to look for in the product. |
category | Category slug (see /categories). |
orderby | date (default), title, price, modified |
order | desc (default) or asc |
in_stock | true for only products in stock, false for only sold out. |
modified_after | Only products changed after this date/time (ISO 8601). Use it to refresh your copy without downloading everything. |
curl -H "Authorization: Bearer YOUR_API_KEY" \
"https://arunsyoga.in/wp-json/psw/v1/products?per_page=10&search=mala" Response (200):
{
"data": [
{
"id": 123,
"title": "Rudraksha Mala",
"slug": "rudraksha-mala",
"url": "https://arunsyoga.in/product/rudraksha-mala/",
"buy_url": "https://arunsyoga.in/product/rudraksha-mala/?psw_ref=ab12cd34",
"excerpt": "Hand-strung 108 bead mala…",
"description": "Plain text description",
"description_html": "<p>HTML description</p>",
"price": {
"amount": 999,
"currency": "INR",
"formatted": "₹999"
},
"in_stock": true,
"online_payment": true,
"commission": {
"rate_percent": 10,
"per_unit": 99.900000000000005684341886080801486968994140625,
"tracked": true
},
"images": {
"featured": "https://arunsyoga.in/wp-content/uploads/mala.jpg",
"gallery": []
},
"categories": [
{
"id": 5,
"name": "Malas",
"slug": "malas"
}
],
"created": "2026-10-01T08:00:00+00:00",
"modified": "2026-11-02T10:30:00+00:00"
}
],
"pagination": {
"page": 1,
"per_page": 20,
"total": 57,
"total_pages": 3
}
} | Field | Meaning |
|---|---|
buy_url | Send your visitors here. It carries your referral code, which is how your commission is tracked. Always link to this, not to url. |
url | The plain product page (no referral code). |
price.amount | Number, or null when the product has a text price only (use price.formatted). |
in_stock | false when sold out. Do not show a buy button then. |
online_payment | true when the product can be paid for online. Commission is only tracked for these. |
commission | Your rate for this product, and what you earn per unit (null if not tracked). |
description_html | Sanitised HTML. Use description for plain text. |
Paging is also in the headers X-WP-Total and X-WP-TotalPages.
Get one product
GET/products/{id}
Returns { "data": { …product… } }, shaped like one item above. 404 if it does not exist or is not available.
Categories
GET/categories
{ "data": [ { "id": 5, "name": "Malas", "slug": "malas", "count": 12 } ] }
Your account
GET/me
Shows your referral code, the default commission, the refund window and your rate limit. A handy way to test that your key works.
Your statistics
GET/stats
Parameter: days (1 to 365, default 30). Returns clicks on your links, unique visitors, card views, sales, the share of visitors who bought, and your commission. The Partner Portal shows the same numbers with charts, split by channel, product and the websites your visitors came from.
{ "data": { "days": 30, "clicks": 412, "unique_visitors": 355, "card_views": 1204, "sales": 9, "conversion_rate_percent": 2.5, "commission_earned": { "INR": 810.5 }, "sales_value": { "INR": 8105 } } }
Your commissions
GET/commissions
Parameters: page, per_page (1 to 100), status (pending, approved, paid or reversed). Returns your commission rows and totals per currency.
How commission works
- The default commission is 10% of what the buyer actually pays, after any coupon. Some products have their own rate. It is always shown in the commission field.
- When a visitor opens one of your buy_url links, we remember you for 30 days. If they buy online in that time, you earn the commission. If they click another partner's link later, that partner earns it instead.
- Only online payments are tracked. Orders placed through WhatsApp, email or phone cannot be linked to you and earn no commission.
- You do not earn commission on your own purchases.
- A new commission is "pending" for 14 days (the refund window). After that, if the order has not been refunded, it becomes "approved" (payable). Refunded orders are "reversed".
- We pay approved commissions using the payout details you save in the portal, and mark them as "paid".
Errors and limits
Each key may make 120 requests per minute. Please cache responses on your side (15 to 60 minutes is fine) and use modified_after to refresh.
| Status | Meaning |
|---|---|
| 401 | Key missing, malformed, wrong or revoked. |
| 403 | Your partner account is not active (pending or suspended). |
| 404 | Product not found. |
| 429 | Rate limit reached. Wait a minute. |
| 503 | The API is switched off for the moment. |
Errors look like:
{ "code": "psw_bad_key", "message": "This API key is not valid or has been revoked.", "data": { "status": 401 } }
Code examples
cURL
curl -H "Authorization: Bearer YOUR_API_KEY" \
"https://arunsyoga.in/wp-json/psw/v1/products?per_page=10&search=mala" PHP / WordPress
<?php
// Fetch products on YOUR server (never in the visitor's browser) and cache them.
function my_showcase_products() {
$cached = get_transient( 'my_showcase_products' ); // WordPress example
if ( false !== $cached ) { return $cached; }
$res = wp_remote_get( 'https://arunsyoga.in/wp-json/psw/v1/products?per_page=12', array(
'headers' => array( 'Authorization' => 'Bearer ' . MY_SHOWCASE_API_KEY ),
'timeout' => 15,
) );
if ( is_wp_error( $res ) || 200 !== wp_remote_retrieve_response_code( $res ) ) { return array(); }
$body = json_decode( wp_remote_retrieve_body( $res ), true );
$items = $body['data'] ?? array();
set_transient( 'my_showcase_products', $items, 30 * MINUTE_IN_SECONDS );
return $items;
}
foreach ( my_showcase_products() as $p ) {
echo '<a href="' . esc_url( $p['buy_url'] ) . '">' . esc_html( $p['title'] ) . ' - ' . esc_html( $p['price']['formatted'] ) . '</a>';
} Node.js
// Node 18+ (server side)
const res = await fetch('https://arunsyoga.in/wp-json/psw/v1/products?per_page=12', {
headers: { Authorization: 'Bearer ' + process.env.SHOWCASE_API_KEY },
});
if (!res.ok) throw new Error('API error ' + res.status);
const { data, pagination } = await res.json();
for (const p of data) console.log(p.title, p.price.formatted, p.buy_url); Python
import os, requests
r = requests.get(
'https://arunsyoga.in/wp-json/psw/v1/products',
params={'per_page': 12, 'category': 'malas'},
headers={'Authorization': 'Bearer ' + os.environ['SHOWCASE_API_KEY']},
timeout=15,
)
r.raise_for_status()
for p in r.json()['data']:
print(p['title'], p['price']['formatted'], p['buy_url'])