> 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.

# Create Folder

POST https://business.me-mate.net/partners/wp-gallery/manage/folders
Content-Type: application/json

## Create Folder

Creates a new folder for the authenticated user.\
You can optionally create the folder **inside another folder** using `parent_id`.

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

***

## Authentication

This endpoint requires authentication.

Use a **Bearer token** in the `Authorization` header:

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

***

## Headers

| Header        | Value                      |
| ------------- | -------------------------- |
| Content-Type  | application/json           |
| Authorization | Bearer \{\{access\_token}} |

***

## Required Variables

| Variable       | Required | Description                 |
| -------------- | -------- | --------------------------- |
| `base_url`     | Yes      | Base API URL                |
| `access_token` | Yes      | Authentication access token |

***

## Body (raw JSON)

Send the request body as **raw JSON**.

| Field       | Type    | Required | Description             |
| ----------- | ------- | -------- | ----------------------- |
| `name`      | string  | Yes      | Name of the new folder  |
| `parent_id` | integer | No       | ID of the parent folder |

Example request body:

```json
{
  "name": "Campaign Photos",
  "parent_id": 10
}
```

Notes:

* If `parent_id` is **null or omitted**, the folder will be created at the **root level**.
* If `parent_id` is provided, the folder will be created **inside that folder**.

***

## Sample Request

```bash
curl --request POST "{{base_url}}/folders" \
  --header "Authorization: Bearer {{access_token}}" \
  --header "Content-Type: application/json" \
  --data '{
    "name": "Campaign Photos",
    "parent_id": 10
  }'
```

***

## Sample Success Response

A successful request typically returns **HTTP 200 OK**.

```json
{
  "success": true,
  "message": "Folder created successfully",
  "data": {
    "user_id": 43028,
    "name": "Campaign Photos",
    "parent_id": 10,
    "is_system": false,
    "updated_at": "2026-03-10T06:25:32.000000Z",
    "created_at": "2026-03-10T06:25:32.000000Z",
    "id": 11
  }
}
```

***

## Response Fields

| Field        | Type         | Description                                |
| ------------ | ------------ | ------------------------------------------ |
| `id`         | integer      | Unique folder ID                           |
| `user_id`    | integer      | Owner user ID                              |
| `name`       | string       | Folder name                                |
| `parent_id`  | integer/null | Parent folder ID                           |
| `is_system`  | boolean      | Indicates if the folder is a system folder |
| `created_at` | datetime     | Folder creation timestamp                  |
| `updated_at` | datetime     | Last update timestamp                      |

***

## Common Errors

* **400 Bad Request**

  * Missing `name`
  * Invalid `parent_id`

* **401 Unauthorized / 403 Forbidden**

  * Missing or invalid `Authorization` header
  * Expired `{{access_token}}`

* **404 Not Found**

  * Provided `parent_id` does not exist

***

## Notes

* Folder names **do not need to be unique**, but it's recommended for better organization.
* Useful for creating **nested folder structures**.
* The folder will belong to the **authenticated user** automatically.

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/folder-management-ap-is/create-folder

## Request

### Body (application/json)

- `name` (string, required)
- `parent_id` (integer, required)

## Response

### 201

Created

- `data` (object, required)
  - `id` (integer, required)
  - `name` (string, required)
  - `user_id` (integer, required)
  - `is_system` (boolean, required)
  - `parent_id` (integer, required)
  - `created_at` (datetime, required)
  - `updated_at` (datetime, required)
- `message` (string, required)
- `success` (boolean, required)

## Examples

**Request**

```json
{
  "name": "Campaign Photos",
  "parent_id": 10
}
```

**Response**

```json
{
  "data": {
    "id": 11,
    "name": "Campaign Photos",
    "user_id": 43028,
    "is_system": false,
    "parent_id": 10,
    "created_at": "2026-03-10T06:25:32Z",
    "updated_at": "2026-03-10T06:25:32Z"
  },
  "message": "Folder created successfully",
  "success": true
}
```

**SDK Code**

```python
import requests

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

payload = {
    "name": "Campaign Photos",
    "parent_id": 10
}
headers = {"Content-Type": "application/json"}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript
const url = 'https://business.me-mate.net/partners/wp-gallery/manage/folders';
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json'},
  body: '{"name":"Campaign Photos","parent_id":10}'
};

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/folders"

	payload := strings.NewReader("{\n  \"name\": \"Campaign Photos\",\n  \"parent_id\": 10\n}")

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

	req.Header.Add("Content-Type", "application/json")

	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/folders")

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

request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n  \"name\": \"Campaign Photos\",\n  \"parent_id\": 10\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/folders")
  .header("Content-Type", "application/json")
  .body("{\n  \"name\": \"Campaign Photos\",\n  \"parent_id\": 10\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/folders', [
  'body' => '{
  "name": "Campaign Photos",
  "parent_id": 10
}',
  'headers' => [
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp
using RestSharp;

var client = new RestClient("https://business.me-mate.net/partners/wp-gallery/manage/folders");
var request = new RestRequest(Method.POST);
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"name\": \"Campaign Photos\",\n  \"parent_id\": 10\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = ["Content-Type": "application/json"]
let parameters = [
  "name": "Campaign Photos",
  "parent_id": 10
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://business.me-mate.net/partners/wp-gallery/manage/folders")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
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()
```