test('Login Via API', async ({ request }) => {
let response;
response = await request.post("api url", {
headers: header,
data: loginpayLoad
});
await request.storageState({path:"Storagestate.json"});
Json file should contain all the cookies and origins