Docs
Docs
Uploads are a way to store files in Kernex's cloud storage. They are working the same exact way as the Resources, but they are optimized for file storage. Unlike the resources, that are defined by you, the uploads are managed by Kernex and they have a fixed structure.
Please check the Rest API section for more information about how to interact with the API.
The upload structure is the following:
_id (string, readonly): the unique identifier of the uploadurl (string, readonly): the absolute URL of the file, that you can use to access the file.This is the URL that you should use when you want to display the file in your website.title (string): the title of the uploaddescription (string): description of the uploadname (string, readonly): the name of the filefileId (number, readonly): an id of the file (used internally by Kernex), in the storage bucket.ext (string, readonly): the extension of the filecontentType (string, readonly): the content type of the filecreatedAt (string, readonly): the date when the upload was createdupdatedAt (string, readonly): the date when the upload was updatedThe base endpoint URL for the uploads is:
https://api.kernex.io/api/v1/:appId/uploadsCreate a new Upload entry.
The only required field when you create a new upload, is thefile field, which has to be a data URI stringURL
https://api.kernex.io/api/v1/:appId/uploadsHTTP Method
POSTHeaders
x-api-key: your-api-keycontent-type: application/jsonBody:
{
"title": "Black Shirt",
"description": "Black shirt with a white dragon",
"file": "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEAS..."
}Request Example
curl "https://api.kernex.io/api/v1/:appId/uploads" \
-X POST \
-H "Content-Type: application/json" \
-H "x-api-key: your-api-key" \
-d "{\"title\":\"Black Shirt\",\"description\":\"Black shirt with a white dragon\",\"file\":\"data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEAS...\"}"Response Example
{
"_id": "entryId",
"createdAt": "2025-03-31T22:35:15.873Z",
"updatedAt": "2025-03-31T22:35:15.873Z",
"title": "Black Shirt",
"description": "Black shirt with a white dragon",
"name": "black-shirt.jpg",
"ext": "jpg",
"contentType": "image/jpeg",
"url": "https://kernex.fra1.cdn.digitaloceanspaces.com/apps/your-app-id/uploads/entryId/black-shirt.jpg"
}Get a Upload entry.
URL
https://api.kernex.io/api/v1/:appId/uploads/:_idHTTP Method
GETHeaders
x-api-key: your-api-keycontent-type: application/jsonRequest Example
curl "https://api.kernex.io/api/v1/:appId/uploads/:_id" \
-X GET \
-H "Content-Type: application/json" \
-H "x-api-key: your-api-key"Response Example
{
"_id": "entryId",
"createdAt": "2025-03-31T22:35:15.873Z",
"updatedAt": "2025-03-31T22:35:15.873Z",
"title": "Black Shirt",
"description": "Black shirt with a white dragon",
"name": "black-shirt.jpg",
"ext": "jpg",
"contentType": "image/jpeg",
"url": "https://kernex.fra1.cdn.digitaloceanspaces.com/apps/your-app-id/uploads/entryId/black-shirt.jpg"
}URL
https://api.kernex.io/api/v1/:appId/uploadsParams
{
"$limit": 10,
"$skip": 0,
"$select": [
"title"
],
"$sort": {
"title": 1
}
}HTTP Method
GETHeaders
x-api-key: your-api-keycontent-type: application/jsonRequest Example
curl "https://api.kernex.io/api/v1/:appId/uploads?%24limit=10&%24skip=0&%24select%5B0%5D=title&%24sort%5Btitle%5D=1" \
-X GET \
-H "Content-Type: application/json" \
-H "x-api-key: your-api-key"Response Example
{
"data": [
{
"_id": "entryId",
"createdAt": "2025-03-31T22:35:15.873Z",
"updatedAt": "2025-03-31T22:35:15.873Z",
"title": "Hello"
},
{
"_id": "entryId",
"createdAt": "2025-03-31T22:35:15.873Z",
"updatedAt": "2025-03-31T22:35:15.873Z",
"title": "Welcome"
}
],
"total": 2,
"limit": 10,
"skip": 0
}Patch a Upload entry. Patching will update the specified fields in the data, while not changing the unspecified ones.
URL
https://api.kernex.io/api/v1/:appId/uploads/:uploadIdHTTP Method
PATCHHeaders
x-api-key: your-api-keycontent-type: application/jsonBody:
{
"title": "New title",
"description": "New Description"
}Request Example
curl "https://api.kernex.io/api/v1/:appId/uploads/:uploadId" \
-X PATCH \
-H "Content-Type: application/json" \
-H "x-api-key: your-api-key" \
-d "{\"title\":\"New title\",\"description\":\"New Description\"}"Response Example
{
"_id": "entryId",
"createdAt": "2025-03-31T22:35:15.873Z",
"updatedAt": "2025-03-31T22:35:15.873Z",
"title": "Black Shirt",
"description": "Black shirt with a white dragon",
"name": "black-shirt.jpg",
"ext": "jpg",
"contentType": "image/jpeg",
"url": "https://kernex.fra1.cdn.digitaloceanspaces.com/apps/your-app-id/uploads/entryId/black-shirt.jpg"
}Update a Upload entry. Updating will update the entry entirely. If you want to update only some fields, then use the patch method.
RECOMMENDATION: we recommend you to use the patch method instead of update.
URL
https://api.kernex.io/api/v1/:appId/uploads/:uploadIdHTTP Method
PUTHeaders
x-api-key: your-api-keycontent-type: application/jsonBody:
{
"title": "New title",
"description": "New Description"
}Request Example
curl "https://api.kernex.io/api/v1/:appId/uploads/:uploadId" \
-X PUT \
-H "Content-Type: application/json" \
-H "x-api-key: your-api-key" \
-d "{\"title\":\"New title\",\"description\":\"New Description\"}"Response Example
{
"_id": "entryId",
"createdAt": "2025-03-31T22:35:15.873Z",
"updatedAt": "2025-03-31T22:35:15.873Z",
"title": "New Title"
}Remove a Upload entry.
URL
https://api.kernex.io/api/v1/:appId/uploads/:uploadIdHTTP Method
DELETEHeaders
x-api-key: your-api-keycontent-type: application/jsonRequest Example
curl "https://api.kernex.io/api/v1/:appId/uploads/:uploadId" \
-X DELETE \
-H "Content-Type: application/json" \
-H "x-api-key: your-api-key"Response Example
{
"_id": "entryId",
"createdAt": "2025-03-31T22:35:15.873Z",
"updatedAt": "2025-03-31T22:35:15.873Z",
"title": "Hello"
}