REST API v2
Code examples

Code examples

Pick your language. The Python and PHP examples are small client classes that send the authentication headers for you.

Please use our npm package (opens in a new tab) joy-api-node for the best developer experience. For example:

import JoyApi from 'joy-api-node';
 
const joy = new JoyApi({
  appKey: 'your-app-key',
  secretKey: 'your-secret-key',
  baseUrl: 'https://api.joy.so', // recommended: joy-api-node 1.0.x defaults to https://dev-api.joy.so (same production backend)
  timeout: 30000, // optional, request timeout in ms
  maxRetries: 3 // optional, number of retries for failed requests
});
 
// Get shop information
const shop = await joy.shop.whoami();
console.log(shop.data);