> For the complete documentation index, see [llms.txt](https://ninjateam.gitbook.io/filebird/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://ninjateam.gitbook.io/filebird/integrations/developer-zone/apis.md).

# APIs

Click the button below to redirect to Postman

[![Run In Postman](https://run.pstmn.io/button.svg)](https://app.getpostman.com/run-collection/1962902-227b8971-e3c6-4a91-b9fb-5a7f680e7062?action=collection%2Ffork\&source=rip_markdown\&collection-url=entityId%3D1962902-227b8971-e3c6-4a91-b9fb-5a7f680e7062%26entityType%3Dcollection%26workspaceId%3Dd26c27f9-229b-4fc2-86e2-b4f86d7c1608)

## Get Folder Detail

<mark style="color:blue;">`GET`</mark> `https://your-site.com/wp-json/filebird/public/v1/folder/?folder_id=`

Get detail of folder by folder\_id

#### Query Parameters

| Name       | Type    | Description   |
| ---------- | ------- | ------------- |
| folder\_id | integer | The folder id |

#### Headers

| Name          | Type   | Description  |
| ------------- | ------ | ------------ |
| Authorization | string | Bearer Token |

{% tabs %}
{% tab title="200 " %}

```
{
  "success": true,
  "data": {
    "folder": {
      "id": "1690",
      "name": "Cats",
      "parent": "0"
    }
  }
}
```

{% endtab %}

{% tab title="401 " %}

```
{
  "code": "rest_forbidden",
  "message": "Sorry, you are not allowed to do that.",
  "data": {
    "status": 401
}
```

{% endtab %}
{% endtabs %}

## Get Folders

<mark style="color:blue;">`GET`</mark> `https://your-site.com/wp-json/filebird/public/v1/folders`

This endpoint allows you to get folders

#### Headers

| Name          | Type   | Description  |
| ------------- | ------ | ------------ |
| Authorization | string | Bearer Token |

{% tabs %}
{% tab title="200 " %}

```
{
    "success": true,
    "data": {
        "folders": [
            {
                "id": 1087,
                "text": "Bird",
                "children": [],
                "li_attr": {
                    "data-count": 1,
                    "data-parent": 0
                },
                "count": 19
            },
            {
                "id": 1088,
                "text": "Cat",
                "children": [],
                "li_attr": {
                    "data-count": 1,
                    "data-parent": 0
                },
                "count": 14
            },
            {
                "id": 1089,
                "text": "Dog",
                "children": [],
                "li_attr": {
                    "data-count": 1,
                    "data-parent": 0
                },
                "count": 23
            }
        ]
    }
}
```

{% endtab %}

{% tab title="401 " %}

```
{
  "code": "rest_forbidden",
  "message": "Sorry, you are not allowed to do that.",
  "data": {
    "status": 401
  }
}
```

{% endtab %}
{% endtabs %}

## Create New Folder

<mark style="color:green;">`POST`</mark> `https://your-site.com/wp-json/filebird/public/v1/folders`

This endpoint allows you to create new folder.

#### Headers

| Name          | Type   | Description  |
| ------------- | ------ | ------------ |
| Authorization | string | Bearer Token |

#### Request Body

| Name       | Type    | Description                                 |
| ---------- | ------- | ------------------------------------------- |
| name       | string  | Your folder name.                           |
| parent\_id | integer | The parent id of your folder. 0 for parent. |

{% tabs %}
{% tab title="200 " %}

```
{
    "success": true,
    "data": {
        "id": 40
    }
}
```

{% endtab %}

{% tab title="401 " %}

```
{
    "code": "rest_forbidden",
    "message": "Sorry, you are not allowed to do that.",
    "data": {
        "status": 401
}
```

{% endtab %}
{% endtabs %}

## Get Attachment Ids by Folder Id

<mark style="color:blue;">`GET`</mark> `https://your-site.com/wp-json/filebird/public/v1/attachment-id/?folder_id=`

This endpoint allows you to get Attachment IDs by folder\_id

#### Query Parameters

| Name       | Type    | Description    |
| ---------- | ------- | -------------- |
| folder\_id | integer | Your Folder Id |

#### Headers

| Name          | Type   | Description  |
| ------------- | ------ | ------------ |
| Authorization | string | Bearer Token |

{% tabs %}
{% tab title="200 " %}

```
{
    "success": true,
    "data": {
        "attachment_ids": [
            "8",
            "30"
        ]
    }
}
```

{% endtab %}

{% tab title="401 " %}

```
{
    "code": "rest_forbidden",
    "message": "Sorry, you are not allowed to do that.",
    "data": {
        "status": 401
}
```

{% endtab %}
{% endtabs %}

## Add attachment(s) to folder

<mark style="color:green;">`POST`</mark> `https://your-site.com/wp-json/filebird/public/v1/folder/set-attachment`

#### Headers

| Name          | Type   | Description  |
| ------------- | ------ | ------------ |
| Authorization | string | Bearer Token |

#### Request Body

| Name   | Type   | Description                                         |
| ------ | ------ | --------------------------------------------------- |
| folder | number | The folder id                                       |
| ids    | number | The attachment ID, it could be a number or an array |

{% tabs %}
{% tab title="200 " %}

```
{
    "success": true
}
```

{% endtab %}

{% tab title="401 " %}

```
{
    "code": "rest_forbidden",
    "message": "Sorry, you are not allowed to do that.",
    "data": {
        "status": 401
    }
}
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
set folder = 0 to move images from those folders to **Uncategorized**
{% endhint %}

## Get Attachment Count by Folder Id

<mark style="color:blue;">`GET`</mark> `https://your-site.com/wp-json/filebird/public/v1/attachment-count/?folder_id=`

folder\_id=-1 for All Folder

folder\_id=0 for Uncategorized Folder

{% tabs %}
{% tab title="200: OK " %}

```javascript
{
  "success": true,
  "data": {
    "count": 1
  }
}
```

{% endtab %}
{% endtabs %}
