# WorkZone for developers

> https://wozone.io/developers - English - WorkZone

Read and add work in WorkZone from your own website, CRM, automation or AI assistant. A small JSON API over HTTPS, signed webhooks for the moment something happens, and an MCP server for AI tools.

## Quick start

1. In WorkZone open System manager → API & webhooks → New key. Name it, choose Read only or Read and write, and copy the key - it is shown once.

2. Call the API with the key. The first call to try is /me: it shows the workspace, the key's scopes and who the key acts as.

```
curl https://mashhor-hub.com/api/agency/v1/me \
  -H "Authorization: Bearer wz_YOUR_KEY"
```

## Authentication

Send the key as "Authorization: Bearer wz_..." or in an "X-WorkZone-Key" header. The key looks like wz_<16 hex>_<secret>. Only a hash of it is stored, so WorkZone cannot show it again - make a new key if it is lost.

A key acts as the person who made it, inside the workspace it was made in. Every call follows the same permission rules as the app, with that person's current level: a key can never do more than its maker can do today, and it stops working when they lose access or sign out everywhere. Scopes narrow it further: read (GET only) or write (also create and change tasks and receive work).

The API is part of the Professional and Enterprise plans. A paused workspace answers 403, and a workspace whose free trial has ended can read but not write (402).

Keep keys on your server, never in a web page or a mobile app.

## Conventions

Base address: https://mashhor-hub.com/api/agency/v1. Answers are { "data": ..., "meta": ... } and errors are { "error": { "code", "message" } }. Dates are ISO 8601 (a due date is YYYY-MM-DD). Answers are never cached.

Rate limit: 120 calls a minute per key. Past it you get 429 and a Retry-After header (seconds).

Lists are paged: send limit (1-200, default 50) and page; the meta says total and pages.

## Idempotency

Send an Idempotency-Key header (1-120 visible characters) with every POST and PATCH. If your call is retried with the same key within 24 hours, you get the first answer again (with "Idempotent-Replayed: true") and the work is created once. A call still being handled answers 409 in_progress.

## Endpoints

Base address: `https://mashhor-hub.com/api/agency/v1`

### GET `/me`

**Who the key is.** The workspace, the key's name and scopes, the person it acts as, and the webhook events that exist.

#### Example

```
curl https://mashhor-hub.com/api/agency/v1/me \
  -H "Authorization: Bearer wz_YOUR_KEY"
```

#### Answer

```
{
  "data": {
    "workspace": { "id": "acme", "name": "Acme" },
    "key": { "id": "3f9a0c1d2e4b5a67", "name": "Website", "scopes": ["read", "write"] },
    "actingAs": { "uid": "u_ali", "name": "Ali", "level": "admin" },
    "events": ["task.created", "task.updated", "..."]
  }
}
```

### GET `/projects`

**List projects.** The projects this key may see, by name. Archived ones only when you ask for them.

| Name | In | Type | Needed | Description |
| --- | --- | --- | --- | --- |
| `status` | query | `string` |  | Only projects with this status (for example archived). |

#### Example

```
curl https://mashhor-hub.com/api/agency/v1/projects \
  -H "Authorization: Bearer wz_YOUR_KEY"
```

#### Answer

```
{
  "data": [
    { "id": "p_4821", "name": "Oud Store", "client": "Oud Store", "type": null, "status": "active",
      "startDate": null, "endDate": null, "managerUid": "u_mona", "createdAt": "...", "updatedAt": "..." }
  ],
  "meta": { "count": 1 }
}
```

### GET `/people`

**List people.** Everyone with access to the workspace. Use the uid to assign tasks.

#### Example

```
curl https://mashhor-hub.com/api/agency/v1/people \
  -H "Authorization: Bearer wz_YOUR_KEY"
```

#### Answer

```
{
  "data": [ { "uid": "u_mona", "name": "Mona", "title": "Account manager", "department": "Clients", "level": "manager" } ],
  "meta": { "count": 1 }
}
```

