Upload a new file or folder, including metadata settings.
To the request should be a multipart form if it's a file being uploaded, and a request with a JSON body if it's a folder.
| URL | https://api.telecomx.dk/file | |
|---|---|---|
| Method | POST - with a JSON body for folder creation | |
| POST - with multipart/form-data for uploading a file | ||
| Access level | MANAGER, OWNER - create on customer self RESELLER, RESELLER_ADMIN or ADMIN - create on specified customer, defaults to own customer. |
|
| Body | file | Attached file, not used if type is FOLDER |
| filename | Filename of the uploaded file, allows the user to give the file a better display name. | |
| accessLevel | Determines who can access the document. ALL, CUSTOMER, EMPLOYEE, RESELLER. | |
| description | Optional description of file. | |
| type | Type of file. Only used when creating a folder, then type should be FOLDER. | |
| customer | Optional Id of customer to create on (only applies to RESELLER, RESELLER_ADMIN and ADMIN). | |
| folder | Optional Id of the parent folder to place the document in. Must belong to the same customer. | |
https://api.telecomx.dk/file
The response will be the newly created document, if no errors occurred.
| Property | Type | Description |
|---|---|---|
| _id | ObjectID | Id |
| filename | String | Filename |
| fileId | ObjectID | Id used to reference to file on file server |
| size | Integer | Size of the file in bytes |
| filetype | String | Filetype: png, jpg, gif, xls, xlsx, doc, docx, pdf, ppt, pptx, txt, csv |
| folder | ObjectId | Reference to the folder which contains this file |
| employee | ObjectID | Id of employee who added the file |
| customer | ObjectID | Id of the customer the file was added to |
| type | String | Type of file: PORTING, INTERNET, AUDIO, IMAGE, DOC, FOLDER, OTHER |
| width | Integer | If image, then this is the width in pixels |
| height | Integer | If image, then this is the height in pixels |
| description | String | Optional description for the file, e.g. 'Porting of 81808888' |
| date | ISODate | Date and time when the file was added |
| lastUpdated | ISODate | Date and time when the file was last updated/edited |
| accessLevel | Enum | Determines who can access the file. ALL, CUSTOMER, EMPLOYEE, RESELLER |
| url | String | URL for accessing the uploaded file (multipart uploads). |
{ "_id": "650000000000000000000801", "filename": "Power of attorney.pdf", "size": 35465, "filetype": "pdf", "fileId": "650000000000000000000901", "employee": "650000000000000000000a01", "customer": "650000000000000000000101", "type": "DOC", "description": "Signed power of attorney", "date": "2025-01-01T12:34:56.123Z", "accessLevel": "EMPLOYEE", "url": "https://doc.telecomx.dk/650000000000000000000901.pdf" }
| Error code | Message | Description |
|---|---|---|
| 400 | type | Only folders can be created via JSON; use multipart upload for files |
| 404 | filename | Filename is missing (JSON folder creation) |
| 422 | fields | Not all fields are provided |
| 422 | file | No file uploaded |
| 422 | file | Upload aborted by system due to insufficient storage or excessive file size |
| 422 | storage | There is not enough available storage to upload this file |
| 422 | accessLevel | Invalid access level |
| 422 | accessLevel | A personal file can not be created on a reseller's customer |
| 422 | folder | Folder and parent folder don't belong to the same customer |
| 404 | customer | Customer not found |
| 403 | accessLevel | No access to this folder |
| 403 | access_denied | Insufficient access level |
| 500 | internal_error | <Unspecified> |