Getting Started with Skakio Catalog API

Build custom storefronts using your Skakio catalog data. This guide gets you making API calls in under 5 minutes.

1. Get an API Key

  1. Go to Studio → API Keys
  2. Click ”+ New Key”
  3. Choose key type:
    • Public (pk_) - Client-side use, read-only access
    • Secret (sk_) - Server-side use, full access
  4. Save your key immediately - it’s only shown once!

2. Get a Token

API keys are exchanged for short-lived JWT tokens (15 minutes by default):

curl -X POST https://api.skakio.com/auth/token \
  -H "X-API-Key: pk_live_your_key_here"

Response:

{
  "code": 200,
  "status": "OK",
  "data": {
    "token": "eyJhbGciOiJSUzI1NiIs...",
    "token_type": "Bearer",
    "expires_in": 900
  }
}

3. Make Requests

Use the token in the Authorization header:

curl https://api.skakio.com/api/store/YOUR_STORE_ID \
  -H "Authorization: Bearer eyJhbGciOiJSUzI1NiIs..."

4. Handle Token Refresh

Tokens expire after 15 minutes. Here’s a helper class that handles refresh automatically:

class SkakioAPI {
  constructor(apiKey) {
    this.apiKey = apiKey;
    this.token = null;
    this.tokenExpiresAt = 0;
  }

  async getToken() {
    // Refresh if expired or expiring soon (1 min buffer)
    if (Date.now() > this.tokenExpiresAt - 60000) {
      const res = await fetch('https://api.skakio.com/auth/token', {
        method: 'POST',
        headers: { 'X-API-Key': this.apiKey }
      });
      const { data } = await res.json();
      this.token = data.token;
      this.tokenExpiresAt = Date.now() + (data.expires_in * 1000);
    }
    return this.token;
  }

  async fetch(path) {
    const token = await this.getToken();
    const res = await fetch(`https://api.skakio.com${path}`, {
      headers: { 'Authorization': `Bearer ${token}` }
    });
    return res.json();
  }
}

// Usage
const api = new SkakioAPI('pk_live_your_key_here');
const store = await api.fetch('/api/store/store_abc123');

5. Rate Limits

All /api/* endpoints require authentication. Rate limits vary by key type:

Key TypeRate Limit
Public Key (pk_)100 req/min
Secret Key (sk_)500 req/min
# All requests require authentication
curl https://api.skakio.com/api/store/YOUR_STORE_ID \
  -H "Authorization: Bearer YOUR_JWT_TOKEN"

Next Steps