### GET `/tasks`

**List tasks.** Tasks in the projects the key may see, the most recently changed first.

| Name | In | Type | Needed | Description |
| --- | --- | --- | --- | --- |
| `projectId` | query | `string` |  | Only this project. |
| `status` | query | `string` |  | One or more status keys, comma separated (todo,in_progress). |
| `assignee` | query | `string` |  | Only tasks assigned to this uid. |
| `updatedSince` | query | `ISO date` |  | Only tasks changed since then - the way to sync. |
| `archived` | query | `true` |  | Send true to include archived tasks. |
| `limit` | query | `integer` |  | 1-200, default 50. |
| `page` | query | `integer` |  | Page number, from 1. |

#### Example

```
curl https://mashhor-hub.com/api/agency/v1/tasks \
  -H "Authorization: Bearer wz_YOUR_KEY"
```

#### Answer

```
{
  "data": [ { "id": "8xKf2LmQ", "title": "Shoot the Eid story", "status": "todo", "...": "..." } ],
  "meta": { "total": 1, "page": 1, "limit": 50, "pages": 1 }
}
```

### GET `/tasks/:id`

**Get a task.** One task with its description, estimate, checklist and requester. A task the key may not see answers 404.

| Name | In | Type | Needed | Description |
| --- | --- | --- | --- | --- |
| `id` | path | `string` | yes | The task id. |

#### Example

```
curl https://mashhor-hub.com/api/agency/v1/tasks/TASK_ID \
  -H "Authorization: Bearer wz_YOUR_KEY"
```

#### Answer

```
{
  "data": {
    "id": "8xKf2LmQ",
    "projectId": "p_4821",
    "title": "Shoot the Eid story",
    "status": "todo",
    "priority": "high",
    "dueDate": "2026-12-01",
    "startDate": null,
    "assignees": ["u_mona"],
    "labels": ["eid", "api"],
    "archived": false,
    "createdAt": "2026-11-07T09:12:44.000Z",
    "updatedAt": "2026-11-07T09:12:44.000Z",
    "completedAt": null,
    "source": "api",
    "url": "https://mashhor-hub.com/workzone/agency/projects/p_4821?task=8xKf2LmQ",
    "description": "",
    "estimateHours": 0,
    "checklist": [],
    "requester": null
  }
}
```

### GET `/events`

**Webhook events.** The names of the events a webhook may listen to.

#### Example

```
curl https://mashhor-hub.com/api/agency/v1/events \
  -H "Authorization: Bearer wz_YOUR_KEY"
```

#### Answer

```
{ "data": ["task.created", "task.updated", "task.status_changed", "..."] }
```

### POST `/tasks`

**Create a task.** Creates a task in a project, as the key's person. The label "api" is added automatically. Answers 201 with the task.

| Name | In | Type | Needed | Description |
| --- | --- | --- | --- | --- |
| `projectId` | body | `string` | yes | The project id. |
| `title` | body | `string` | yes | Task title, at least 2 characters. |
| `description` | body | `string` |  | Longer text. |
| `status` | body | `string` |  | A status key of the board. |
| `priority` | body | `string` |  | low, normal, high or urgent. |
| `dueDate` | body | `YYYY-MM-DD` |  | Due date. |
| `startDate` | body | `YYYY-MM-DD` |  | Start date. |
| `estimateHours` | body | `number` |  | Estimated hours. |
| `labels` | body | `string[]` |  | Labels. |
| `assignees` | body | `string[]` |  | People uids. |
| `checklist` | body | `{ text, done }[]` |  | Checklist items. |

#### Example

```
curl -X POST https://mashhor-hub.com/api/agency/v1/tasks \
  -H "Authorization: Bearer wz_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{ "projectId": "p_4821", "title": "Shoot the Eid story", "priority": "high", "dueDate": "2026-12-01", "labels": ["eid"], "assignees": ["u_mona"] }'
```

#### Answer

