Zoho Books API: Code 57: "You are not authorized to perform this operation"

Zoho Books API: Code 57: "You are not authorized to perform this operation"

Hello,

I've been trying to setup API calls via TS/JavaScript, to create invoices, but keep running into code 57, when using OAuth access token flow, with scope ZohoBooks.fullaccess.all;

Initiating the OAuth with;

  1. https://accounts.zoho.eu/oauth/v2/auth?scope=ZohoBooks.fullaccess.all&client_id=XXXX&response_type=code&access_type=offline&redirect_uri=YYYY
Which I am successfully acquiring refresh/access tokens.

Then calling Books API invoice endpoint;

  1. const invoiceResponse = await axios({
  2.             method: 'POST',
  3.             url: `https://www.zohoapis.com/books/v3/invoices?organization_id=${process.env.ZOHO_ORGANIZATION_ID!}`,
  4.             headers: {
  5.               'Authorization': `Zoho-oauthtoken ${secret.access_token}`,
  6.               'Content-Type': 'application/json;charset=UTF-8'
  7.             },
  8.             data: invoiceData
  9.           });
I have console logged the Zoho Org ID, and confirmed the access tokens are being passed correctly, during testing.


Response is always;

  1. data: {
  2. code: 57,
  3. message: 'You are not authorized to perform this operation'
  4. }

Any suggestions?