Problem with Create Resourse on Bookings with code

Hello,

I’m trying to create a booking resource programmatically in the backend using the following code snippet, which wraps the resources.createResource function with elevate() from wix-auth:

import { elevate } from 'wix-auth';
import { resources } from 'wix-bookings-backend';

const elevatedCreateResource = elevate(resources.createResource);

export async function createResourceWithElevatedPermissions() {
  const resourceInfo = {
    name: "Nuevo recurso",
    type: "INDIVIDUAL",
    locationOptions: {
      specificLocationOptions: {
        availableInBusinessLocations: true
      }
    }
  };

  const scheduleInfo = [
    {
      availability: {
        linkedSchedules: [],
        start: new Date(),
      },
    },
  ];
  const options = { suppressAuth: true };
  
  try {
    const result = await elevatedCreateResource(resourceInfo, scheduleInfo, options);
    return result;
  } catch (error) {
    console.error("Error creating resource:", error);
    throw error;
  }
}

Despite using elevate() and passing suppressAuth: true in options, I still receive a 403 Forbidden error when executing this function.

Has anyone else experienced this? Could it be that Wix has restricted the creation of booking resources via API recently?

Thanks in advance for any help!

maybe take a look at this reference

Thanks!! I also tried with this one, but I’m still getting this error:

Failed to create resource: message: ‘: Forbidden’
details:
applicationError:
description: Forbidden
code: FORBIDDEN
data: {}

I have already verified that the account has permissions but I still cannot create a resource.