```
{
  "data": {
    "id": "8xKf2LmQ",
    "projectId": "p_4821",
    "title": "Shoot the Eid story",
    "status": "todo",
    "priority": "high",
    "dueDate": "2026-12-01",
    "startDate": null,
    "assignees": ["u_mona"],
    "labels": ["eid", "api"],
    "archived": false,
    "createdAt": "2026-11-07T09:12:44.000Z",
    "updatedAt": "2026-11-07T09:12:44.000Z",
    "completedAt": null,
    "source": "api",
    "url": "https://mashhor-hub.com/workzone/agency/projects/p_4821?task=8xKf2LmQ",
    "description": "",
    "estimateHours": 0,
    "checklist": [],
    "requester": null
  }
}
```

### PATCH `/tasks/:id`

**Change a task.** Changes only the fields you send (at least one). The same fields as when creating, without projectId.

| Name | In | Type | Needed | Description |
| --- | --- | --- | --- | --- |
| `id` | path | `string` | yes | The task id. |
| `title, description, status, priority, dueDate, startDate, estimateHours, labels, assignees, checklist` | body | `as above` |  | Whatever changes. |

#### Example

```
curl -X PATCH https://mashhor-hub.com/api/agency/v1/tasks/TASK_ID \
  -H "Authorization: Bearer wz_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{ "status": "in_progress", "assignees": ["u_mona", "u_sara"] }'
```

#### Answer

```
{
  "data": {
    "id": "8xKf2LmQ",
    "projectId": "p_4821",
    "title": "Shoot the Eid story",
    "status": "todo",
    "priority": "high",
    "dueDate": "2026-12-01",
    "startDate": null,
    "assignees": ["u_mona"],
    "labels": ["eid", "api"],
    "archived": false,
    "createdAt": "2026-11-07T09:12:44.000Z",
    "updatedAt": "2026-11-07T09:12:44.000Z",
    "completedAt": null,
    "source": "api",
    "url": "https://mashhor-hub.com/workzone/agency/projects/p_4821?task=8xKf2LmQ",
    "description": "",
    "estimateHours": 0,
    "checklist": [],
    "requester": null
  }
}
```

### POST `/intake`

**Receive work (TRM).** Logs work that arrived from outside - a form on your website, a message, a call - into TRM, where the workspace's automation gives it out by hours and skills. The same work sent twice within ten minutes becomes one task (200 with "duplicate": true); a new one answers 201.

| Name | In | Type | Needed | Description |
| --- | --- | --- | --- | --- |
| `projectId` | body | `string` | yes | The project the work belongs to. |
| `title` | body | `string` | yes | What was asked. |
| `details` | body | `string` |  | The message or notes. |
| `priority` | body | `string` |  | low, normal, high or urgent (default normal). |
| `dueDate` | body | `YYYY-MM-DD` |  | Due date. |
| `requester` | body | `{ name, email, phone, lang }` |  | Who asked (lang: ar or en). |
| `assignees` | body | `string[]` |  | Leave empty to let TRM give it out. |

#### Example

```
curl -X POST https://mashhor-hub.com/api/agency/v1/intake \
  -H "Authorization: Bearer wz_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{ "projectId": "p_4821", "title": "Logo on the invoice", "details": "Sara asked on WhatsApp", "requester": { "name": "Sara", "phone": "+965 5000 0000", "lang": "ar" } }'
```

#### Answer

```
{ "data": { "duplicate": false, "id": "9aQ1xZ", "projectId": "p_4821", "assignedTo": "u_omar" } }
```

## Errors

