Anyone trying to expose the api for their CMS! here you Go!

put this in your backend and name is http-function.js

import { ok, badRequest } from 'wix-http-functions';
import wixData from 'wix-data';

// Function to convert the Wix image URL to an external accessible URL
function convertWixImageUrl(wixImageUrl) {
  if (wixImageUrl.startsWith('wix:image://v1/')) {
    let convertedUrl = wixImageUrl.replace('wix:image://v1/', '');
    const match = convertedUrl.match(/\/([^/]+)$/);
    if (match && match[1]) {
      convertedUrl = convertedUrl.replace(match[0], '');
    return convertedUrl;
  } else {
    return wixImageUrl;

// Function to recursively convert Wix image URLs in an object
function convertWixImageUrlsInObject(obj) {
  for (let prop in obj) {
    if (typeof obj[prop] === 'string') {
      obj[prop] = convertWixImageUrl(obj[prop]);
    } else if (typeof obj[prop] === 'object') {

// Making a common open API for your data collections in Wix Code
// so other systems can consume your data
// Type in the Data Collection names you do allow to be a part
// of the common API functions (change each ‘database’ for your name of your database on query side ie: ’items’
let whiteList = ['ReplacewithDatabseName', 'ReplacewithDatabseName1', 'ReplacewithDatabseNameect'];

export function get_api(request) {
  const response = {
    headers: {
      'Content-Type': 'application/json'

  // Get name of Data Collection from path[0]
  let datacollection = request.path[0];

  // DummyData
  if (whiteList.includes(datacollection)) {
    return wixData.query(datacollection)
      .limit(1000) // You can set a reasonable limit here for performance reasons
      .ascending('title') // Sort alphabetically by title in ascending order
      .then((apiResults) => {
        if (apiResults.totalCount > 0) {
          // Convert Wix image URLs in the response before sending to the client
          apiResults.items.forEach((item) => {

          response.body = {
            items: apiResults.items
          return ok(response);

        response.body = {
          items: "No items found in the collection."
        return ok(response);

  response.body = {
    error: "Data Collection is not allowed to be used through this API."
  return badRequest(response);

My next problem to add is that i want it to allow access to Posts, messages, groups, forums, and other things if the request has the sites Oath Key in the header. but this works perfect for now. and it even allows you to get the images url instead of the wix.image link that dont work in flutter yet. Hope this helps anyone as it was hard to get done. lots of help from wix and GPT chat. but its clean and works awesome! enjoy

1 Like

for anyone listening. I think im making more headway. I now have all my wix api data in my flutterflow app and ita beautiful and super fast. I found that wonderpush works well with web push notificatins and adds to wix quite nice. Now looking at wix Headless trying to change its sdk into flutterflow! Wix please make a FlutterFlow Plugin! Please!!! flutter flow is an amazing flutter app builder that is visual just like wix! Anyway. any advise would be nice. i’ll keep ya’ll posted on progress

Use Wix Headless for these type of things. Wix Headless—The Headless Solution Built for You |

You can use Wix Headless to access your Wix Apps data and APIs in your custom build mobile app/website/web app basically anything you work on.

1 Like

Yes. but wix headless SDK is javascript and not compatible with flutter or flutter flowyet? :(. been trying so hard lol

I think there are REST APIs too. So you can make requests to APIs without SDK.

REST Portal (

1 Like

thank you! that helps allot!

read that page. it says you have to use wix headless? wix headless requires the sdk for auth. Fluter dart does not support SDK javascript. so i cant import them into FlutterFlow. forces me to use my api code in backend. but this does not allow me auth or blogs or anything like this. cant wait for that to work one day:)

There should be REST APIs for the same things:

Request An Access Token | REST (

Login V 2 | REST (

1 Like