Skip to main content
MainWP Time Tracker 5.2.0 registers twelve abilities in the mainwp-time-tracker category. All use the mainwp/ namespace on your MainWP Dashboard. Use them to automate task, bucket, and timer workflows from scripts, AI agents, or the MainWP MCP Server. The Time Tracker Dashboard pages and REST API remain available.

What You’ll Learn

  • List and read tasks and buckets
  • Create, edit, and archive tasks and buckets
  • Start and pause a task timer
  • Complete a task and freeze its billing values
  • Handle revisions, previews, retries, and errors

Prerequisites

  • WordPress 6.9 or later on the MainWP Dashboard site
  • MainWP Dashboard with Abilities API support, active when Time Tracker loads; use version 6.2 or later for the input_json and DELETE examples below
  • Time Tracker 5.2.0 or later, active in MainWP Dashboard
  • An authenticated user permitted by the Dashboard Abilities API, with access to the Time Tracker Add-on
  • The Time Tracker permissions listed for each ability, and access to the related clients and sites
Use an Application Password or the authentication methods in the Abilities API overview. The examples use an Application Password.

Permissions

Each ability requires the Dashboard Abilities API permission and the Time Tracker permissions below. Application Password and session authentication require manage_options. A permitted MainWP REST API key with explicit Team Control site grants can use the scoped-key path without that broad capability. Every request also checks the user’s current access to the task’s client and to every site attached to the task. Bucket lists return rate_minor and currency as null unless the user also has View billing.

Available Abilities

WordPress selects DELETE for the replace, archive, and complete abilities because they are marked destructive and idempotent. Send their input as a JSON body, as described in DELETE requests. Discover the full input and output schemas:

Request Rules

Every input property is required and extra properties are rejected. Pass JSON null for an optional value you don’t want to set. task_ref, bucket_ref, client_ref, session_ref, and revisions are opaque 64-character lowercase hexadecimal values returned by the abilities. They stay valid when WordPress authentication salts rotate. Don’t substitute the numeric task, bucket, or client IDs shown in the Dashboard. site_ids uses positive MainWP site IDs. Each write requires a UUID request_ref. Reuse it only for an identical retry of the same action by the same user. Time Tracker rechecks your current permissions and scope before it returns the stored result of a retry. Use a new UUID for a different request. Revisions protect against overwriting newer changes. Pass the current revision as if_match or task_revision. If the record changed since you read it, Time Tracker returns generation_changed. Read it again and review the change.

Preview and confirm

The replace, archive, and complete abilities use a two-step flow: Send the execute request with the same request_ref and inputs used for the preview. The token is bound to your user account and to the previewed state, and expires after 10 minutes. If anything changed in between, Time Tracker returns preview_changed. Request a new preview. Setting both flags to true returns invalid_input. Setting both to false returns confirmation_required.

List and Read Tasks

List tasks

Ability: mainwp/list-time-tracker-tasks-v1
Method: GET
Each task contains task_ref, title, state, duration_seconds, site_count, and revision. Continue with next_after_task_ref when truncated is true. A task appears only when you can access its client and all of its sites.

Get a task

Ability: mainwp/get-time-tracker-task-v1
Method: GET
Input: task_ref
The response contains task_ref, title, description, client_ref, bucket_ref, site_ids, state, duration_seconds, active_session_ref, and revision. active_session_ref is set while the timer is running. Use it to pause the timer.

Create, Replace, and Archive Tasks

Create a task

Ability: mainwp/create-time-tracker-task-v1
Method: POST
The new task starts in the paused state. The response contains request_id, task_ref, state, and revision. A bucket that isn’t a general bucket requires a client that belongs to it. Otherwise, Time Tracker returns invalid_relationship.

Replace a task

