API Documentation

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.

Not a developer? You do not need the API. Log in to the Partner Portal and use the link and embed generator: pick a product, copy a tracked link or a ready-made product card, and paste it into your post, bio, newsletter or video description. Commission works exactly the same.

Getting started

  1. Create a partner account You must be logged in to generate keys.
  2. In the portal, click "Create API key" and copy it. It is shown only once.
  3. Call the API from your server and show the products on your site. Link each product to its buy_url.
  4. 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

Keep your key secret. Call the API from your server, never from JavaScript running in the visitor's browser, and never put the key in a public repository. If a key leaks, revoke it in the portal and create a new one. Keys cannot be passed in the URL, and the API does not allow browser (CORS) requests, on purpose.

List products

GET/products

ParameterMeaning
pagePage number, starting at 1. Default 1.
per_page1 to 50. Default 20.
searchWords to look for in the product.
categoryCategory slug (see /categories).
orderbydate (default), title, price, modified
orderdesc (default) or asc
in_stocktrue for only products in stock, false for only sold out.
modified_afterOnly 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
    }
}
FieldMeaning
buy_urlSend your visitors here. It carries your referral code, which is how your commission is tracked. Always link to this, not to url.
urlThe plain product page (no referral code).
price.amountNumber, or null when the product has a text price only (use price.formatted).
in_stockfalse when sold out. Do not show a buy button then.
online_paymenttrue when the product can be paid for online. Commission is only tracked for these.
commissionYour rate for this product, and what you earn per unit (null if not tracked).
description_htmlSanitised 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.

StatusMeaning
401Key missing, malformed, wrong or revoked.
403Your partner account is not active (pending or suspended).
404Product not found.
429Rate limit reached. Wait a minute.
503The 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'])
Tracking: we count clicks on your links and views of your product cards, once per visitor per day, and we ignore bots and link previews. We do not store IP addresses. Please mention this in your own privacy policy if your visitors need to know.
Please show the price and availability as returned and refresh often, so your visitors never see an out-of-date price. Do not claim our products as your own, and do not use misleading ads or incentives to get clicks.

Share with