post
https://api.duodeal.app/api/medias
Uploads a new media file.
Files can be uploaded either as base64-encoded data or by providing a URL to fetch the file from.
Body Fields
| Field | Type | Required | Description |
|---|---|---|---|
name | string | Yes | File name with extension |
mime | string | Yes | MIME type (e.g., image/png, application/pdf) |
folder | string | Yes | Folder/category for organization |
file | string | No* | Base64-encoded file data (data URI format) |
fromUrl | string | No* | URL to fetch the file from |
*Either file or fromUrl must be provided.
Supported MIME Types
| Category | MIME Types |
|---|---|
| Images | image/jpeg, image/png, image/gif, image/webp, image/svg+xml |
| Documents | application/pdf |
| Other | Depends on server configuration |
Base64 File Format
The file field should be in data URI format:
data:<mime-type>;base64,<base64-encoded-data>
Example for a PDF:
data:application/pdf;base64,JVBERi0xLjQK...
Response Fields
| Field | Type | Description |
|---|---|---|
id | integer | Newly created media unique identifier |
name | string | File name |
url | string | Public URL to access the file |
mime | string | MIME type |
folder | string | Folder/category |
path | string | Storage path |
thumbnail | string | Thumbnail URL (generated for images) |
thumbPath | string | Thumbnail storage path |
createdAt | datetime | Creation timestamp |
updatedAt | datetime | Last update timestamp |
Response
201 Created: Media successfully uploaded400 Bad Request: Invalid request body, unsupported file type, or missing file data401 Unauthorized: Invalid or missing API key
Recent Requests
Log in to see full request history
| Time | Status | User Agent | |
|---|---|---|---|
Retrieving recent requests… | |||
Loading…
201Resource created
400Bad request
401Unauthorized
