I don't think it's possible to directly access the geospatial data in QFieldCloud using the API. You could use the API to download the files into your local environment however.
Here's a potential Python solution. One assumption I have made is your data is in GeoPackage format, but you could adapt it for other filetypes (I've never used PostGIS in QField, so wouldn't know what to do in that situation):
Install the qfeldcloud-sdk module for Python:
pip install qfieldcloud-sdk
The Python:
import requests
from qfieldcloud_sdk import sdk
client = sdk.Client(
url="https://app.qfield.cloud/api/v1/"
)
client.login(username='yourusername', password='yourpassword')
try:
projects = client.list_projects()
for proj in projects:
files= []
for file in client.list_remote_files(proj["id"]):
if file["name"][-5:] == '.gpkg':
files.append(file)
client.download_files(files, proj["id"], sdk.FileTransferType.PROJECT, 'your_destination_path' )
print('Downloaded')
except requests.exceptions.RequestException:
print("Oops!")
This should download all GeoPackages from your QFieldCloud. This answer has been adapted from the example in the documentation: https://docs.qfield.org/reference/qfieldcloud/sdk/
The documentation for the sdk is pretty light (what I found anyway), but you can view the code here which is pretty handy: https://github.com/opengisch/qfieldcloud-sdk-python/blob/master/qfieldcloud_sdk/sdk.py