# POST /api/files > Files - Upload a File The filename sent by the client is never used as given: it is reduced to its basename, rewritten to a strict character whitelist, length capped, then validated against the RISE core extension allowlist before the core move_temp_file() gives it a unique prefix. - **Endpoint:** `POST /api/files` - **Group:** Files - **Since:** v1.0.0 - **Defined in:** `RestApi/Controllers/FilesController.php` ## Headers | Field | Type | Description | | --- | --- | --- | | `authtoken` | String | Authentication token, generated from admin area | | `Content-Type` | String | multipart/form-data | ## Parameters | Field | Type | Required | Description | | --- | --- | --- | --- | | `file` | File | yes | Mandatory file part. The extension must be listed in the RISE "accepted file formats" setting; PHP extensions are always refused. Maximum 25 MB. | | `context` | String | yes | Mandatory context. One of: project, client, global, user. | | `context_id` | Number | no | Mandatory for project (project ID), client (client ID) and user (RISE user ID). Ignored for global. | | `folder_id` | Number | no | Optional destination folder ID. Default 0, meaning the root of the context. | | `category_id` | Number | no | Optional file category ID. Project context only. | | `description` | String | no | Optional description stored with the file. | | `created_by` | Number | no | Optional RISE user ID recorded as the uploader. Default: 1. | ## Request example ```bash curl -X POST "https://yoursite.com/index.php/api/files" \ -H "authtoken: YOUR_API_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "file": "...", "context": "..." }' ``` ## Responses ### Success - Success-Response: ```json HTTP/1.1 201 Created { "status": 200, "messages": {"success": "The record has been saved."}, "id": 12, "source": "project" } ``` ### Error - Error-Response: ```json HTTP/1.1 400 Bad Request { "status": false, "messages": { "error": "File type is not allowed." } } ``` --- Part of the [REST API for RISE CRM](https://risecrm.themesic.com/apiguide/) documentation. Full page: https://risecrm.themesic.com/apiguide/files/create-file/