# Upload a File

{% hint style="info" %}
This API is currently available only for PRO, Production, and Enterprise customers.
{% endhint %}

```http
POST https://{server_address}/external/api/upload?token={token}
Content-Type: multipart/form-data; boundary=someboundary

--someboundary
Content-Disposition: form-data; name="upfile"; filename="file.png"
Content-Type: application/octet-stream

*My awesome poem*
--someboundary--
```

### Responses

{% tabs %}
{% tab title="Successfully uploaded" %}
Status code: `200 OK`\
The body consists of a URL, that is pointing to the uploaded file.

Example:

```
https://fra1.blynk.cloud/device_uploads/35587/8vPs4QSrfKOXyxZnXJhz0lA6cax7WQe8.png
```

{% endtab %}

{% tab title="Invalid Device Token" %}
Status code: `400 Bad Request`\
Example body:

```json
{"error":{"message":"Invalid token."}}
```

{% endtab %}

{% tab title="File uploads limit has been reached" %}
Status code: `403 Forbidden`\
Example body:

```json
{"error":{"message":"File uploads limit has been reached."}}
```

{% endtab %}
{% endtabs %}

cURL example:

```bash
$ curl -X POST -F upfile=@image.png https://{server_address}/external/api/upload?token={token}
```

cURL example with real data:

```bash
$ curl -X POST -F upfile=@image.png https://fra1.blynk.cloud/external/api/upload?token=jO3u7d6qkjWncxw91D1glSHIe5hJ7bSk

https://fra1.blynk.cloud/device_uploads/35587/8vPs4QSrfKOXyxZnXJhz0lA6cax7WQe8.png
```

### Limitations

* Each device may hold up to 10 files. If the limit is exceeded - the oldest file will be deleted.
* Each file should be up to 5MB.
* Each device can upload up to 1,000
* Uploading a file with the same specified name, that was uploaded before, would override the existing file.

All the above limits could be changed based on the Enterprise client's needs.

The uploaded images could be previewed in the "Developer Tools" section:

<figure><img src="https://1839001309-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MBFTVMf7L6S67HOuqVC%2Fuploads%2FJ6fDDWqOUj2C0FQKzvRg%2Fupload.jpg?alt=media&#x26;token=1eeab76c-4ce2-40f7-8325-0164ff617dbe" alt=""><figcaption><p>File Storage for the uploaded images</p></figcaption></figure>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.blynk.io/en/blynk.cloud/device-https-api/upload-a-file.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
