Problem with Exit position API

Here's my exit position API request in Axios.js

const url = 'https://api.fyers.in/api/v2/positions';
const headers = {
  'Authorization': 'app_id:access_token',
  'Content-Type': 'application/json',
};
const data = {
  id: 'NSE:NIFTY23JUL20050CE',
};

axios.delete(url, {
  headers: headers,
  data: data,
})
  .then(response => {
    console.log(response.data);
  })
  .catch(error => {
    console.error('An error occurred:', error);
  });

The response I'm getting is

{
    s: 'ok',
    code: 1101,
    message: 'Looks like you have no open positions.'
 }

I have an active position of NSE:NIFTY23JUL20050CE in my account.

Do you have any idea why it's happening? Is there any problem with the Fyers API or my request?

4 replies