POST

TeamHours.StartStop

Start or stop the logged-in user employee Time clock (header Start Work). Uses MySQL team_hours, same as dashboard Setting::team_hours_setting. status=1 means running, status=0 means stopped. Distinct from WorkingTime.StartStop which timers work against a customer (time_counter). Alias: TeamHours.Setting.

Permissions

  • User must be logged in with a valid bearer token.
  • The user must be from the same company domain as the request Host (call the API on that account subdomain or allowed custom domain). A token from another company returns success=0, error user_not_in_company.
  • Returned or changed records are limited by the user permissions, team access, folder access, and account settings.

Action

  • Updates the requested TeamHours record after validating permissions and input fields.

Push Service

Pushes team_hours.started or team_hours.stopped so open dashboards can refresh the clock.

Automation

Runs team_hours.started or team_hours.stopped after a successful write when automation is configured.

Special Instructions

  • Send the bearer token on protected calls with Authorization: Bearer YOUR TOKEN.
  • On a company subdomain (e.g. https://{user_domain}.bull36.com) the user must match that Host — Login and protected APIs reject another company with success=0, error user_not_in_company. On a main brand host (bull36.com, biz1.co.il, mastrocrm.com, …) the company domain gate is skipped.
  • Send parameters as POST body fields exactly as documented.
  • Send date/time values in UTC Y-m-d H:i:s format when a date or datetime field is used.

Required Parameters

No body parameters are required for this function.

Optional Parameters

NameTypeSampleWhat it gives
timer_action
post
stringstartstart or stop. Dashboard-compatible alias: val (1=start, 0=stop). One of timer_action or val is required.
val
post
int1Dashboard field: 1 starts the clock, 0 stops it.
team_hours_id
post
int55Active row id when stopping. Optional; if omitted, the running row for this user is used. Aliases: id, data_id.
project_id
post
int0Optional project linked when starting (dashboard team_hours_project_id).
note
post
stringEnd of dayOptional note stored when stopping (dashboard stop modal).

Authentication

Send the bearer token returned by Login in the request header. The user must be from the same company domain as this Host — a token from another company is rejected (user_not_in_company).

Authorization: Bearer YOUR TOKEN

Sample Request

{
    "url": "\/app\/TeamHours.StartStop",
    "method": "POST",
    "headers": {
        "Authorization": "Bearer YOUR TOKEN"
    },
    "body": {
        "timer_action": "start",
        "project_id": "0"
    },
    "url_user": "https:\/\/{user}.bull36.com\/app\/TeamHours.StartStop",
    "url_domain": "https:\/\/{domain}\/app\/TeamHours.StartStop"
}

Endpoint

POST /app/TeamHours.StartStop
POST https://{user}.bull36.com/app/TeamHours.StartStop
POST https://{domain}/app/TeamHours.StartStop

Sample Output

{
    "success": 1,
    "message": "Time counter updated.",
    "type": "start",
    "id": 55,
    "team_hours_id": 55,
    "data": {
        "id": 55,
        "status": 1,
        "running": true,
        "elapsed": "00:00:00"
    },
    "socket_event": "team_hours.started"
}

JavaScript Example

const token = 'YOUR TOKEN';
const body = new URLSearchParams();
body.set('timer_action', 'start');
const res = await fetch('/app/TeamHours.StartStop', { method: 'POST', headers: { Authorization: 'Bearer ' + token }, body });
console.log(await res.json());

Error Example

{
    "success": 0,
    "message": "Timer is already start"
}