> ## Documentation Index
> Fetch the complete documentation index at: https://docs.wattshift.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Authenticating API Calls

> Authentication and Making API Calls

<script type="text/javascript" id="hs-script-loader" async defer src="//js.hs-scripts.com/46106422.js" />

All our requests use `POST`. Here's a quick example of what an API client would look like.

```typescript theme={null}
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(`${baseUrl}${path}`, {
    ...options,
    body: JSON.stringify(body ?? {}),
  });
  return res.json();
};
```

### Example API Call

```typescript theme={null}
await wattShiftApiCall(`/homes/${user.wsHomeId}/update`, {
  name: "updated home name",
  solarSystemSizeKw: 6.4,
  isNonNetMetered: true,
});
```
