POST

Folders.Counts

Alias of Folders.ListWithCounts. Returns visible folders and customer counts in one response.

Permissions

  • User must be logged in with a valid bearer token.
  • Returned or changed records are limited by the user permissions, team access, folder access, and account settings.

Action

  • Runs the Folders.Counts function and returns JSON.

Push Service

No push is sent because this function only reads data or returns helper information.

Automation

No automation is run for this function.

Special Instructions

  • Use this instead of calling User.Basic and then Customer.Count for every folder.
  • Folder list comes from User.Basic visibility rules (shared_with_folder, hidden folders, system folders).
  • Each folder count uses the same customer visibility and folder filter logic as Customer.Count with folder_id.
  • Optional list/count filters from Customer.List (search, status_id, tag, team_member_id, dates, etc.) are applied to every folder total when sent.
  • Response includes data[] rows with folder details plus count/customer_count, and counts{} map keyed by folder id (dashboard html format).

Required Parameters

No body parameters are required for this function.

Optional Parameters

NameTypeSampleWhat it gives
search
post
stringjohnOptional. Same customer search filter as Customer.Count. Applied to each folder count.
filter_data
post
stringjohnAlias for search.
status_id
post
mixed1Optional customer status filter applied to each folder count.
tag_id
post
mixed5Optional tag filter applied to each folder count.
team_member_id
post
mixed47Optional team member filter applied to each folder count.

Authentication

Send the bearer token returned by Login in the request header.

Authorization: Bearer YOUR TOKEN

Sample Request

{
    "url": "\/app\/Folders.Counts",
    "method": "POST",
    "headers": {
        "Authorization": "Bearer YOUR TOKEN"
    },
    "body": [],
    "url_user": "https:\/\/{user}.bull36.com\/app\/Folders.Counts",
    "url_domain": "https:\/\/{domain}\/app\/Folders.Counts"
}

Endpoint

POST /app/Folders.Counts
POST https://{user}.bull36.com/app/Folders.Counts
POST https://{domain}/app/Folders.Counts

Sample Output

{
    "success": 1,
    "message": "Success",
    "count": 3,
    "source": "customer_folders",
    "data": [
        {
            "id": 1,
            "folder_id": 1,
            "name_en": "New",
            "name_he": "חדש",
            "color": "#2490ef",
            "count": 45,
            "customer_count": 45
        },
        {
            "id": 2,
            "folder_id": 2,
            "name_en": "Active",
            "name_he": "פעיל",
            "color": "#22c55e",
            "count": 12,
            "customer_count": 12
        }
    ],
    "counts": {
        "1": 45,
        "2": 12
    }
}

Count Only

Use the matching count route with the same filters when the UI only needs total rows for paging.

{
    "url": "\/app\/Folders.Counts",
    "url_user": "https:\/\/{user}.bull36.com\/app\/Folders.Counts",
    "url_domain": "https:\/\/{domain}\/app\/Folders.Counts",
    "method": "POST",
    "headers": {
        "Authorization": "Bearer YOUR TOKEN"
    },
    "body": [],
    "sample_output": {
        "success": 1,
        "count": 123
    },
    "notes": {
        "route": "Folders.Counts",
        "counts": "Map of folder_id => customer count"
    }
}

Count JavaScript

const token = 'YOUR TOKEN';
const body = new URLSearchParams();

const res = await fetch('https://{domain}/app/Folders.Counts', {
  method: 'POST',
  headers: { Authorization: `Bearer ${token}` },
  body
});
const data = await res.json();
console.log(data.count);

JavaScript Example

const token = 'YOUR TOKEN';
const res = await fetch('/app/Folders.Counts', {
  method: 'POST',
  headers: { Authorization: 'Bearer ' + token }
});
const data = await res.json();
console.log(data.counts, data.data);

Error Example

{
    "success": "0",
    "error": "bearer_token_required",
    "message": "Authorization bearer token is required. Send header: Authorization: Bearer YOUR TOKEN"
}