> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://apidocs.me-mate.net/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://apidocs.me-mate.net/_mcp/server.

# Upload Files

POST https://business.me-mate.net/partners/wp-gallery/manage/files
Content-Type: multipart/form-data

## Upload Files

Uploads one or more files to a specific folder.

**Method:** `POST`\
**URL:** `{{base_url}}/files`

***

## Authentication

This endpoint requires authentication.

* **Recommended:** Bearer token in the `Authorization` header:

  ```http
                          Authorization: Bearer {{access_token}}

  ```

Notes:

* If your collection/folder already sets auth, this request can **inherit auth**.

* Ensure `{{access_token}}` is a valid, non-expired token.

***

## Required variables

Set these variables at the **environment** or **collection** level:

| Variable       | Required | Description                                                                  |
| -------------- | -------- | ---------------------------------------------------------------------------- |
| `base_url`     | Yes      | Base API URL (e.g. `https://busness.me-mate.net/partners/wp-gallery/manage`) |
| `access_token` | Yes      | Access token used to authorize the request                                   |
| `folder_id`    | Yes      | Target folder ID to upload into                                              |

***

## Body (multipart/form-data)

Send as **form-data** (`multipart/form-data`).

| Field       | Type | Required | Description                                                              |
| ----------- | ---- | -------- | ------------------------------------------------------------------------ |
| `files[]`   | file | Yes      | One or more files to upload. Use the same key (`files[]`) for each file. |
| `folder_id` | text | Yes      | Folder identifier. Usually set as `{{folder_id}}`.                       |

### Multiple files

To upload multiple files, add **multiple rows** with the same key `files[]` (each row is of type **File**) and choose a file for each.

***

## Sample request

```bash
curl --request POST "{{base_url}}/files" \
  --header "Authorization: Bearer {{access_token}}" \
  --form "folder_id={{folder_id}}" \
  --form "files[]=@/path/to/file1.png" \
  --form "files[]=@/path/to/file2.jpg"

```

***

## Sample success response (shape)

A successful upload typically returns **HTTP 201 Created** and a JSON response.

Example shape:

```json
{
  "status": "Created",
  "id": "<upload_or_resource_id>",
  "name": "Upload Files"
}

```

***

## Common errors

* **400 Bad Request**

  * Missing `folder_id`

  * No `files[]` provided

  * Invalid multipart/form-data formatting
* **401 Unauthorized / 403 Forbidden**

  * Missing/invalid `Authorization` header

  * Expired `{{access_token}}`
* **413 Payload Too Large**

  * Uploaded file(s) exceed server limits
* **415 Unsupported Media Type**

  * Request not sent as `multipart/form-data`

***

## Notes: uploading files in Postman

* In **Body → form-data**:

  * Set `files[]` row **Type** to **File** and select a file from your computer.

  * Keep `folder_id` as **Text** (e.g. `{{folder_id}}`).

* Do **not** manually set the `Content-Type: multipart/form-data` header; Postman will set it (including the boundary) automatically.

* If you run this in a Runner/Monitor, ensure the executing context has access to the referenced files (file selection is local to the client session on web/desktop).

Reference: https://apidocs.me-mate.net/business-me-mate-net-ap-is-document-v-1-0/messenger-mate-gallery-app-file-upload-folder-management-api/file-upload-ap-is/upload-files

## Request

### Body (multipart/form-data)

- `files[]` (file, required)
- `folder_id` (string, required)

## Response

### 201

Created

- `data` (list of object, required)
  - `id` (integer, required)
  - `url` (string, required)
  - `hash` (string, required)
  - `name` (string, required)
  - `path` (string, required)
  - `size` (integer, required)
  - `type` (string, required)
  - `folder` (object, required)
    - `id` (integer, required)
    - `name` (string, required)
    - `user_id` (string, required)
    - `is_system` (boolean, required)
    - `parent_id` (integer, required)
    - `created_at` (datetime, required)
    - `file_count` (integer, required)
    - `updated_at` (datetime, required)
    - `deleted_at` (any, optional, nullable)
  - `user_id` (integer, required)
  - `extension` (string, required)
  - `folder_id` (integer, required)
  - `mime_type` (string, required)
  - `path_hash` (string, required)
  - `created_at` (datetime, required)
  - `updated_at` (datetime, required)
  - `uploaded_at` (datetime, required)
  - `original_name` (string, required)
  - `is_whatsapp_compatible` (boolean, required)
  - `whatsapp_compatibility_reason` (string, required)
- `message` (string, required)
- `success` (boolean, required)

## Examples

**Request**

```json
{
  "files[]": "<file: <file1>>",
  "folder_id": "folder_id"
}
```

**Response**

