All our requests use POST. This is a quick example of what an API client would look like.

const baseUrl = "https://api.wattshift.com/v1";
const options = {
  method: "POST",
  headers: {
    "x-ws-api-key": "<your api key here>",
  },
};

const wattshiftApiCall = async (
  path: `/${string}`,
  body?: Record<string, any>
) => {
  const res = await fetch(`${url}${path}`, {
    ...options,
    body: JSON.stringify(body ?? {}),
  });
  return res.json();
};

Example API Call

await wattShiftApiCall(`/homes/${user.wsHomeId}/update`, {
  name: "updated home name",
});