| Status | code | Meaning |
| --- | --- | --- |
| `400` | `invalid` | A field is missing or wrong (the message says which). |
| `401` | `api_key` | No key, a malformed key, a wrong or revoked key, or its maker signed out everywhere. |
| `402` | `trial_ended` | The free trial ended: reading still works, writing does not. |
| `403` | `scope / plan / switched_off / workspace_paused / maker_no_access / maker_view_only` | The key may only read; or the API is not in the plan or is switched off; or the workspace is paused; or the key's maker lost access or is view-only. |
| `404` | `not_found` | No such task, or one this key may not see. |
| `409` | `in_progress / conflict` | A call with this Idempotency-Key is still being handled, or the work conflicts with one already received. |
| `429` | `rate_limited` | More than 120 calls in a minute. Wait for Retry-After seconds. |
| `500` | `error` | Something went wrong on our side. Retry with the same Idempotency-Key. |

```
{ "error": { "code": "scope", "message": "This key may only read. Make a key with the write scope." } }
```

## Webhooks

A webhook tells your system the moment something happens. In System manager → API & webhooks → New webhook, give an https address and choose the events. Copy the signing secret (whsec_...) - it is shown once; "Rotate" makes a new one.

The address must be https (port 443 or 8443), with no user name or password, and must not point at a private network. WorkZone checks it again on every delivery and never follows redirects. Your server must answer within 10 seconds with any 2xx status.

Every message is a POST with a JSON body { id, event, createdAt, workspace, data } and the headers X-WorkZone-Event, X-WorkZone-Delivery, X-WorkZone-Timestamp (unix seconds) and X-WorkZone-Signature: v1=<hex HMAC-SHA256 of timestamp + "." + body, with your secret>. Verify it on the RAW body before you trust the message.

A failed delivery is tried again after 1 minute, 5 minutes, 30 minutes, 2 hours and 6 hours (six tries in all). After 10 deliveries in a row fail for good, the webhook switches itself off and says why. The Log shows every message with its answer; "Test" sends a ping and "Send again" retries one. Use X-WorkZone-Delivery to ignore a message you already handled.

### Events

`task.created``task.updated``task.status_changed``task.completed``task.deleted``task.approved``task.changes_requested``intake.received``request.created``request.updated``content.client_answered`

### A message

```
{
  "id": "d_7Qm2",
  "event": "task.status_changed",
  "createdAt": "2026-11-07T09:30:00.000Z",
  "workspace": "acme",
  "data": {
    "id": "8xKf2LmQ", "projectId": "p_4821", "title": "Shoot the Eid story",
    "status": "done", "changed": ["status"], "by": { "uid": "u_mona", "name": "Mona" }
  }
}
```

### Verify the signature - Node.js

```
const crypto = require('crypto');

// raw = the request body EXACTLY as received (do not parse and re-serialise it)
function verify(secret, headers, raw, toleranceSeconds = 300) {
  const ts = headers['x-workzone-timestamp'];
  const sig = headers['x-workzone-signature'];            // "v1=<hex>"
  if (!ts || !sig) return false;
  if (Math.abs(Date.now() / 1000 - Number(ts)) > toleranceSeconds) return false;   // too old: a replay
  const expected = 'v1=' + crypto.createHmac('sha256', secret).update(ts + '.' + raw).digest('hex');
  const a = Buffer.from(sig), b = Buffer.from(expected);
  return a.length === b.length && crypto.timingSafeEqual(a, b);
}
```

### Verify the signature - Python

```
import hmac, hashlib, time

def verify(secret: str, headers: dict, raw: bytes, tolerance=300) -> bool:
    ts = headers.get("X-WorkZone-Timestamp")
    sig = headers.get("X-WorkZone-Signature", "")        # "v1=<hex>"
    if not ts or abs(time.time() - int(ts)) > tolerance:
        return False
    expected = "v1=" + hmac.new(secret.encode(), ts.encode() + b"." + raw, hashlib.sha256).hexdigest()
    return hmac.compare_digest(sig, expected)
```

## MCP

WorkZone runs its own MCP server, so Claude, ChatGPT, Cursor and other AI apps can work with your projects and tasks. Connect once with your WorkZone account - no key to copy - and ask in plain words. The app sees only what YOU can see, it can only read until your company allows changes, and you can disconnect it any time.

[Set up the WorkZone MCP server](https://wozone.io/developers/mcp)