Ability: mainwp/replace-time-tracker-task-v1
Method: DELETE
Send the complete new title, description, client_ref, bucket_ref, and site_ids, plus task_ref, if_match, and the preview and confirm fields. Only paused tasks can be replaced. Duration and billing values are preserved, and site time allocations are refreshed when the site list changes.
The response contains mode (dry_run or completed), request_id, task_ref, removed_site_count, revision, and preview_token. Review removed_site_count before confirming.

Archive a task

Ability: mainwp/archive-time-tracker-task-v1
Method: DELETE
Required inputs are task_ref, if_match, and the preview and confirm fields. The task must be paused or completed, with no running timer. The response contains mode, request_id, task_ref, archived, preserved_segment_count, and preview_token. Recorded time segments are kept.

List, Create, Replace, and Archive Buckets

List buckets

Ability: mainwp/list-time-tracker-buckets-v1
Method: GET
Inputs are client_ref (or null), limit (1-100), and after_bucket_ref (or null). Each bucket contains bucket_ref, title, general, client_count, active_task_count, rate_minor, currency, and revision. Continue with next_after_bucket_ref when truncated is true. rate_minor is the hourly rate in the currency’s minor unit. For example, 12500 in USD is $125.00 per hour.

Create a bucket

Ability: mainwp/create-time-tracker-bucket-v1
Method: POST
The response contains request_id, bucket_ref, client_count, and revision. New buckets use monthly recurrence and no hour limit. Change those settings on the Buckets page.

Replace a bucket

Ability: mainwp/replace-time-tracker-bucket-v1
Method: DELETE
Send bucket_ref, the complete title, description, general, client_refs, rate_minor, and currency fields, if_match, and the preview and confirm fields. Recurrence and hour-limit settings are kept. Time Tracker checks that tasks already assigned to the bucket still match its clients. The response contains mode, request_id, bucket_ref, affected_task_count, revision, and preview_token.

Archive a bucket

Ability: mainwp/archive-time-tracker-bucket-v1
Method: DELETE
Required inputs are bucket_ref, replacement_bucket_ref, if_match, and the preview and confirm fields. If the bucket has tasks, set replacement_bucket_ref to another bucket. Every task must be compatible with the replacement, either because it is a general bucket or because it includes the task’s client. Use null only when the bucket has no tasks. The response contains mode, request_id, bucket_ref, reassigned_task_count, archived, and preview_token.

Track Time

Start a timer

Ability: mainwp/start-time-tracker-timer-v1
Method: POST
Required inputs are task_ref, task_revision, and request_ref. The task must be paused with no running timer.
The response contains request_id, task_ref, session_ref, state (working), started_at, and the new revision.

Pause a timer

Ability: mainwp/pause-time-tracker-timer-v1
Method: POST
Required inputs are task_ref, session_ref from the start response or task read, the current task_revision, and request_ref. Only the user who started the timer can pause it through this ability. The response contains request_id, task_ref, session_ref, segment_ref, segment_seconds, the total duration_seconds, state (paused), and the new revision. Pause stops timing without completing the task. There is no separate stop ability. Only the current session can be paused; unusable start times or sessions longer than a year require reconciliation.

Complete a Task

Ability: mainwp/complete-time-tracker-task-v1
Method: DELETE
Required inputs are task_ref, task_revision, and the preview and confirm fields. The task must be paused. Completion freezes the billing values, including rate, currency, and rounding, in a billing snapshot that later setting changes don’t alter.
The response contains mode, request_id, task_ref, duration_seconds, billing_snapshot_ref, state (completed after execution), revision, and preview_token. Completion records a price but does not send an invoice or mark payment as received. Only one billing snapshot is allowed per task, even if the task is later reopened elsewhere.

Handle Errors and Retries

A timeout doesn’t prove that nothing changed. Read the task or bucket first, then retry with the same request_ref and request body.
  • A list request fails as a whole if one item has a drifted client or site relationship or an archived bucket.
  • Tasks with custom legacy states aren’t supported by these abilities.
  • A working task with a missing or future start time can’t be changed through the abilities.