> For the complete documentation index, see [llms.txt](https://docs.cremawork.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.cremawork.com/v-4/decelopment/api-calls.md).

# API Calls

We are using the Axios to make an API call. Here is the global Axios configuration.

We are using the Axios to make an API call. Here is the global Axios configuration. You can find it on this path `libs/services/auth/src/jwt-auth/index.js`

```typescript
import axios from "axios";

const jwtAxios = axios.create({
  baseURL: "https://BACKEND_SERVER_ATH/api/", // YOUR_API_URL HERE
  headers: {
    "Content-Type": "application/json",
  },
});

jwtAxios.interceptors.response.use(
  (res) => res,
  (err) => {
    if (err.response && err.response.data.msg === "Token is not valid") {
      console.log("Need to logout user");
    }
    return Promise.reject(err);
  }
);
export const setAuthToken = (token) => {
  if (token) {
    jwtAxios.defaults.headers.common.Authorization = `Bearer ${token}`; 
    //You can define any header params like Authorization based on the your requirements
    localStorage.setItem("token", token);
  } else {
    delete jwtAxios.defaults.headers.common.Authorization;
    localStorage.removeItem("token");
  }
};

export default jwtAxios;
```

We are using the mock APIs in our app, to get the fake data from the Crema fake DB. We are using [axios-mock-adapter](https://www.npmjs.com/package/axios-mock-adapter) to achieve this. Here is the configuration of it. you can find  out this file here `libs/mockapi/src/apis/MockConfig.js`

```javascript
import axios from '@crema/services/axios';

const MockAdapter = require('axios-mock-adapter');

export default new MockAdapter(axios, { delayResponse: 200 });

```
