CDNShark Documentation

Reseller API

← Back to Documentation

Reseller API — Getting Started

The Reseller API lets a third-party provider sell CDNShark from their own billing system: create customers, order services for them, and reconcile the charges. It is a separate surface from the Customer API and requires a reseller account.

How billing works

This is the single most important thing to understand before you integrate.

  • Every order is charged to your credit balance, at your wholesale price (list price minus your reseller discount).
  • Your customer never pays CDNShark. You bill them yourself, at whatever price you choose, through your own system.
  • An order placed with insufficient credit is rejected with 402 Payment Required and does not provision anything.

Top up your balance in the reseller portal under Credit & Billing, or check it any time via GET /api/reseller/credit.

Base URL

https://cdnshark.com/api/reseller

Authentication

Create a token in the reseller portal under API Tokens. Send it as a bearer token on every request:

Authorization: Bearer YOUR_RESELLER_TOKEN

Tokens are scoped by ability — grant only what your integration needs:

AbilityGrants
reseller:catalog:readPlans, wholesale pricing, product availability
reseller:customers:readList and read your customers
reseller:customers:writeCreate, edit and suspend customers
reseller:services:readList and read provisioned services
reseller:services:writeOrder, suspend and reactivate services
reseller:billing:readCredit balance, ledger, orders, invoices
reseller:usage:readBandwidth and storage metering
reseller:webhooks:readRead subscriptions and delivery history
reseller:webhooks:writeManage webhook subscriptions
reseller:ssoMint delegated-login links for your customers

Your first call

Check what you can sell and what it costs you:

curl -H "Authorization: Bearer $TOKEN" \
  "https://cdnshark.com/api/reseller/plans?type=cdn"

The response quotes both the public list price and your_price after your discount, alongside your current balance:

{
  "discount_percent": 25.0,
  "credit_balance": 480.00,
  "data": [
    {
      "id": 3,
      "name": "CDN Starter",
      "type": "cdn",
      "list_price": 20.00,
      "your_price": 15.00,
      "your_setup_fee": 0.00,
      "your_total": 15.00,
      "terms": 30
    }
  ]
}

Response codes

CodeMeaning
200 / 201Success
400Missing Idempotency-Key on an order endpoint
401Missing or invalid token
402Insufficient credit — includes the shortfall
403Token lacks the required ability, or not a reseller account
404Resource does not exist, or is not yours
409A request with the same idempotency key is still running
422Validation failed, or an idempotency key was reused with a different body
429Rate limited

A 404 is deliberately returned instead of 403 for resources belonging to another reseller, so the API never confirms that an id exists.

Rate limits

The Reseller API has its own limit, separate from the Customer API — 300 requests per minute by default, counted per reseller. Contact support if your integration needs more.