```json
{
  "data": [
    {
      "id": 36,
      "url": "https://business.me-mate.net/getgabs-uploads/cdngallery/9f86443bd9f2ad28d1be4b62e8783e96720ec87a2ba86fcbeb5fc537483bf05b/files/10/42BFYPBGdWpvGwRF.jpg",
      "hash": "f0fa2e00b72f8c89d487b1ca6ff12b54edabca7b248183b06f04c8b9a09276b2",
      "name": "user_profile.jpg",
      "path": "cdngallery/9f86443bd9f2ad28d1be4b62e8783e96720ec87a2ba86fcbeb5fc537483bf05b/files/10/42BFYPBGdWpvGwRF.jpg",
      "size": 21896,
      "type": "image",
      "folder": {
        "id": 10,
        "name": "test2",
        "user_id": "43028",
        "is_system": false,
        "parent_id": 9,
        "created_at": "2026-03-09T13:10:07Z",
        "file_count": 14,
        "updated_at": "2026-03-10T05:34:50Z"
      },
      "user_id": 43028,
      "extension": "jpg",
      "folder_id": 10,
      "mime_type": "image/jpeg",
      "path_hash": "5b5e30a920727af9b1a4f7b3df40a0913efca79d6653938664cdeae984feff62",
      "created_at": "2026-03-10T05:34:50Z",
      "updated_at": "2026-03-10T05:34:50Z",
      "uploaded_at": "2026-03-10T05:34:50Z",
      "original_name": "user_profile.jpg",
      "is_whatsapp_compatible": true,
      "whatsapp_compatibility_reason": "Ready for WhatsApp"
    }
  ],
  "message": "1 file(s) uploaded successfully",
  "success": true
}
```

**SDK Code**

```python
import requests

url = "https://business.me-mate.net/partners/wp-gallery/manage/files"

files = { "files[]": "open('<file1>', 'rb')" }
payload = { "folder_id": "folder_id" }

response = requests.post(url, data=payload, files=files)

print(response.json())
```

```javascript
const url = 'https://business.me-mate.net/partners/wp-gallery/manage/files';
const form = new FormData();
form.append('files[]', '<file1>');
form.append('folder_id', 'folder_id');

const options = {method: 'POST'};

options.body = form;

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://business.me-mate.net/partners/wp-gallery/manage/files"

	payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"files[]\"; filename=\"<file1>\"\r\nContent-Type: application/octet-stream\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"folder_id\"\r\n\r\nfolder_id\r\n-----011000010111000001101001--\r\n")

	req, _ := http.NewRequest("POST", url, payload)

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://business.me-mate.net/partners/wp-gallery/manage/files")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"files[]\"; filename=\"<file1>\"\r\nContent-Type: application/octet-stream\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"folder_id\"\r\n\r\nfolder_id\r\n-----011000010111000001101001--\r\n"

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://business.me-mate.net/partners/wp-gallery/manage/files")
  .body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"files[]\"; filename=\"<file1>\"\r\nContent-Type: application/octet-stream\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"folder_id\"\r\n\r\nfolder_id\r\n-----011000010111000001101001--\r\n")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://business.me-mate.net/partners/wp-gallery/manage/files', [
  'multipart' => [
    [
        'name' => 'files[]',
        'filename' => '<file1>',
        'contents' => null
    ],
    [
        'name' => 'folder_id',
        'contents' => 'folder_id'
    ]
  ]
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://business.me-mate.net/partners/wp-gallery/manage/files");
var request = new RestRequest(Method.POST);
request.AddParameter("undefined", "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"files[]\"; filename=\"<file1>\"\r\nContent-Type: application/octet-stream\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"folder_id\"\r\n\r\nfolder_id\r\n-----011000010111000001101001--\r\n", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation
let parameters = [
  [
    "name": "files[]",
    "fileName": "<file1>"
  ],
  [
    "name": "folder_id",
    "value": "folder_id"
  ]
]

let boundary = "---011000010111000001101001"

var body = ""
var error: NSError? = nil
for param in parameters {
  let paramName = param["name"]!
  body += "--\(boundary)\r\n"
  body += "Content-Disposition:form-data; name=\"\(paramName)\""
  if let filename = param["fileName"] {
    let contentType = param["content-type"]!
    let fileContent = String(contentsOfFile: filename, encoding: String.Encoding.utf8)
    if (error != nil) {
      print(error as Any)
    }
    body += "; filename=\"\(filename)\"\r\n"
    body += "Content-Type: \(contentType)\r\n\r\n"
    body += fileContent
  } else if let paramValue = param["value"] {
    body += "\r\n\r\n\(paramValue)"
  }
}

let request = NSMutableURLRequest(url: NSURL(string: "https://business.me-mate.net/partners/wp-gallery/manage/files")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```