> For the complete documentation index, see [llms.txt](https://docs.blynk.io/en/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.blynk.io/en/blynk.cloud/device-https-api/upload-a-file.md).

# 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&amp;token=1eeab76c-4ce2-40f7-8325-0164ff617dbe" alt=""><figcaption><p>File Storage for the uploaded images</p></figcaption></figure>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
