Skip to main content
Use server exports when your FiveM resource needs to manage FiveMesh CDN objects. The default service key is read from FIVEMESH_API_KEY, so these exports should be called from server-side Lua or JavaScript. Lua callers can read the returned value directly. Failed exports return success = false with an error payload. JavaScript callers can use the returned Promise with await.

Upload a file

Use uploadFile when you already have bytes, a data URL or a Blob-compatible value.
Upload responses include the stored object and its publicUrl. canvas.toDataURL() values and raw binary strings produced by atob() can be passed directly. When the value is bare base64 without a data: prefix, declare the representation explicitly:

Upload an image data URL

Use uploadImage when a script gives you an image as a data URL.

Use an API key profile

Pass keyProfile when an export should use a named key such as FIVEMESH_API_KEY_MUGSHOTS instead of the default FIVEMESH_API_KEY.
The profile name is case-sensitive and is appended directly to FIVEMESH_API_KEY_.

Upload multiple files

Use bulkUpload when a resource needs to upload a small batch and handle per-file results.

List CDN objects

Use listObjects with a path and optional pagination limit.
If continuationToken is returned, pass it to the next call.

Delete objects

Use deleteObject for one path or bulkDelete for a batch.
Bulk delete returns one result per path, so your script can log partial failures.

Purge CDN files

Use purgeObjects when a resource needs Cloudflare to refresh public CDN files after an overwrite or external change. The paths are bucket-relative and must be allowed by the service key.
The service key needs cdn:purge for this export.

Export reference