This is the full developer documentation for OpexAIO # OpexAIO developer docs > Connect your apps and AI assistants to OpexAIO with the v1 REST API and the MCP server. OpexAIO runs Timesheets, Helpdesk, Project, CRM, Expenses and Leave on one workspace. These docs show how to read and change that data from your own software: an internal tool, a monitoring system, a website form, a spreadsheet script, or an AI assistant. ## Two ways in | | REST API (v1) | MCP server | | --------- | ------------------------------------------- | ---------------------------------------------- | | For | Your code: scripts, back ends, integrations | AI assistants: ChatGPT, Claude, Cursor | | Address | `https://app.aio.opexcg.com/api/...` | `https://app.aio.opexcg.com/api/mcp` | | Sign-in | Personal API key in `X-API-Key` | OAuth (ChatGPT, Claude.ai) or the same API key | | Plan | Enterprise on at least one product | Enterprise on at least one product | | Reference | [API reference](/docs/reference/) | [Tool reference](/docs/mcp/tools/) | Both act as you: they see and change what your account may see and change in the app, nothing more. ## Start here 1. [Quickstart](/docs/quickstart/): create an API key and make your first call in five minutes. 2. [Authentication and permissions](/docs/authentication/): keys, workspaces, roles, products and plans. 3. [Conventions](/docs/conventions/): errors, paging, dates, money and retries. 4. [Product guides](/docs/guides/helpdesk/): recipes for common integrations, one page per product. 5. [MCP for AI assistants](/docs/mcp/): connect an assistant in one command. ## What v1 means The [API reference](/docs/reference/) lists the **v1 API**: the endpoints we support for integrations and keep backwards compatible. The web and mobile apps call many more endpoints; those follow the screens and can change at any time, so build only on v1. The [changelog](/docs/changelog/) records every change to v1. ## For AI tools * [`/llms.txt`](/llms.txt) indexes these docs, and [`/llms-full.txt`](/llms-full.txt) has all of them in one file. * Every page is also plain Markdown: add `.md` to its address, for example [`/docs/quickstart.md`](/docs/quickstart.md). * [`/openapi.json`](/openapi.json) is the whole API reference as an OpenAPI 3.1 document. # Authentication and permissions > API keys, OAuth for MCP connectors, workspaces, roles and permission codes, product entitlements and plans. Every call to the API needs a personal API key. A key acts as the person who created it, so the API allows exactly what that person may do in the app. The REST API and the MCP server need an **Enterprise plan** on at least one product of the workspace. See [Plans](#plans). ## API keys * **Header.** Send the key in `X-API-Key` on every request. MCP connectors such as ChatGPT and Claude.ai sign in with [OAuth](#oauth-for-mcp-connectors) instead. * **Format.** `pk_live_` followed by 64 hexadecimal characters. * **Create and revoke** keys in the app: sidebar **MCP**, then **Create API key**. The same page lists your keys with their last use and revokes them. Revoking takes effect on the next request. Creating a key needs an Enterprise plan; listing and revoking work on every plan. * **Stored hashed.** The server keeps only a SHA-256 hash, so a lost key cannot be shown again: create a new one. * **No expiry.** Keys stay valid until you revoke them, your account is deactivated, or you lose access to the workspace. A request without a valid key answers `401` with `{"error":"unauthorized"}`. ### Use a service account for integrations Because a key acts as its creator, an integration stops working when that person leaves. For long-running integrations, invite a dedicated member (for example `integrations@yourcompany.com`), give it only the roles it needs, and create the key while signed in as that member. ## OAuth for MCP connectors ChatGPT, Claude.ai and other MCP clients that follow the [MCP authorization spec](https://modelcontextprotocol.io/specification/latest/basic/authorization) sign in with OAuth 2.1 instead of an API key. You never configure these endpoints by hand: the client discovers them from the `401` answer of `/api/mcp`. They are listed here for client developers and security reviews. | What | Address | | ---------------------------------------- | ---------------------------------------------------------------------------- | | Protected resource metadata (RFC 9728) | `https://app.aio.opexcg.com/.well-known/oauth-protected-resource/api/mcp` | | Authorization server metadata (RFC 8414) | `https://app.aio.opexcg.com/.well-known/oauth-authorization-server/api/auth` | | Issuer | `https://app.aio.opexcg.com/api/auth` | | Dynamic Client Registration (RFC 7591) | `POST /api/auth/oauth2/register` | | Authorization | `GET /api/auth/oauth2/authorize` | | Token | `POST /api/auth/oauth2/token` | | Revocation (RFC 7009) | `POST /api/auth/oauth2/revoke` | * **Flow.** Authorization code with PKCE (`S256`, required). Clients that register themselves are public clients (`token_endpoint_auth_method: none`); redirect URIs must match the registered ones exactly. The authorization response carries `iss` (RFC 9207). * **Resource.** `resource` (RFC 8707), when sent, must be `https://app.aio.opexcg.com/api/mcp` or `https://app.aio.opexcg.com`; anything else answers `invalid_target`. * **Scopes.** `workspace`: act as you in one workspace. Add `offline_access` to get a refresh token. * **Consent.** You sign in to OpexAIO, pick one workspace and approve. Every token of that approval works only in that workspace, with your roles and permissions there, like an API key created in it. Only workspaces with an Enterprise plan can be picked. * **Tokens.** Opaque access tokens valid for 1 hour, sent as `Authorization: Bearer `. Refresh tokens last 30 days and rotate on every use; reusing an old one cancels the whole chain. Authorization codes are single use and expire after 5 minutes. OpexAIO stores only hashes of tokens. * **Where tokens work.** On `/api/mcp` and on every v1 REST endpoint, under the same [plan rules](#plans) as API keys. * **Errors.** A missing, expired or revoked token answers `401` with `WWW-Authenticate: Bearer resource_metadata="…", error="invalid_token"`. The token and registration endpoints are rate limited per IP (`429 too_many_requests`). * **Revoke.** Disconnect the app in the app under sidebar **MCP**, tab **Connected apps**, or have the client call the revocation endpoint. ## Workspaces A key belongs to the workspace you were in when you created it, and every call works in that workspace. The `X-Tenant-Id` header and `tenantId` query parameter the web app uses to switch workspaces are **ignored for API keys**. To reach another workspace, switch to it in the app and create a key there. `GET /api/me` returns the workspace of the key as `tenantId` and `tenantName`. ## Roles and permission codes What you may do depends on your roles in the workspace (for example `admin`, `consultant_lead`, `consultant`, `client_admin`, `client_requester`). Roles grant **permission codes** such as `crm:record:read`, `timesheets:entry:create` or `pmo:task:update`. Workspace admins can change which role holds which code under Roles and Permissions in the app. * `GET /api/me` lists the codes you hold in `permissions`. * Each endpoint in the [API reference](/docs/reference/) names the codes it needs. “Any of” means one of them is enough, for example your own entries with `timesheets:entry:update_own` or anyone’s with `timesheets:entry:update_others`. * A missing permission answers `403` with `{"error":"forbidden"}`, usually with the code that was missing: `{"error":"forbidden","permission":"crm:company:create"}`. Some rules depend on the record, not only the code: client users see only their own company’s tickets and projects, consultants see only the projects they are assigned to unless they ask for `scope=all`, and edits of finalised time entries are locked. Those cases also answer `403` or `409`; the reference describes them per endpoint. A consultant who works in a customer’s workspace through a consultant grant never holds that customer’s CRM codes (`crm:record:*`): a customer’s sales data stays private to the customer’s own members. ## Products A workspace subscribes to products: `timesheets`, `helpdesk`, `pmo` (Project), `crm`, `expenses` and `leave`. `GET /api/me` lists the ones you can use in `entitlements`. | Situation | Answer | | -------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- | | The workspace does not have the product, or your admin limited your access to it | `402` `{"error":"product_not_entitled","product":"crm"}` | | The product’s trial ended | Reads still work; writes answer `402` `{"error":"product_read_only","product":"crm"}` | Products whose trial ended are listed in `readOnlyProducts`. ## Plans Each product has a plan: `free`, `pro` or `enterprise`. Programmatic access is an Enterprise feature, and a few features need a plan on a specific product: | Feature | Needs | | --------------------------------------------------------------------------------------------- | ---------------------------------------------------------- | | REST API with an API key (every `/api/...` call) | `enterprise` on at least one product of the workspace | | [MCP server](/docs/mcp/) (`/api/mcp`) | `enterprise` on at least one product that offers MCP tools | | [Receipt capture](/docs/reference/expenses/#capture-a-receipt) (`POST /api/expenses/capture`) | Expenses `pro` | A missing plan answers `402` with `tier_required`. Below Enterprise, every REST call with an API key answers `{"error":"tier_required","product":"pmo","feature":"api","required":"enterprise"}` (`product` names the first product the workspace has), and `/api/mcp` answers the same with `"feature":"mcp"`. A product whose trial ended still counts: its Enterprise plan keeps reads working. The Enterprise plan of any one product unlocks the API for the whole workspace. It does not lift the other rows: receipt capture still needs Expenses `pro`. # Changelog > Every change to the v1 API, newest first. The v1 API only grows in compatible ways: new endpoints, new optional request fields, new response fields and new error codes. Anything that would break a working integration gets a new version instead, announced here first. Build your integration to tolerate additions: ignore response fields you do not know, and handle unknown error codes by their HTTP status. ## 2026-11-13: Helpdesk list scoping and project filters * `GET /api/helpdesk/tickets?mine=1` now returns only tickets you created or that list you under the requester’s collaborators. Follows added by staff (assignment followers) no longer appear in “My tickets”; they keep working as before everywhere else. * `GET /api/projects` (projects list in Companies and Projects) accepts four new optional filters: `productId` (only projects delivering this product), `support` (`has`/`none`), `expiry` (`expired`/`expiring30`/`expiring90`) and sorts by `support_expiry` in addition to the existing keys. * `GET /api/helpdesk/consultants` accepts an optional `productId` to narrow the list to consultants whose product specialties cover it. ## 2026-11-07: OAuth 2.1 for the MCP server * ChatGPT and Claude.ai connect to the MCP server with OAuth 2.1: discovery (RFC 9728, RFC 8414), Dynamic Client Registration, PKCE, rotating refresh tokens and revocation. See [Connect ChatGPT](/docs/mcp/#connect-chatgpt), [Connect Claude.ai](/docs/mcp/#connect-claudeai) and [OAuth](/docs/authentication/#oauth-for-mcp-connectors). * `/api/mcp` without a credential now answers `401` with `WWW-Authenticate: Bearer resource_metadata="…"`. * OAuth access tokens (`Authorization: Bearer`) also work on the v1 REST endpoints, bound to the workspace chosen at consent and under the same Enterprise plan rule as API keys. * API keys keep working unchanged. ## 2026-11-07: API keys need an Enterprise plan * The REST API over an API key now needs an Enterprise plan on at least one product of the workspace, the same rule the MCP server already had. Below it, every call answers `402` `{"error":"tier_required","product":"","feature":"api","required":"enterprise"}`. Signing in to the app is not affected. * Creating an API key needs the same plan. Existing keys stay listed in the app so you can revoke them. ## 2026-11-07: v1 First public release of the API documentation. * 55 endpoints across Account, Helpdesk, Timesheets, Project, CRM, Expenses, Leave and Approvals, listed in the [API reference](/docs/reference/) and in [`/openapi.json`](/openapi.json). * The MCP server at `/api/mcp`, with the [tool reference](/docs/mcp/tools/). * `GET /api/me` now returns `email` for API key callers too (it was empty). # Conventions > Errors, paging and lists, dates and money, retries and conflicts, limits. ## Requests * Send JSON with `content-type: application/json`. A body that is not valid JSON answers `400` `{"error":"invalid_json"}`. * Field names are as the reference shows them: request bodies mostly use `camelCase` (`projectId`), and response rows use the stored `snake_case` names (`project_id`). Leave requests use `snake_case` in both directions. * Unknown fields in a request body are ignored, except on leave requests, which answer `400` for them. Identity and state fields (ids, tenant, status, creator) are always set by the server, never taken from the request. ## Errors An error answers a `4xx` or `5xx` status with a JSON body carrying a machine-readable code: ```json { "error": "forbidden", "permission": "crm:company:create" } ``` Match on `error`, never on a message. Extra fields carry details for the code, such as `product`, `permission`, `reason` or `retry_after`. The [error codes](/docs/errors/) page lists every code with its meaning. A request that fails **validation** answers `400` with a different body, which names each problem: ```json { "success": false, "error": { "name": "ZodError", "message": "[{\"code\":\"invalid_format\",\"format\":\"email\",\"path\":[\"email\"],\"message\":\"Invalid email address\"}]" } } ``` `error.message` is a JSON array; parse it to show which field was wrong (`path`). | Status | Meaning | What to do | | ------ | ------------------------------------------------------------------ | ---------------------------------------------------------------------------------------- | | `400` | Invalid input | Fix the request; do not retry as is. | | `401` | `unauthorized`: missing, wrong or revoked key | Check the `X-API-Key` header. | | `402` | `product_not_entitled`, `product_read_only` or `tier_required` | The workspace lacks the product or plan. See [Products](/docs/authentication/#products). | | `403` | `forbidden` (often with `permission`), or a rule about this record | Your roles do not allow it. | | `404` | `not_found` and specific codes such as `project_not_found` | The record does not exist in this workspace, or you cannot see it. | | `409` | A conflict, for example `approval_conflict` or `entry_finalized` | Re-read the record, then decide whether to try again. | | `413` | `too_large`, `quota_exceeded` | The file is too big, or the workspace is out of storage. | | `429` | `too_many_requests` with `retry_after` (seconds) | Wait that long, then retry. | | `5xx` | `internal_error` | Retry with backoff. | The Project task endpoints are RPC procedures and wrap errors in their own envelope: `{"json":{"code":"NOT_FOUND","status":404,"message":"not_found"}}`. The HTTP status is the same; read the code from `json.message`. ## Lists and paging Most list endpoints take the same query parameters and answer the same shape: | Parameter | Meaning | | ---------- | ------------------------------------------------------------------------------------------ | | `page` | 1-based page number. Default `1`. | | `pageSize` | Rows per page, `1` to `100`. Larger values are clamped to 100, not rejected. Default `20`. | | `search` | Free-text filter. Only the first 200 characters count. | | `sort` | A sort key the endpoint names in the reference. Unknown keys fall back to its default. | | `dir` | `asc` or `desc` (default). | ```json { "items": [ ... ], "total": 87, "page": 2, "pageSize": 20 } ``` To read everything, request pages of 100 until `page * pageSize >= total`. Junk paging values never fail: `page=abc` is read as page 1. A few lists differ, and their reference pages say so: * **Time entries** (`GET /api/timesheets`) page with `limit` (up to 500, default 50) and `offset`, and answer `{ "entries": [...], "total", "limit", "offset" }`. * **Notifications** return the 50 newest, with no paging. * **The approval inbox** takes `limit` (up to 100, default 50). * **Timesheets projects, leave types, leave peers and expense categories** return the whole list. ## Dates and times * **Timestamps are epoch milliseconds (UTC)**, for example `"created_at": 1794050942065`. This covers `created_at`, `started_at`, `issued_at`, `expectedCloseAt` and every other time field, in requests and responses. * **Calendar days are `YYYY-MM-DD` strings** where a day is meant rather than a moment: leave requests (`start_date`, `end_date`) and the `dateFrom` and `dateTo` filters of time entries and expenses. Leave requests come back with those days as epoch milliseconds at UTC midnight. * Durations are whole minutes (`durationMinutes`, `duration_minutes`). ## Money Amounts are **integers in minor units** (hundredths) of their currency, with the currency as an ISO 4217 code next to them: `"total_cents": 8500000, "currency": "IDR"` is Rp 85.000, and `"amount_cents": 125050, "currency": "USD"` is $1,250.50. This applies to every currency, including IDR. Never send decimals. ## Retries and conflicts There are no idempotency keys. Make writes safe to repeat this way: * **Contacts are unique by email.** Posting an email that already exists answers `200` with the existing contact instead of creating a second one, so a retried contact sync is harmless. * **Look before you write** for other records: search for what you are about to create (for example a ticket with the same title from your monitoring alert) before creating it. * **Approvals are protected against double decisions.** Two people deciding the same task, or the same call sent twice, cannot both win: the second answers `409` `{"error":"approval_conflict"}`. Re-read the [inbox](/docs/reference/approvals/) and move on. * **Finalised records are locked.** Approved or invoiced time entries and submitted expenses answer `409` (`entry_finalized`, `locked`, `invalid_transition`) instead of changing. ## Limits * The v1 endpoints have no per-key rate limit today. Keep to a few requests per second per key and back off on `429` and `5xx` anyway: sign-in and AI endpoints already rate-limit, and limits may be added to others. * Uploads (receipt capture) accept files up to 25 MB and count toward the workspace’s storage. * Text filters (`search`) use the first 200 characters. # Error codes > Every error code the OpexAIO API answers with, and what it means. Errors come back as JSON with a machine-readable code: `{ "error": "" }`, sometimes with details such as `product`, `permission` or `reason`. Match on the code, never on a message. The meanings below are the texts the app shows people; `{{name}}` stands for a detail field of the response. Unknown codes can appear as the API grows. Treat them by their HTTP status: 400 invalid input, 401 missing or bad key, 402 product or plan missing, 403 not allowed, 404 not found, 409 conflict, 429 slow down, 5xx retry later. | Code | Meaning | | ----------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- | | `account_deactivated` | This account has been deactivated. | | `action_not_pending` | That action was already handled. | | `address_already_routed` | That support email address is already connected to another channel. | | `address_not_staff` | That email address doesn’t belong to a staff member of this workspace. | | `admin_validation_required` | An admin needs to validate this first. | | `agent_name_required` | The agent name is required when the time is logged by an agent. | | `ai_credits_exhausted` | Your workspace has used all its AI credits for now. An admin can add more on the Billing page. | | `ai_quota_exceeded` | The AI assistant’s usage limit has been reached. Try again later. | | `ai_topup_needs_plan` | AI credit packs are sold on a paid plan. Subscribe first, then buy more credits. | | `ai_unavailable` | The AI assistant isn’t available right now. Try again later. | | `already_approved` | That was already approved. | | `already_assigned` | That is already assigned. | | `already_decided` | Someone already decided on this. | | `already_entitled` | That workspace already has this product. | | `already_exists` | That already exists. | | `already_first` | That’s already first in the list. | | `already_has_workspace` | You already belong to a workspace. | | `already_home` | That workspace is already this person’s home workspace. | | `already_in_renewal` | These lines are already in an open renewal deal. | | `already_last` | That’s already last in the list. | | `already_member` | That person is already a member of this workspace. | | `already_owner` | That person already owns this workspace. | | `already_processed` | This invitation was already used or revoked. | | `already_rejected` | This has already been rejected. | | `already_renewed` | These lines are already renewed on a later contract. | | `already_subscribed` | This workspace already has an active subscription. | | `approval_already_pending` | This record is already waiting for approval. | | `approval_conflict` | This approval changed while you were looking at it. Reload and try again. | | `approval_definition_invalid` | The approval workflow has invalid settings. | | `approval_definition_name_taken` | An approval workflow with this name already exists. | | `approval_incomplete` | This expense still has approval steps to finish before it can be paid. | | `approval_invalid_assignee` | That person can’t take over this approval. | | `approval_no_approvers` | Nobody can approve this request yet. Ask your admin to check the approval workflow. | | `approval_not_assignee` | This approval is assigned to someone else. | | `approval_unavailable` | Approvals aren’t available for this record yet. | | `approval_unknown_roles` | Some selected roles don’t exist in this workspace. | | `approval_unknown_users` | Some selected people aren’t active members of this workspace. | | `approver_not_found` | The selected approver was not found in this workspace. | | `assignee_not_found` | That assignee couldn’t be found. | | `assignment_not_found` | That team member assignment couldn’t be found. | | `auto_join_admin_not_allowed` | Automatic joining can’t give the Admin role. Use request-to-join for admins. | | `backdated_not_allowed` | This leave type does not allow emergency or retroactive requests. | | `balance_already_exists` | A leave balance record already exists for this employee and year. | | `balance_expired` | The leave balance for this period has expired. | | `budget_mutually_exclusive` | A project can have either an hours budget or an amount budget, not both. | | `budget_type_locked` | Budget type cannot be changed once time or expenses have been logged. | | `builtin_role_required` | Built-in roles can’t be deactivated. | | `calendar_cycle_starts_jan_1` | Standard calendar cycle must start on January 1st. | | `cancel_not_allowed` | This can’t be cancelled now. | | `cannot_be_own_parent` | A category can’t be its own parent. | | `cannot_change_own_company` | You can’t change your own company. | | `cannot_change_own_membership` | You can’t deactivate your own membership. | | `cannot_change_own_password` | You can’t set your own password here. | | `cannot_change_own_role` | You can’t change your own role. | | `cannot_change_own_status` | You can’t change your own status. | | `cannot_deactivate_initial` | This is the starting status, so it can’t be deactivated or deleted. Pick another starting status first. | | `cannot_deactivate_last_admin` | This is the last active admin. Make someone else an admin first. | | `cannot_delete_last_admin` | This is the last admin. Make someone else an admin first. | | `cannot_delete_self` | You can’t delete your own account. | | `cannot_demote_last_admin` | This is the last admin. Make someone else an admin first. | | `cannot_edit_own_role` | You can’t change your own role. | | `cannot_revoke_self` | You can’t revoke your own super admin access. | | `category_has_children` | This category has subcategories. Move or remove them first. | | `category_not_found` | That category couldn’t be found. | | `cc_bcc_bad_address` | One of the Cc or Bcc addresses isn’t a valid email address. | | `cc_bcc_internal_note` | An internal note can’t be copied to anyone. Remove the Cc and Bcc addresses or send a reply. | | `cc_bcc_staff_only` | Only internal staff can copy people on a reply. | | `cc_user_not_staff` | Only staff members can be added as watchers. | | `checkout_failed` | Couldn’t start the checkout. Try again in a moment. | | `checkout_in_progress` | A payment page for this invoice is already being prepared. Try again in a moment. | | `client_in_use` | This client is linked to projects, so it can’t be deleted. | | `client_not_found` | That client couldn’t be found. | | `clockify_not_configured` | Clockify isn’t connected for this workspace. | | `clockify_push_failed` | Clockify didn’t accept the update. Try again later. | | `cm_approval_not_required` | This expense doesn’t need country manager approval. | | `cm_threshold_not_configured` | Country manager approval isn’t configured. Ask your admin to set a threshold. | | `code_taken` | That code is already in use. Pick another. | | `company_in_use` | This company is still used by other records. Remove those first. | | `company_not_found` | That company couldn’t be found. | | `company_policy_already_exists` | A company-wide leave policy is already active. | | `company_project_mismatch` | Choose a company that matches the selected project. | | `config_error` | The ticket setup is incomplete. Ask your admin to check the configuration. | | `consultant_not_found` | That consultant couldn’t be found. | | `contact_no_email` | This contact has no email address. | | `contact_not_found` | That contact couldn’t be found. | | `contract_not_found` | That contract no longer exists. | | `contract_not_live` | Only approved or active contracts can be renewed. | | `cooldown` | Please wait {{arg}} minutes before sending another email. | | `country_manager_approval_required` | A country manager needs to approve this first. | | `country_manager_rejected` | The country manager rejected this. | | `create_failed` | Couldn’t create that. Please try again. | | `create_requires_any` | Choose at least one option before creating this. | | `cross_site_request` | This change came from another site, so it was blocked. Reload OpexAIO and try again. | | `currency_locked` | The currency can’t be changed once budget has been set up. | | `currency_unresolved` | Select a currency before submitting this expense. | | `customer_not_found` | That customer couldn’t be found. | | `d1_unavailable` | The service is temporarily unavailable. Please try again in a moment. | | `deal_company_not_found` | The company on this deal couldn’t be found. | | `deal_has_no_company` | This deal needs a company first. | | `deal_not_found` | That deal couldn’t be found. | | `deal_not_won` | Only won deals can do this. | | `default_conflict` | Another support address was just made the default. Refresh and try again. | | `default_exists` | A default already exists. Change or remove it first. | | `default_group_not_assigned` | The default group must be one of the selected groups. | | `default_requires_active` | A default item must be active. | | `document_missing` | The stored document is missing. Upload it again. | | `document_not_found` | That document couldn’t be found. | | `domain_claimed` | That email domain already belongs to another workspace. | | `domain_locked` | That email domain can’t be changed right now. | | `duplicate_code_in_sheet` | The same project code appears more than once in the file. | | `duplicate_email` | Someone with that email already exists. | | `duplicate_invitation` | That email already has a pending invitation. | | `duplicate_member` | That person is already on this list. | | `duplicate_name` | That name is already in use. Pick another. | | `duplicate_number` | That number is already in use. Pick another. | | `duplicate_payment_attempt` | This expense has already been paid. Reload and try again. | | `duplicate_pending_request` | There’s already a pending request for this. | | `duplicate_rule` | An identical rule already exists. | | `duplicate_rule_type` | A leave type can only appear once in a policy tier. | | `duplicate_target_not_found` | The ticket to merge into couldn’t be found. | | `duplicate_target_terminal` | That ticket is already closed, so it can’t be merged into. | | `email_in_use` | That email address is already registered. | | `email_mismatch` | This invitation was sent to a different email address. | | `email_required` | Enter an email address. | | `email_taken` | That email address is already registered. | | `empty_allow_list` | Select at least one product, or switch to all workspace products. | | `empty_document` | That document is empty. Upload it again or enter the details manually. | | `empty_file` | That file is empty. | | `entry_finalized` | Approved or invoiced time entries can’t be changed. | | `entry_not_approved` | Only approved time entries can be sent. | | `entry_not_found` | That time entry couldn’t be found. | | `entry_outside_window` | This entry is outside the editable period. A manager needs to approve the change. | | `entry_rejected` | Rejected entries must be edited and resubmitted before review. | | `exactly_one_target_required` | Choose exactly one contact or company. | | `exceeds_max_backdated_days` | Retroactive leave request exceeds the maximum allowance of {{max\_backdated\_days}} days. | | `exceeds_max_event_days` | This special leave request exceeds the maximum allowance of {{max\_days}} days. | | `expense_already_in_submission` | That expense is already part of a submission. | | `expense_not_draft` | Only draft expenses can be changed this way. | | `expense_not_found` | That expense couldn’t be found. | | `expense_paid` | This expense has already been paid and cannot be sent back for correction. | | `expired` | This link has expired. Ask for a new one. | | `fact_not_decidable` | That suggestion can’t be decided on now. | | `fact_not_found` | That item couldn’t be found. | | `fact_not_proposed` | That suggestion was already decided. | | `feedback_board_not_found` | That feedback board couldn’t be found. | | `feedback_comments_disabled` | Comments are turned off for this board. | | `feedback_email_required` | Enter your email address. | | `feedback_item_not_found` | That feedback item couldn’t be found. | | `feedback_submit_disabled` | Submissions are turned off for this board. | | `feedback_voting_disabled` | Voting is turned off for this board. | | `field_not_found` | That field couldn’t be found. | | `file_link_expired` | This download link has expired. Ask the sender for a new one. | | `file_link_invalid` | This download link isn’t valid. Ask the sender for a new one. | | `final_must_be_closed_group` | A final status must belong to a closed group. | | `final_status` | This is already in a final status and can’t be changed. | | `folder_not_found` | That folder couldn’t be found. | | `forbidden` | You don’t have permission to do that. | | `forward_bad_address` | That isn’t a valid email address to forward to. | | `forward_message_not_found` | That message can’t be forwarded. Internal notes and deleted messages are not shared. | | `free_mail_domain` | Personal email domains can’t be claimed by a workspace. | | `freshdesk_auth_failed` | Freshdesk rejected the credentials. Check the API key and domain. | | `freshdesk_unreachable` | Couldn’t reach Freshdesk. Check the domain and try again. | | `generation_failed` | Couldn’t generate that. Try again. | | `group_has_members` | This group still has members. Remove them before deleting it. | | `group_in_use` | This status group still has statuses in it. Move them to another group first. | | `group_inactive` | That group is inactive. | | `group_not_found` | That group couldn’t be found. | | `hire_date_required` | Your hire date has not been set by HR. Leave requests cannot be submitted until your hire date is configured. | | `holiday_country_year_not_supported` | Public holiday sync for Indonesia is only available for 2024 to 2027. Add holidays for other years manually via ‘+ Add Holiday’. | | `holiday_date_conflict` | A holiday already exists on this date. | | `holiday_fetch_failed` | Failed to fetch public holidays from the calendar service. Please try again. | | `home_workspace` | That’s the person’s own workspace. They always have access to it. | | `idle_not_allowed` | The idle time only applies to rules that trigger when a ticket goes idle. | | `idle_required` | Choose how long a ticket must be idle for this rule. | | `import_running` | An import is already running. Wait for it to finish. | | `in_use` | That file is in use and can’t be removed. | | `inactive_main_journey` | A status on the main journey can’t be inactive. | | `ineligible_role` | That user’s role can’t be added here. | | `initial_and_final` | A status can’t be both the first and the last step. | | `initial_must_be_active` | The starting status must be active. | | `initial_required` | A workflow needs exactly one starting status. | | `insert_failed` | Couldn’t save that. Please try again. | | `insufficient_leave_balance` | Your remaining leave balance is insufficient for this request. | | `insufficient_notice_days` | Leave request requires at least {{min\_notice\_days}} days advance notice. | | `internal_error` | Something went wrong on our side. Please try again in a moment. | | `internal_mail_recipients` | Internal emails can only go to staff. Remove the customer recipients. | | `internal_note_mail_not_internal` | An email sent when an internal note is added must be marked internal, so customers never see it. | | `internal_notes_staff_only` | Only internal staff can post internal notes. | | `internal_role_requires_internal_company` | Internal roles can only belong to your own company. | | `internal_text_in_client_mail` | The latest internal note can only be used in internal emails. | | `invalid_amount` | Rupiah invoices must be in whole rupiah. | | `invalid_approval_level` | Choose a valid approval level. | | `invalid_body` | Some of the values aren’t valid. Check the form and try again. | | `invalid_bulk_shape` | Those bulk changes aren’t valid. | | `invalid_color` | Enter a color as a 6-digit hex code, like #6366f1. | | `invalid_company_or_project` | Pick a valid company and project. | | `invalid_currency` | Choose USD, EUR, GBP or CAD. | | `invalid_cycle_day` | The selected cycle start day does not exist in the specified month. | | `invalid_date_range` | The end date must be on or after the start date. | | `invalid_entry_window` | Enter a number of days from 0 to 90. | | `invalid_expense_ids` | Some of the selected expenses aren’t valid. | | `invalid_export_format` | Choose a valid export format. | | `invalid_file` | That file couldn’t be read. Upload an Excel (.xlsx) file. | | `invalid_format` | Choose Excel or CSV. | | `invalid_input` | Some of the values aren’t valid. Check the form and try again. | | `invalid_json` | That data couldn’t be read. Check it and try again. | | `invalid_max_backdated_days` | Set a retroactive limit of at least 1 day when retroactive requests are allowed. | | `invalid_minutes` | Enter between 1 and 1,440 minutes. | | `invalid_name` | Enter a valid name. | | `invalid_option` | Choose one of the available options. | | `invalid_part` | That upload part isn’t valid. | | `invalid_part_shape` | That upload part isn’t valid. | | `invalid_peer` | Pick a covering colleague other than yourself. | | `invalid_project` | That project isn’t valid for this action. | | `invalid_refund_amount` | The refund must be more than zero and no more than what was paid. Rupiah refunds must be whole rupiah. | | `invalid_request` | That request isn’t valid. Check what you entered and try again. | | `invalid_rule_type` | One or more selected leave types do not exist in this workspace. | | `invalid_setting` | One of the settings isn’t valid. Check it and try again. | | `invalid_slug` | Use 2 to 50 characters: lowercase letters, numbers and hyphens. | | `invalid_snapshot` | That Clockify export isn’t valid. | | `invalid_source_week` | The week to copy from isn’t valid. | | `invalid_status` | That status isn’t valid. | | `invalid_subject_type` | That item type isn’t supported. | | `invalid_target` | That address does not belong to this service. | | `invalid_target_week` | The week to copy to isn’t valid. | | `invalid_time_range` | The end time must be after the start time. | | `invalid_timer_hours` | Enter a number of hours from 1 to 24. | | `invalid_timezone` | Choose a valid time zone. | | `invalid_token` | This link is invalid. | | `invalid_transition` | That change isn’t allowed from the current status. | | `invalid_user` | That user isn’t valid for this action. | | `invalid_week_start` | That week isn’t valid. | | `invalid_window` | The end date must be on or after the start date. | | `invalid_workspace_name` | Enter a valid workspace name. | | `key_taken` | That key is already in use. Pick another. | | `leave_balance_not_allocated` | No leave quota has been allocated for this year. | | `line_name_required` | Give the line a name or pick a product. | | `lines_not_found` | Some of the picked lines no longer exist. Reload and try again. | | `linked_ticket_needs_client_reply` | Creating a linked ticket is only possible when a client replies. | | `locked` | This item is locked and can’t be changed. | | `m365_not_configured` | Microsoft 365 isn’t connected for this workspace. | | `mapping_invalid` | The import mapping isn’t complete. Check it and try again. | | `master_invalid` | The ticket’s status, priority or category isn’t set up correctly. Ask your admin to check the configuration. | | `member_has_time` | This person has logged time, so they can’t be deleted. | | `member_not_found` | That member couldn’t be found. | | `member_not_in_company` | That person isn’t in this company. | | `member_not_in_group` | That person isn’t in the selected group. | | `member_not_pending` | Some expenses in this submission aren’t waiting for review. | | `member_not_submittable` | Some expenses in this submission can’t be submitted yet. | | `members_only` | This workspace shows its tickets only to its members. | | `membership_deactivated` | Your access to this workspace has been deactivated. | | `membership_required` | This person needs an active membership in that workspace first. Invite them, or reactivate their membership there. | | `message_blocked` | That message can’t be sent. | | `missing_lost_reason` | Choose a reason for losing this deal. | | `missing_prior_status` | The previous status couldn’t be restored. | | `model_required` | Enter a model name. | | `name_required` | A name is required. | | `name_taken` | That name is already taken. | | `no_active_timer` | There’s no timer running. | | `no_cc_targets` | Choose at least one person to add as a watcher. | | `no_company_available` | There’s no company to attach the projects to. | | `no_completed_job` | There’s no finished import to continue from. | | `no_content` | There’s nothing to save. Add some content first. | | `no_document` | This expense has no document attached. | | `no_fields` | Nothing to update. | | `no_file` | Choose a file to upload. | | `no_groups_selected` | Select at least one group. | | `no_matching_approval_policy` | No approval workflow applies to this request. Ask your admin to set one up. | | `no_pending_request` | There’s no pending request to act on. | | `no_quota_type` | No quota-bearing leave type is configured for this workspace. | | `no_rows` | The file has no rows to import. | | `no_solution_body` | The suggestion has no solution text to apply. | | `not_a_boolean` | Choose yes or no. | | `not_a_consultant` | That user isn’t a consultant. | | `not_a_date` | Enter a valid date. | | `not_a_list` | Choose one or more options for this field. | | `not_a_member` | That person isn’t a member of this workspace. | | `not_a_number` | Enter a number. | | `not_a_string` | Enter text for this field. | | `not_active_member` | That person’s membership in this workspace isn’t active. | | `not_admin_validated` | Admin validation hasn’t been completed yet. | | `not_assigned` | This isn’t assigned to anyone. | | `not_available` | That file isn’t available. | | `not_awaiting_verification` | This ticket isn’t waiting for your confirmation. | | `not_bulk_open` | That import isn’t open for more files. | | `not_collectable` | That invoice can’t be collected in its current state. | | `not_configured` | This isn’t set up yet. Ask your admin to configure it. | | `not_connected` | The connection isn’t set up or can no longer be read. Connect again. | | `not_consultant` | That user isn’t a consultant. | | `not_deletable` | That invoice can’t be deleted in its current state. | | `not_designated_approver` | Only the designated approver or an administrator can review this leave request. | | `not_found` | That item no longer exists. | | `not_found_or_processed` | That request was already handled or no longer exists. | | `not_owner` | Only the workspace owner can do that. | | `not_pm_approved` | The project manager needs to approve this first. | | `not_ready` | This submission isn’t ready yet. | | `not_resolved` | This ticket isn’t resolved yet. | | `not_snapshot_job` | That import isn’t a file import. | | `not_standalone` | This expense is part of a submission and can’t be managed standalone. | | `not_subscribed` | You aren’t subscribed to this. | | `not_uploading` | That import isn’t accepting uploads. | | `not_waiting` | This ticket isn’t waiting on anyone. | | `note_author_only` | Only the author or an admin can delete this note. | | `note_not_found` | That note couldn’t be found. | | `org_not_found` | That company couldn’t be found. | | `overlapping_leave` | You already have leave overlapping these dates. | | `own_entries_only` | You can only work with your own time entries. | | `own_report_only` | You can only view your own report. | | `owner_active` | This person owns the workspace. Transfer ownership first. | | `parent_must_be_root` | That parent can’t be used. Choose a top-level category. | | `parent_not_found` | That parent category couldn’t be found. | | `part_too_large` | That part of the file is too large. | | `payment_check_failed` | Couldn’t check the payment status. Try again in a moment. | | `payment_failed` | We couldn’t complete that payment right now. Please try again. | | `payment_processing` | A payment for this invoice is still being processed. Check back shortly. | | `pending_approval` | Your request is still waiting for approval. | | `permission_missing` | Your role doesn’t allow this. Ask your admin for access. | | `policy_in_use` | This policy is still in use. Move its tickets to another policy first. | | `portal_failed` | Couldn’t open the billing portal. Try again in a moment. | | `primary_member_conflict` | Someone else just set the primary contact on this deal. Refresh and try again. | | `primary_not_deletable` | The main attachment can’t be deleted. Set another as main first. | | `prior_status_inactive` | The previous status is no longer active. | | `priority_not_found` | That priority couldn’t be found. | | `probation_period_unmet` | This leave requires completing a waiting period of {{waiting\_months}} months before it can be requested. | | `product_checkout_unavailable` | Individual products can’t be bought yet. Subscribe to the suite instead. | | `product_group_not_found` | That product group couldn’t be found. | | `product_not_entitled` | Your workspace doesn’t have {{product}}. Ask your admin to add it. | | `product_not_found` | That product couldn’t be found. | | `product_read_only` | Your {{product}} trial has ended. You can still view your data, but changes need a subscription. | | `profile_missing` | Your account isn’t set up in a workspace yet. | | `project_approval_locked` | Approval setting cannot be changed once time entries exist for this project. | | `project_archived` | This project is archived, so it can’t take new time entries. | | `project_group_not_found` | That project group couldn’t be found. | | `project_has_time` | This project has time entries, so it can’t be deleted. | | `project_inactive` | That project is inactive, so it can’t be used here. | | `project_mismatch` | That doesn’t belong to this project. | | `project_not_assigned` | You aren’t assigned to that project. | | `project_not_found` | That project couldn’t be found. | | `project_private` | This is a private project and you aren’t part of it. | | `provider_not_configured` | This payment option isn’t available yet. | | `queue_not_configured` | Imports aren’t available right now. Try again later. | | `quota_below_used` | Total quota cannot be less than the days already used. | | `quota_exceeded` | You’ve used all the storage available. Remove some files and try again. | | `quota_exceeds_default` | Total quota cannot exceed the default allowance for this leave type. | | `quote_no_lines` | Add at least one product line before creating a quotation. | | `quote_number_taken` | Another quotation took that number. Try again. | | `rank_taken` | That rank is already in use. Pick another. | | `rate_limited` | Too many attempts. Wait a moment and try again. | | `rec_not_found` | That recommendation couldn’t be found. | | `ref_not_found` | Something this refers to couldn’t be found. | | `reply_author_needs_client_reply` | Emailing the reply author only applies to rules that trigger when a client replies. | | `response_exceeds_resolution` | The first-response target can’t be longer than the resolution target. | | `role_already_claimed` | One or more selected roles are already assigned to another policy. | | `role_in_use` | People still hold this role. Move them to another role first. | | `role_not_deactivatable` | This role can’t be deactivated here. | | `role_required` | Choose at least one role. | | `role_unsupported_for_existing_account` | This email already has an account in another workspace, so it can only be invited as Admin or Client requester. | | `role_unsupported_for_home_member` | This person’s own workspace role can’t be changed to that. | | `role_unsupported_for_member` | Members who joined from another workspace can only be Admin, Member or Client requester. | | `rows_already_exist` | Some of these already exist in your workspace. | | `rows_invalid` | Some rows in the file aren’t valid. Fix them and upload again. | | `sales_owner_in_use` | This sales owner still has records assigned. Reassign them first. | | `sales_owner_inactive` | That sales owner is inactive. | | `sales_owner_not_found` | That sales owner couldn’t be found. | | `same_status` | It’s already in that status. | | `seat_limit_reached` | This workspace has no free seats left. Raise the seat limit or free a seat first. | | `self_approval_forbidden` | You cannot approve or reject your own time entries. | | `self_approval_not_allowed` | You cannot approve or reject your own request. | | `sequence_conflict` | Someone else changed this at the same time. Refresh and try again. | | `sharepoint_access_denied` | SharePoint refused access. Ask your SharePoint admin to check that the site is still shared with the app. | | `sharepoint_consent_denied` | The Microsoft sign-in wasn’t completed. An administrator must approve access to continue. | | `sharepoint_item_not_found` | That file or folder no longer exists in SharePoint. | | `sharepoint_not_configured` | SharePoint isn’t set up on this platform yet. Ask your OpexCG contact to enable it. | | `sharepoint_not_connected` | This workspace isn’t connected to SharePoint yet. A workspace admin can connect it under Integrations. | | `sharepoint_setup_expired` | The SharePoint sign-in has expired. Select Reconnect to start again. | | `sharepoint_site_grant_failed` | Couldn’t give the app access to that SharePoint site. Make sure you’re an owner or member of the site, then try again. | | `sharepoint_unavailable` | SharePoint isn’t responding right now. Please try again in a moment. | | `slug_taken` | That workspace URL name is already taken. Pick another. | | `snapshot_incomplete` | The uploaded files are incomplete. Upload every part and try again. | | `snapshot_requires_full` | A file import must be a full import. | | `stale_ticket` | This ticket was changed by someone else. Reload and try again. | | `state_changed` | This item was changed by someone else. Reload and try again. | | `status_group_inactive` | That status group is inactive. | | `status_group_not_found` | That status group couldn’t be found. | | `status_master_not_found` | That status couldn’t be found. | | `status_not_found` | That status couldn’t be found. | | `status_not_linked` | This ticket’s status isn’t set up in this workspace. Ask your admin to check the configuration. | | `subject_not_found` | The item this is linked to couldn’t be found. | | `subject_type_and_id_required` | Choose both the item type and the item. | | `submission_empty` | Add at least one expense to this submission first. | | `submission_locked` | This submission is locked and can’t be changed. | | `submission_not_draft` | Only draft submissions can be changed this way. | | `submission_not_found` | That submission couldn’t be found. | | `subscription_not_configured` | Subscriptions aren’t available yet. Contact support. | | `suite_only_during_alpha` | During the alpha, products are sold together as one suite. Subscribe to the suite instead. | | `super_admin_bypasses_grants` | Super admins already reach every workspace. | | `support_address_removed` | The support address this email came in on was removed. Add it again, or discard the email. | | `support_portal_disabled` | The support portal is turned off. | | `sync_failed` | Couldn’t sync with billing. Try again in a moment. | | `sync_unavailable` | Live updates aren’t available right now. Refresh the page. | | `tag_in_use` | This tag is used on time entries, so it can’t be deleted. | | `tag_not_found` | That tag couldn’t be found. | | `target_not_found` | The target couldn’t be found. | | `target_status_not_found` | That status couldn’t be found. | | `target_week_offset` | The target week must be a whole number of weeks away from the source week. | | `target_workspace_suspended` | That workspace is suspended. Reactivate it before making it someone’s home. | | `task_has_time` | This task has logged time, so it can’t be deleted. | | `task_not_found` | That task couldn’t be found. | | `teams_access_denied` | You need permission to manage workspace settings to connect Teams. | | `teams_admin_required` | Sign in with a Microsoft 365 administrator account (Global, Teams or Application administrator) to connect Teams. | | `teams_channel_not_found` | That Teams channel couldn’t be found in this workspace. | | `teams_consent_denied` | The Microsoft approval wasn’t completed. A Microsoft 365 administrator must approve the app. | | `teams_not_configured` | Microsoft Teams isn’t set up on this platform yet. Ask your OpexCG contact to enable it. | | `teams_not_connected` | This workspace isn’t connected to Microsoft Teams yet. | | `teams_setup_expired` | The Microsoft sign-in has expired. Select Connect to start again. | | `teams_sso_invalid` | Microsoft couldn’t confirm your sign-in. Close the tab and open it again. | | `teams_tenant_taken` | That Microsoft 365 organization is already connected to another workspace. | | `teams_user_not_linked` | Your Microsoft account isn’t linked to a member of this workspace. Ask your workspace admin to invite you with your work email. | | `template_not_found` | That template couldn’t be found. | | `tenant_active` | Suspend the workspace before erasing it. | | `tenant_not_found` | That workspace couldn’t be found. | | `ticket_not_found` | That ticket couldn’t be found. | | `ticket_workflow_not_ready` | Tickets cannot be opened until the workflow has exactly one active initial status. | | `tier_quota_exceeded` | You have reached the maximum limit of {{limit}} {{resource}} for the {{tier}} plan. Upgrade to unlock more. | | `tier_required` | {{feature}} is included with {{product}} {{required}}. Ask your admin to upgrade. | | `timer_already_running` | A timer is already running. Stop it first. | | `timer_running` | Stop the timer on this entry first. | | `too_large` | That file is too large. | | `too_many_files` | You’ve selected too many files. | | `too_many_requests` | Too many attempts. Wait a moment and try again. | | `too_many_rows` | The file has too many rows to import at once. | | `too_old` | That’s too old to be discarded. | | `triage_already_complete` | Triage is already complete. Use the normal assignment instead. | | `triage_incomplete` | Finish triage before assigning this ticket. | | `trial_unavailable` | This product’s free trial has already been used. Subscribe or request access to keep using it. | | `trigger_requires_active` | A status that triggers an action must be active. | | `trigger_taken` | Another status already uses that trigger. | | `type_in_use` | This leave type is still used by pending or approved requests. | | `type_name_exists` | A leave type with this name already exists. | | `type_not_found` | That type couldn’t be found. | | `unassigned` | Assign this to someone first. | | `unauthorized` | Your session has expired. Sign in again. | | `unknown_agent` | The agent “{{arg}}” isn’t mapped to a user in this workspace. | | `unknown_category` | The category “{{arg}}” isn’t mapped to a category in this workspace. | | `unknown_client` | A client in the file doesn’t exist yet. Import the clients first. | | `unknown_company` | The company “{{arg}}” isn’t mapped to a company in this workspace. | | `unknown_group` | That group isn’t recognised. | | `unknown_placeholder` | The email uses a placeholder that doesn’t exist. Pick placeholders from the list. | | `unknown_priority` | The priority “{{arg}}” isn’t mapped to a priority in this workspace. | | `unknown_priority_code` | That priority isn’t recognised. | | `unknown_purpose` | That email purpose isn’t recognised. | | `unknown_status` | The status “{{arg}}” isn’t mapped to a status in this workspace. | | `unknown_status_purpose` | That status purpose isn’t recognised. | | `unreadable_workbook` | That file isn’t a readable Excel (.xlsx) workbook. | | `unsupported_field` | That field can’t be changed this way. | | `unsupported_type` | That file type isn’t supported. | | `user_already_claimed` | One or more selected members are already assigned to another policy. | | `user_already_owner` | That person already owns this workspace. | | `user_not_found` | That user couldn’t be found. | | `users_not_in_workspace` | Some of those people aren’t members of this workspace. | | `validation_failed` | Some of the values aren’t valid. Check the form and try again. | | `validation_managed_by_workflow` | This sign-off is a step of the approval workflow. Request a correction instead of clearing it. | | `watcher_not_found` | That watcher couldn’t be found, or isn’t a member of this workspace. | | `week_has_entries` | The target week already has entries. Choose to overwrite or merge. | | `week_range_incomplete` | Choose both the week to copy from and the week to copy to. | | `window_too_long` | That period is too long. Choose 60 days or fewer. | | `workspace_inactive` | This workspace is suspended. | | `workspace_not_found` | That workspace couldn’t be found. | | `workspace_restricted` | This workspace is restricted right now. | | `write_failed` | Couldn’t save that. Please try again. | | `wrong_workspace` | That item belongs to a different workspace. | | `zero_working_days` | The selected dates do not contain any working days. | # Approvals > Approve or reject expenses, leave and other requests from your own tools. One approval engine serves every product: expenses, leave, timesheets and more land in the same inbox. The approval endpoints need no product of their own; each decision checks the record’s product and that the task is yours. Full details: [Approvals API](/docs/reference/approvals/). ## Recipe: approve from a chat bot List what waits for you: ```bash curl -s "$OPEX/api/approvals/inbox" -H "X-API-Key: $OPEX_API_KEY" \ | jq '{items: [.items[] | {taskId, instanceId, product, title, requesterName, stageName, rev}]}' ``` ```json { "items": [ { "taskId": "f138717f-b73d-4d5c-96fc-93070828a9b7", "instanceId": "60e3aa79-1fcb-46be-8775-7be3cb0bdd78", "product": "expenses", "title": "Expense Grab from Budi Santoso", "requesterName": "Budi Santoso", "stageName": "Project manager approval", "rev": 0 }, { "taskId": "df3142c7-6855-4339-ac0d-4bc521a6ace5", "instanceId": "f308531f-81a3-4edc-89c6-bf412d1d30b5", "product": "leave", "title": "Annual leave for Budi Santoso", "requesterName": "Budi Santoso", "stageName": "Approval", "rev": 0 } ] } ``` Decide one task: ```bash curl -s -X POST "$OPEX/api/approvals/tasks/f138717f-b73d-4d5c-96fc-93070828a9b7/decide" \ -H "X-API-Key: $OPEX_API_KEY" -H "content-type: application/json" \ -d '{"decision":"approved","comment":"Approved, enjoy the trip"}' ``` ```json { "instanceId": "60e3aa79-1fcb-46be-8775-7be3cb0bdd78", "status": "pending", "currentStage": 1, "outcome": "advanced" } ``` `outcome` tells you what your decision did: `recorded` (the stage needs more approvers), `advanced` (on to the next stage, here admin validation), or `approved` / `rejected` (the request is decided). Use `"decision":"rejected"` to reject. Sending the same decision again, or deciding a task someone else already settled, answers `409`: ```json { "error": "approval_conflict" } ``` Treat it as “already handled”: refresh the inbox and move on. ## Recipe: show where a request stands ```bash curl -s "$OPEX/api/approvals/instances/60e3aa79-1fcb-46be-8775-7be3cb0bdd78" -H "X-API-Key: $OPEX_API_KEY" \ | jq '{status, definitionName, stages: [.stages[] | {name, status}]}' ``` ```json { "status": "pending", "definitionName": "Standard expense approval", "stages": [ { "name": "Project manager approval", "status": "approved" }, { "name": "Admin validation", "status": "pending" }, { "name": "Country Manager approval", "status": "upcoming" } ] } ``` Expenses and leave requests carry their `approval_instance_id`, so you can link from a record to its timeline. # CRM > Sync leads from your website, open deals and keep their timeline up to date. CRM endpoints need the CRM product, plus `crm:record:read` to read and `crm:record:write` to change anything. Creating or renaming companies also needs `crm:company:create` or `crm:company:update`. Full details: [CRM API](/docs/reference/crm/). ## Recipe: turn a website form into a lead and a deal ```bash curl -s -X POST "$OPEX/api/crm/contacts" \ -H "X-API-Key: $OPEX_API_KEY" -H "content-type: application/json" \ -d '{"email":"rudi@tirtamas.example","name":"Rudi Hartono","company":"Tirta Mas","source":"website form"}' \ | jq '{id, email, name, status, source}' ``` ```json { "id": "a0279c49-9498-4684-a5eb-4daff77c39e1", "email": "rudi@tirtamas.example", "name": "Rudi Hartono", "status": "lead", "source": "website form" } ``` Contacts are unique by email. When the same person fills in the form again, the call answers `200` with the existing contact and only fills its blank fields, so the sync can run as often as you like. ```bash CONTACT_ID=a0279c49-9498-4684-a5eb-4daff77c39e1 curl -s -X POST "$OPEX/api/crm/deals" \ -H "X-API-Key: $OPEX_API_KEY" -H "content-type: application/json" \ -d "{\"name\":\"Tirta Mas water plant maintenance\",\"contactId\":\"$CONTACT_ID\", \"amountCents\":12000000000,\"currency\":\"IDR\"}" \ | jq '{id, name, stage, amount_cents, currency}' ``` ```json { "id": "ac455537-d864-448a-a7be-71f3f8313ef4", "name": "Tirta Mas water plant maintenance", "stage": "lead", "amount_cents": 12000000000, "currency": "IDR" } ``` `amountCents` is in minor units: `12000000000` is Rp 120.000.000. ## Recipe: log a meeting and move the deal ```bash DEAL_ID=ac455537-d864-448a-a7be-71f3f8313ef4 curl -s -X POST "$OPEX/api/crm/activities" \ -H "X-API-Key: $OPEX_API_KEY" -H "content-type: application/json" \ -d "{\"subjectType\":\"deal\",\"subjectId\":\"$DEAL_ID\",\"kind\":\"meeting\", \"title\":\"Site visit\",\"body\":\"Walked the pump house with the plant manager.\"}" \ | jq '{id, kind, title, occurred_at}' curl -s -X POST "$OPEX/api/crm/deals/$DEAL_ID/move" \ -H "X-API-Key: $OPEX_API_KEY" -H "content-type: application/json" \ -d '{"stage":"qualified"}' | jq '{id, stage, closed_at}' ``` ```json { "id": "5d66a85c-833b-478c-bdbc-50caea354d01", "kind": "meeting", "title": "Site visit", "occurred_at": 1794051343536 } { "id": "ac455537-d864-448a-a7be-71f3f8313ef4", "stage": "qualified", "closed_at": null } ``` The move is recorded on the deal’s timeline. Moving to `lost` needs a `lostReason`; moving to `won` or `lost` sets `closed_at`. # Expenses > Capture a receipt, complete the expense and submit it for approval. Expenses endpoints need the Expenses product. Members file and edit their own drafts; editing someone else’s needs `expenses:submission:manage`. Receipt capture needs the Expenses `pro` plan. Full details: [Expenses API](/docs/reference/expenses/). ## Recipe: from a receipt photo to an approval request Upload the photo as `multipart/form-data`. A draft expense is created at once and text recognition fills in vendor, amounts and lines a few seconds later. ```bash EXPENSE_ID=$(curl -s -X POST "$OPEX/api/expenses/capture" \ -H "X-API-Key: $OPEX_API_KEY" -F "file=@receipt.jpg" | jq -r .id) ``` ```json { "id": "880e1c07-1c4a-4754-ba00-bdbd397f89d5" } ``` Read the draft back (`GET /api/expenses/$EXPENSE_ID`) to see what was recognised, then fill in or correct what you know: ```bash curl -s -X PATCH "$OPEX/api/expenses/$EXPENSE_ID" \ -H "X-API-Key: $OPEX_API_KEY" -H "content-type: application/json" \ -d '{"vendorName":"Grab","documentKind":"receipt","currency":"IDR","totalCents":6500000, "category":"Travel & Transportation"}' \ | jq '{id, status, vendor_name, total_cents, currency}' ``` ```json { "id": "880e1c07-1c4a-4754-ba00-bdbd397f89d5", "status": "draft", "vendor_name": "Grab", "total_cents": 6500000, "currency": "IDR" } ``` `totalCents: 6500000` is Rp 65.000. Category names come from `GET /api/expenses/categories`. Then submit it: ```bash curl -s -X POST "$OPEX/api/expenses/$EXPENSE_ID/submit" -H "X-API-Key: $OPEX_API_KEY" \ | jq '{id, status}' ``` ```json { "id": "880e1c07-1c4a-4754-ba00-bdbd397f89d5", "status": "pending" } ``` The expense now waits in its approvers’ [approval inbox](/docs/guides/approvals/). Without the `pro` plan, skip the capture step and create the draft with `POST /api/expenses` instead. ## Recipe: list your expenses waiting for approval ```bash curl -s "$OPEX/api/expenses?mine=1&status=pending&pageSize=3" -H "X-API-Key: $OPEX_API_KEY" \ | jq '{total, items: [.items[] | {vendor_name, total_cents, currency, status}]}' ``` ```json { "total": 2, "items": [ { "vendor_name": "Grab", "total_cents": 6500000, "currency": "IDR", "status": "pending" }, { "vendor_name": "Kopi Kenangan", "total_cents": 9000000, "currency": "IDR", "status": "pending" } ] } ``` # Helpdesk > Open tickets from your own systems, reply to them and close them. Helpdesk endpoints need the Helpdesk product. Reading tickets needs `ticket:read`; replying as staff, changing fields and closing need `helpdesk:ticket:work`. Full details: [Helpdesk API](/docs/reference/helpdesk/). ## Recipe: open a ticket from a monitoring alert Turn an alert into a ticket on the right project, so it follows your normal SLA and assignment rules. ```bash # The project the alert belongs to PROJECT_ID=$(curl -s "$OPEX/api/projects?search=Portal&pageSize=1" -H "X-API-Key: $OPEX_API_KEY" \ | jq -r '.items[0].id') curl -s -X POST "$OPEX/api/helpdesk/tickets" \ -H "X-API-Key: $OPEX_API_KEY" -H "content-type: application/json" \ -d "{\"projectId\":\"$PROJECT_ID\",\"title\":\"Disk usage above 90% on db-01\", \"body\":\"

Alert from monitoring: /var/lib/postgresql at 92%.

\",\"priority\":\"high\"}" \ | jq '{ticket: {id: .ticket.id, number: .ticket.number, status: .ticket.status, priority: .ticket.priority}, duplicate, aiAnswered}' ``` ```json { "ticket": { "id": "adaa732e-5b97-45b0-b81c-226c370e1999", "number": "SUP-2026-000018", "status": "new", "priority": "high" }, "duplicate": null, "aiAnswered": false } ``` `body` is HTML. When the new ticket looks like an open one, `duplicate` names it, so your integration can link the two instead of paging people twice. Before opening a ticket for a repeating alert, search for an open one first (`GET /api/helpdesk/tickets?search=db-01&mine=1`). ## Recipe: reply and close ```bash TICKET_ID=adaa732e-5b97-45b0-b81c-226c370e1999 # Public reply: emailed to the requester. Use "internal": true for a staff-only note. curl -s -X POST "$OPEX/api/helpdesk/tickets/$TICKET_ID/events" \ -H "X-API-Key: $OPEX_API_KEY" -H "content-type: application/json" \ -d '{"body":"

Old WAL files removed, usage back to 61%.

","internal":false}' ``` ```json { "ok": true, "id": "91fac49c-496c-47c6-b3dd-976fa1d5efa3" } ``` ```bash curl -s -X POST "$OPEX/api/helpdesk/tickets/$TICKET_ID/close" -H "X-API-Key: $OPEX_API_KEY" ``` ```json { "ok": true, "status": "CLOSED" } ``` `status` is the code of your workspace’s closed status. If your status workflow needs other actions before closing, the ticket stays put and the answer lists them in `awaitingTriggers`. Consultants can close only tickets assigned to them. # Leave > Check leave balances and request time off. Leave endpoints need the Leave product. Requesting needs `leave:request:create`; reading your balances `leave:balance:read_own`. Approving goes through the shared [approval inbox](/docs/guides/approvals/). Full details: [Leave API](/docs/reference/leave/). ## Recipe: check your balance ```bash curl -s "$OPEX/api/leave/balances/mine" -H "X-API-Key: $OPEX_API_KEY" \ | jq '{items: [.items[] | {type_name, year, total_allowance, used_days, pending_days}]}' ``` ```json { "items": [ { "type_name": "Annual", "year": 2026, "total_allowance": 12, "used_days": 0, "pending_days": 0 } ] } ``` Pass `year=2027` for another year. Types without a yearly quota (sick leave, for example) have no balance row. ## Recipe: request two days off A request needs a leave type and a colleague who covers for you. ```bash TYPE_ID=$(curl -s "$OPEX/api/leave/types" -H "X-API-Key: $OPEX_API_KEY" \ | jq -r '.items[] | select(.name == "Annual") | .id') PEER_ID=$(curl -s "$OPEX/api/leave/peers?search=dewi" -H "X-API-Key: $OPEX_API_KEY" \ | jq -r '.items[0].id') curl -s -X POST "$OPEX/api/leave/requests" \ -H "X-API-Key: $OPEX_API_KEY" -H "content-type: application/json" \ -d "{\"type_id\":\"$TYPE_ID\",\"start_date\":\"2028-09-11\",\"end_date\":\"2028-09-12\", \"reason\":\"Family trip\",\"covering_peer_id\":\"$PEER_ID\"}" \ | jq '{id, status, days, start_date, end_date}' ``` ```json { "id": "e3cbf033-8e44-4432-9a7d-55dd59f8c4bb", "status": "pending", "days": 2, "start_date": 1852243200000, "end_date": 1852329600000 } ``` Dates go in as calendar days and come back as epoch milliseconds at UTC midnight; `days` counts working days. Common refusals: `leave_balance_not_allocated` (no quota for that year yet: ask your admin), `overlapping_leave`, and `zero_working_days` (the range is only weekends or holidays). Cancel with `POST /api/leave/requests/{id}/cancel`. # Project > Read projects and create, list and update tasks. Projects live at `/api/projects` and are shared by every product, so they need no product of their own. Tasks need the Project product (`pmo`); creating and updating them needs `pmo:task:create` and `pmo:task:update`. Full details: [Project API](/docs/reference/pmo/). Task endpoints are **RPC procedures**: always `POST`, with the input wrapped as `{"json": {...}}` and the result in the `json` field of the answer. ## Recipe: create a task from an issue in another tool ```bash PROJECT_ID=$(curl -s "$OPEX/api/projects?search=Portal&pageSize=1" -H "X-API-Key: $OPEX_API_KEY" \ | jq -r '.items[0].id') curl -s -X POST "$OPEX/api/pmo/rpc/tasks/create" \ -H "X-API-Key: $OPEX_API_KEY" -H "content-type: application/json" \ -d "{\"json\":{\"projectId\":\"$PROJECT_ID\",\"name\":\"Upgrade PostgreSQL to 17\",\"priority\":\"high\"}}" \ | jq '{json: {id: .json.id, sequence_id: .json.sequence_id, name: .json.name, priority: .json.priority, state: .json.state.name}}' ``` ```json { "json": { "id": "955b3a41-eead-4283-b46a-3f3ceb4c9ccb", "sequence_id": 1, "name": "Upgrade PostgreSQL to 17", "priority": "high", "state": "Todo" } } ``` The task starts in the project’s default state. `sequence_id` is its number within the project. Dates (`start_date`, `target_date`) are epoch milliseconds, and `description_html` takes HTML. ## Recipe: list the high-priority tasks of a project ```bash curl -s -X POST "$OPEX/api/pmo/rpc/tasks/list" \ -H "X-API-Key: $OPEX_API_KEY" -H "content-type: application/json" \ -d "{\"json\":{\"projectId\":\"$PROJECT_ID\",\"priority\":\"high\",\"pageSize\":5}}" \ | jq '{json: {total: .json.total, items: [.json.items[] | {sequence_id, name, priority}]}}' ``` ```json { "json": { "total": 1, "items": [{ "sequence_id": 1, "name": "Upgrade PostgreSQL to 17", "priority": "high" }] } } ``` To change a task, send only the fields that change to `tasks/update` with `projectId` and `taskId`, for example `{"json":{"projectId":"…","taskId":"…","priority":"urgent"}}`. A task that does not exist answers: ```json { "json": { "defined": false, "code": "NOT_FOUND", "status": 404, "message": "not_found" } } ``` # Timesheets > Log time from other tools and total up hours. Timesheets endpoints need the Timesheets product. Logging needs `timesheets:entry:create`; reading needs `timesheets:entry:read_own` (your entries) or `timesheets:entry:read_others`. Full details: [Timesheets API](/docs/reference/timesheets/). ## Recipe: log a calendar event as time ```bash # The project to log against (pick it by name, or keep its id in your config) PROJECT_ID=$(curl -s "$OPEX/api/timesheets/projects" -H "X-API-Key: $OPEX_API_KEY" \ | jq -r '[.[] | select(.name == "ABC OPEXmx Portal")][0].id') START=$(date -d 'today 09:00' +%s000) # epoch milliseconds END=$(date -d 'today 10:30' +%s000) curl -s -X POST "$OPEX/api/timesheets" \ -H "X-API-Key: $OPEX_API_KEY" -H "content-type: application/json" \ -d "{\"projectId\":\"$PROJECT_ID\",\"description\":\"Sprint planning\", \"startedAt\":$START,\"endedAt\":$END,\"billable\":true}" \ | jq '{id, project_id, started_at, ended_at, duration_minutes, status, billable}' ``` ```json { "id": "d1b8fd89-9174-43c7-a35b-7db4636a1fda", "project_id": "prj-opexmx", "started_at": 1794016800000, "ended_at": 1794022200000, "duration_minutes": 90, "status": "approved", "billable": 1 } ``` The entry is always yours. Its `status` depends on the project: `approved` straight away, or `pending` when the project requires approval. Instead of a start and end you can send `durationMinutes`. ## Recipe: hours this week ```bash curl -s "$OPEX/api/timesheets?mine=1&dateFrom=2026-11-02&dateTo=2026-11-08&limit=500" \ -H "X-API-Key: $OPEX_API_KEY" \ | jq '{entries: (.entries | length), hours: ((.entries | map(.duration_minutes // 0) | add // 0) / 60)}' ``` ```json { "entries": 1, "hours": 1.5 } ``` This list pages with `limit` (up to 500) and `offset`, not `page`. `dateTo` includes the whole day. # Connect an AI assistant (MCP) > Connect ChatGPT, Claude.ai, Claude Code, Claude Desktop or Cursor to OpexAIO through the MCP server. The [Model Context Protocol](https://modelcontextprotocol.io) (MCP) lets an AI assistant use OpexAIO directly: “log 2 hours on the portal project”, “which tickets are waiting for me?”, “approve the leave requests from my team”. The assistant calls the same tools the in-app assistant uses, as you, with your permissions. ## What you need * **An Enterprise plan** on at least one product. Otherwise the server answers `402` `{"error":"tier_required","feature":"mcp","required":"enterprise"}`. * **A way to sign in.** ChatGPT and Claude.ai sign in with OAuth: you approve them in the browser, no key to copy. Other clients use an API key: create one in the app (sidebar **MCP**, then **Create API key**); the page’s Setup guide tab then shows ready-made commands with your key filled in. | | | | ---------------- | ---------------------------------------------------------------------- | | Server URL | `https://app.aio.opexcg.com/api/mcp` | | Transport | Streamable HTTP (stateless; plain JSON answers) | | Authentication | OAuth 2.1 (`Authorization: Bearer …`) or header `X-API-Key: pk_live_…` | | Protocol version | `2024-11-05` | ## Connect ChatGPT ChatGPT adds OpexAIO as an app (connector) and signs in with OAuth. 1. In ChatGPT, open **Settings**, then **Apps & Connectors**, then **Advanced settings**, and turn on **Developer mode**. On a Business or Enterprise workspace, a ChatGPT admin may have to allow custom apps first. 2. Back in **Apps & Connectors**, choose **Create**. 3. Fill in: * **Name:** `OpexAIO` * **MCP server URL:** `https://app.aio.opexcg.com/api/mcp` * **Authentication:** `OAuth` 4. Confirm that you trust the app and choose **Create**. ChatGPT registers itself with OpexAIO and opens a sign-in window. 5. Sign in to OpexAIO if asked. On the consent screen, pick the **workspace** ChatGPT may use (only workspaces with an Enterprise plan can be picked) and choose **Allow**. In a chat, choose **+**, then **Developer mode**, and turn on OpexAIO. ChatGPT asks before it runs a tool that changes data. ## Connect Claude.ai Claude.ai (web, desktop and mobile) adds OpexAIO as a custom connector and signs in with OAuth. 1. In Claude, open **Settings**, then **Connectors**, and choose **Add custom connector**. On a Team or Enterprise plan, an owner first adds it under **Organization settings, Connectors**; members then choose **Connect** on it. 2. Fill in: * **Name:** `OpexAIO` * **Remote MCP server URL:** `https://app.aio.opexcg.com/api/mcp` * Leave **Advanced settings** (client ID and secret) empty: Claude registers itself. 3. Choose **Add**, then **Connect**. Sign in to OpexAIO if asked, pick the workspace on the consent screen and choose **Allow**. In a chat, open the tools menu and turn on OpexAIO. ## See and disconnect connected apps Each approval appears in the app under sidebar **MCP**, tab **Connected apps**, with its workspace and when it was last used. **Disconnect** ends its access at once; the app has to ask you again to come back. A connection signs in for 1 hour at a time and renews itself for up to 30 days of inactivity. ## Claude Code ```bash claude mcp add --scope user --transport http opex-aio https://app.aio.opexcg.com/api/mcp \ --header "X-API-Key: pk_live_your_key_here" ``` Run `claude mcp list` to check the connection, then ask Claude about your workspace. ## Claude Desktop Claude Desktop starts local servers from its configuration file, so it reaches OpexAIO through the [`mcp-remote`](https://www.npmjs.com/package/mcp-remote) bridge (needs Node.js). Open **Settings, Developer, Edit Config** and add: ```json { "mcpServers": { "opex-aio": { "command": "npx", "args": [ "-y", "mcp-remote", "https://app.aio.opexcg.com/api/mcp", "--header", "X-API-Key:${OPEX_API_KEY}", "--transport", "http-only" ], "env": { "OPEX_API_KEY": "pk_live_your_key_here" } } } } ``` Restart Claude Desktop. The OpexAIO tools appear under the tools icon of the chat box. ## Cursor Add the server to `~/.cursor/mcp.json` (all projects) or `.cursor/mcp.json` (one project): ```json { "mcpServers": { "opex-aio": { "url": "https://app.aio.opexcg.com/api/mcp", "headers": { "X-API-Key": "pk_live_your_key_here" } } } } ``` Then enable `opex-aio` under **Cursor Settings, MCP**. ## Other clients Any MCP client that speaks Streamable HTTP works: clients that support the MCP authorization spec find the OAuth endpoints themselves from the server’s `401` answer (see [OAuth](/docs/authentication/#oauth-for-mcp-connectors)), and clients that can send a custom header use an API key. Clients that only start local servers can use the `mcp-remote` bridge shown for Claude Desktop. ## What the assistant can do `tools/list` returns the tools of the products your workspace can use: tasks, sprints, pages and whiteboards in Project; contacts and deals in CRM; time entries and approvals in Timesheets; tickets and the knowledge base in Helpdesk; expenses in Expenses; leave in Leave; and the shared approval inbox. The [tool reference](/docs/mcp/tools/) lists every tool with its arguments. * **Read tools** are marked with `readOnlyHint`; assistants may run them without asking. * **Write tools** change data. Most assistants ask you before running a tool that is not marked read-only. * **Permissions** are checked on every call, exactly as in the app. A denied call returns an error whose message starts with `forbidden: missing` and names the permission code. ## Try it without a client The server is plain JSON-RPC over HTTP, so `curl` works: ```bash curl -s -X POST "$OPEX/api/mcp" -H "X-API-Key: $OPEX_API_KEY" -H "content-type: application/json" \ -d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"list_leave_types","arguments":{}}}' ``` ```json { "jsonrpc": "2.0", "id": 1, "result": { "content": [ { "type": "text", "text": "{\"items\":[{\"id\":\"28a321f4-3500-4176-9373-1f439a3dad45\",\"name\":\"Annual\",\"paid\":true},{\"id\":\"80eb311d-d1e0-46ce-a315-13b41348c867\",\"name\":\"Sick\",\"paid\":true},{\"id\":\"0cdbf172-3b3a-41a5-acd8-4fd54fa42b65\",\"name\":\"Unpaid\",\"paid\":false}]}" } ] } } ``` Tool results arrive as JSON text inside `result.content`. The other methods are `initialize`, `tools/list` and `ping`. # MCP tool reference > Every tool the OpexAIO MCP server offers, with its inputs, product and permission. The MCP server at `/api/mcp` offers 137 tools: 60 read data, the other 77 change it. `tools/list` returns only the tools of products your workspace can use. * **Read** tools carry the MCP `readOnlyHint` annotation. The in-app assistant runs them straight away. * **Write** tools change data. Clients such as Claude ask you before running them; the in-app assistant always asks. * **Permission** is checked on every call. A denied call returns an error whose message is `forbidden: missing `. ## Project ### `add_comment` Add a comment to a task * **Kind:** Write * **Permission:** `pmo:task:update` | Argument | Type | Required | Description | | ------------------ | ------------------------ | -------- | ------------------------------------------------------------------ | | `task_id` | `string` | yes | | | `comment_html` | `string` | yes | | | `comment_stripped` | `string` | no | | | `access` | `"internal" \| "public"` | no | | | `slim` | `boolean` | no | Return a slim identifying comment instead of the full comment body | ### `add_contract_line` Add a line to a contract: quantity × unit price with its own term. Units bought at different times that expire in different months are separate lines. * **Kind:** Write * **Permission:** `pmo:project:update` | Argument | Type | Required | Description | | ------------------ | ------------------------------------- | -------- | ----------------------------------------------------------------------------------------------- | | `contract_id` | `string` | yes | | | `name` | `string` | yes | What is sold, e.g. “Device subscription” | | `description` | `string` | no | | | `quantity` | `number` | yes | Units, e.g. 20 devices | | `unit_label` | `string` | no | Unit name, e.g. “device”, “user” | | `unit_price_cents` | `integer` | yes | Price per unit per billing period in cents of the contract currency (IDR 2.535.000 = 253500000) | | `billing_period` | `"one_time" \| "monthly" \| "annual"` | no | Default annual | | `start_date` | `string \| integer` | no | Date as YYYY-MM-DD (UTC) or epoch ms; null clears it | | `end_date` | `string \| integer` | no | Date as YYYY-MM-DD (UTC) or epoch ms; null clears it. Omit to use the contract’s end date | | `renews_line_id` | `string` | no | The line on an earlier contract this line continues (marks it renewed) | ### `add_link` Add an external link to a task * **Kind:** Write * **Permission:** `pmo:task:update` | Argument | Type | Required | Description | | --------- | -------- | -------- | -------------------------- | | `task_id` | `string` | yes | | | `title` | `string` | no | | | `url` | `string` | yes | URL of the linked resource | ### `add_reaction` Add a reaction to a task (replaces this user’s existing reaction) * **Kind:** Write * **Permission:** `pmo:task:update` | Argument | Type | Required | Description | | ---------- | -------- | -------- | -------------------------- | | `task_id` | `string` | yes | | | `reaction` | `string` | yes | The reaction emoji or text | ### `add_relation` Add a relation between two tasks * **Kind:** Write * **Permission:** `pmo:task:update` | Argument | Type | Required | Description | | ----------------- | ---------------------------------------------------------- | -------- | ----------- | | `task_id` | `string` | yes | | | `related_task_id` | `string` | yes | | | `relation_type` | `"blocks" \| "blocked_by" \| "relates_to" \| "duplicates"` | yes | | ### `add_subscriber` Add a subscriber to a task (idempotent) * **Kind:** Write * **Permission:** `pmo:task:update` | Argument | Type | Required | Description | | --------- | -------- | -------- | ---------------------------------- | | `task_id` | `string` | yes | | | `user_id` | `string` | yes | user\_profile.id of the subscriber | ### `add_task_attachment` Attach an evidence file to a task. Upload the bytes FIRST via multipart POST /api/uploads (R2 storage + tenant quota; auth with the same credential as MCP), then register the returned id (an R2 key) here. Evidence rule: embed the returned url in a task comment so reviewers see the proof inline. * **Kind:** Write * **Permission:** `pmo:task:update` | Argument | Type | Required | Description | | --------- | -------- | -------- | -------------------------------------------- | | `task_id` | `string` | yes | | | `asset` | `string` | yes | R2 key: the id returned by POST /api/uploads | | `name` | `string` | no | File name (e.g. evidence.png) | | `size` | `number` | no | File size in bytes | | `type` | `string` | no | MIME type (e.g. image/png) | ### `add_task_to_module` Add a task to a module * **Kind:** Write * **Permission:** `pmo:project:update` | Argument | Type | Required | Description | | ----------- | -------- | -------- | ----------- | | `module_id` | `string` | yes | | | `task_id` | `string` | yes | | ### `add_task_to_sprint` Add a task to a sprint * **Kind:** Write * **Permission:** `pmo:project:update` | Argument | Type | Required | Description | | ----------- | -------- | -------- | ----------- | | `sprint_id` | `string` | yes | | | `task_id` | `string` | yes | | ### `bulk_assign_task` Add one user as assignee on multiple tasks in a single call (max 100) * **Kind:** Write * **Permission:** `pmo:task:update` | Argument | Type | Required | Description | | ------------- | ---------- | -------- | -------------------------------- | | `task_ids` | `string[]` | yes | Task IDs (max 100) | | `assignee_id` | `string` | yes | user\_profile.id of the assignee | ### `bulk_move_to_sprint` Add multiple tasks to one sprint in a single call. Tasks outside the sprint’s project are skipped and reported (max 100) * **Kind:** Write * **Permission:** `pmo:task:update` | Argument | Type | Required | Description | | ----------- | ---------- | -------- | ------------------------------------------------ | | `task_ids` | `string[]` | yes | Task IDs (max 100) | | `sprint_id` | `string` | yes | Target sprint: must belong to the tasks’ project | ### `bulk_update_state` Move multiple tasks to one workflow state in a single call. Tasks in a different project than the state are skipped and reported (max 100) * **Kind:** Write * **Permission:** `pmo:task:update` | Argument | Type | Required | Description | | ---------- | ---------- | -------- | ----------------------------------------------- | | `task_ids` | `string[]` | yes | Task IDs (max 100) | | `state_id` | `string` | yes | Target state: must belong to the tasks’ project | ### `create_contract` Create a draft contract for a client company. Give client\_id, or client\_name to match an existing company by exact name. Add what it sells with add\_contract\_line; once it has lines its amount is their annual total. * **Kind:** Write * **Permission:** `pmo:project:update` | Argument | Type | Required | Description | | -------------- | ------------------------------------------------------------------------------------------------------------------ | -------- | ---------------------------------------------------- | | `client_id` | `string` | no | | | `client_name` | `string` | no | | | `name` | `string` | yes | | | `type` | `"retainer" \| "annual_support" \| "implementation" \| "change_request" \| "presales" \| "internal" \| "training"` | yes | | | `start_date` | `string \| integer` | no | Date as YYYY-MM-DD (UTC) or epoch ms; null clears it | | `end_date` | `string \| integer` | no | Date as YYYY-MM-DD (UTC) or epoch ms; null clears it | | `currency` | `string` | no | ISO code, default IDR | | `amount_cents` | `integer` | no | Only for contracts without lines | | `auto_renew` | `boolean` | no | | ### `create_custom_field` Create a custom field on a project. field\_type: text|number|date|select|multiselect|boolean. select/multiselect require options. * **Kind:** Write * **Permission:** `pmo:project:update` | Argument | Type | Required | Description | | ------------- | ------------------------------------------------------------------------ | -------- | ---------------------------------- | | `project_id` | `string` | yes | | | `name` | `string` | yes | | | `field_type` | `"text" \| "number" \| "date" \| "select" \| "multiselect" \| "boolean"` | yes | | | `description` | `string` | no | | | `is_required` | `boolean` | no | | | `options` | `string[]` | no | Choice list for select/multiselect | ### `create_folder` Create a project folder. ALWAYS pass name. * **Kind:** Write * **Permission:** `pmo:project:update` | Argument | Type | Required | Description | | ------------ | -------- | -------- | --------------------------------- | | `name` | `string` | yes | | | `color` | `string` | no | Optional hex swatch, e.g. #3b82f6 | | `sort_order` | `number` | no | | ### `create_label` Create a label * **Kind:** Write * **Permission:** `pmo:project:update` | Argument | Type | Required | Description | | -------- | -------- | -------- | ----------- | | `name` | `string` | yes | | | `color` | `string` | no | | ### `create_module` Create a module in a project * **Kind:** Write * **Permission:** `pmo:project:update` | Argument | Type | Required | Description | | ------------- | ------------------------------------------- | -------- | ----------- | | `project_id` | `string` | yes | | | `name` | `string` | yes | | | `description` | `string` | no | | | `status` | `"planned" \| "in_progress" \| "completed"` | no | | ### `create_page` Create a wiki page * **Kind:** Write * **Permission:** Checked inside the tool, with the same rules as the REST API. | Argument | Type | Required | Description | | ------------------ | --------- | -------- | ----------- | | `project_id` | `string` | no | | | `name` | `string` | yes | | | `description_html` | `string` | no | | | `access` | `integer` | no | | ### `create_project` Create a project under a company * **Kind:** Write * **Permission:** `pmo:project:create` | Argument | Type | Required | Description | | ------------- | -------- | -------- | ---------------------------------------------------------- | | `company_id` | `string` | yes | ID of the company (client/internal) the project belongs to | | `name` | `string` | yes | | | `description` | `string` | no | Solution summary | ### `create_sprint` Create a sprint in a project * **Kind:** Write * **Permission:** `pmo:project:update` | Argument | Type | Required | Description | | ------------- | --------- | -------- | ----------- | | `project_id` | `string` | yes | | | `name` | `string` | yes | | | `description` | `string` | no | | | `start_date` | `integer` | no | Epoch ms | | `end_date` | `integer` | no | Epoch ms | ### `create_state` Create a workflow state (board column) in a project * **Kind:** Write * **Permission:** `pmo:project:update` | Argument | Type | Required | Description | | ------------ | ------------------------------------------------------ | -------- | ----------- | | `project_id` | `string` | yes | | | `name` | `string` | yes | | | `group_name` | `"backlog" \| "started" \| "completed" \| "cancelled"` | no | | | `color` | `string` | no | | | `sequence` | `number` | no | | ### `create_task` Create a task in a project * **Kind:** Write * **Permission:** `pmo:task:create` | Argument | Type | Required | Description | | ------------------ | --------------------------------------------------- | -------- | --------------------------------------------------------- | | `project_id` | `string` | yes | | | `name` | `string` | yes | | | `description_html` | `string` | no | | | `priority` | `"none" \| "urgent" \| "high" \| "medium" \| "low"` | no | | | `state_id` | `string` | no | | | `label_ids` | `string[]` | no | | | `assignee_ids` | `string[]` | no | | | `is_decision` | `boolean` | no | Flag as a portfolio-level decision task | | `slim` | `boolean` | no | Return a slim identifying subset instead of the full task | ### `create_whiteboard` Create an empty whiteboard in a project * **Kind:** Write * **Permission:** `pmo:whiteboard:create` | Argument | Type | Required | Description | | ------------ | -------- | -------- | ----------- | | `project_id` | `string` | yes | | | `name` | `string` | yes | | ### `delete_comment` Soft-delete a comment on a task * **Kind:** Write * **Permission:** `pmo:task:update` | Argument | Type | Required | Description | | ------------ | -------- | -------- | ----------- | | `comment_id` | `string` | yes | | ### `delete_folder` Soft-delete a folder (projects keep their data and render under No folder). * **Kind:** Write * **Permission:** `pmo:project:update` | Argument | Type | Required | Description | | ----------- | -------- | -------- | ----------- | | `folder_id` | `string` | yes | | ### `delete_page` Soft-delete a wiki page (it disappears from lists; same as the UI’s delete) * **Kind:** Write * **Permission:** Checked inside the tool, with the same rules as the REST API. | Argument | Type | Required | Description | | --------- | -------- | -------- | ----------- | | `page_id` | `string` | yes | | ### `delete_task` Soft-delete a task * **Kind:** Write * **Permission:** `pmo:task:delete` | Argument | Type | Required | Description | | --------- | -------- | -------- | ----------- | | `task_id` | `string` | yes | | ### `draw_on_whiteboard` Draw a boxes-and-arrows diagram (flowchart, architecture, process, org chart) on a whiteboard. Give nodes and edges; the layout is computed automatically and placed below the existing content, so it never overwrites anything. Edges connect node keys from this call, or ids/keys of shapes already on the board (see get\_whiteboard). Everyone viewing the board sees the drawing appear live, and it stays fully editable. * **Kind:** Write * **Permission:** `pmo:whiteboard:update` | Argument | Type | Required | Description | | ---------------- | ------------------------------------------------------------------------ | -------- | -------------------------------------------- | | `board_id` | `string` | yes | | | `direction` | `"right" \| "down"` | no | Flow direction of the layers (default right) | | `nodes` | `object[]` | no | max 60 items | | `nodes[].key` | `string` | yes | Your handle for this node, used by edges | | `nodes[].label` | `string` | yes | Text inside the shape (max 200 chars) | | `nodes[].shape` | `"rectangle" \| "ellipse" \| "diamond"` | no | | | `nodes[].color` | `"none" \| "gray" \| "blue" \| "green" \| "yellow" \| "red" \| "violet"` | no | | | `edges` | `object[]` | no | max 120 items | | `edges[].from` | `string` | yes | | | `edges[].to` | `string` | yes | | | `edges[].label` | `string` | no | Text on the arrow (max 80 chars) | | `edges[].dashed` | `boolean` | no | | ### `get_contract` Read a contract with its lines * **Kind:** Read * **Permission:** Checked inside the tool, with the same rules as the REST API. | Argument | Type | Required | Description | | ------------- | -------- | -------- | ----------- | | `contract_id` | `string` | yes | | ### `get_contract_renewal_settings` Renewal automation for this workspace: reminder thresholds (days before a line ends; 0 = on/after the end), who gets the reminder emails (empty = workspace admins; renewal deal owners are always added), and how many days ahead a CRM renewal deal opens automatically * **Kind:** Read * **Permission:** Checked inside the tool, with the same rules as the REST API. No arguments. ### `get_module` Get a module by ID * **Kind:** Read * **Permission:** Checked inside the tool, with the same rules as the REST API. | Argument | Type | Required | Description | | ----------- | -------- | -------- | ----------- | | `module_id` | `string` | yes | | ### `get_page` Get a wiki page by ID * **Kind:** Read * **Permission:** Checked inside the tool, with the same rules as the REST API. | Argument | Type | Required | Description | | --------- | -------- | -------- | ----------- | | `page_id` | `string` | yes | | ### `get_project` Get a project by ID * **Kind:** Read * **Permission:** Checked inside the tool, with the same rules as the REST API. | Argument | Type | Required | Description | | ------------ | -------- | -------- | ----------- | | `project_id` | `string` | yes | | ### `get_sprint` Get a sprint by ID * **Kind:** Read * **Permission:** Checked inside the tool, with the same rules as the REST API. | Argument | Type | Required | Description | | ----------- | -------- | -------- | ----------- | | `sprint_id` | `string` | yes | | ### `get_sprint_progress` Get sprint completion progress (total/completed/percentage) * **Kind:** Read * **Permission:** Checked inside the tool, with the same rules as the REST API. | Argument | Type | Required | Description | | ----------- | -------- | -------- | ----------- | | `sprint_id` | `string` | yes | | ### `get_task` Get a task by ID * **Kind:** Read * **Permission:** Checked inside the tool, with the same rules as the REST API. | Argument | Type | Required | Description | | --------- | --------- | -------- | ----------------------------------------------------------------------------- | | `task_id` | `string` | yes | | | `slim` | `boolean` | no | Return a slim identifying subset (incl. project\_id) instead of the full task | ### `get_task_attachment` Get one task attachment: metadata of the latest version (name/size/type, `version`), its download `url`, and `versions`: every superseded version (newest first) with its own `url`, attributes and upload time. * **Kind:** Read * **Permission:** Checked inside the tool, with the same rules as the REST API. | Argument | Type | Required | Description | | --------------- | -------- | -------- | ------------------------------------------------------------------ | | `task_id` | `string` | yes | | | `attachment_id` | `string` | yes | Attachment id from list\_task\_attachments / add\_task\_attachment | ### `get_task_detail` Get a task with its assignees, labels, comments and activities in one response * **Kind:** Read * **Permission:** Checked inside the tool, with the same rules as the REST API. | Argument | Type | Required | Description | | --------- | -------- | -------- | ----------- | | `task_id` | `string` | yes | | ### `get_whiteboard` Read a whiteboard: its shapes (id, type, label, position, size), the connectors between them, free text, and counts of images and freehand drawings. Use the shape ids to connect new boxes to existing ones with draw\_on\_whiteboard. * **Kind:** Read * **Permission:** `pmo:whiteboard:read` | Argument | Type | Required | Description | | ---------- | -------- | -------- | ----------- | | `board_id` | `string` | yes | | ### `list_activities` List the activity trail of a task * **Kind:** Read * **Permission:** Checked inside the tool, with the same rules as the REST API. | Argument | Type | Required | Description | | --------- | -------- | -------- | ----------- | | `task_id` | `string` | yes | | ### `list_comments` List comments on a task * **Kind:** Read * **Permission:** Checked inside the tool, with the same rules as the REST API. | Argument | Type | Required | Description | | --------- | --------- | -------- | -------------------------------------------------------------------------------------- | | `task_id` | `string` | yes | | | `slim` | `boolean` | no | Return slim rows (id, task\_id, actor\_id, created\_at, access) without comment bodies | ### `list_contract_renewals` Renewal pipeline: contract lines whose term ends in \[from, to), with quantity, unit price and total, plus totals per end month. Approved and active contracts only unless statuses says otherwise. renewed = a later line already continues it. * **Kind:** Read * **Permission:** Checked inside the tool, with the same rules as the REST API. | Argument | Type | Required | Description | | ----------- | ------------------------------------------------------------------------ | -------- | ---------------------------------------------------- | | `from` | `string \| integer` | yes | Date as YYYY-MM-DD (UTC) or epoch ms; null clears it | | `to` | `string \| integer` | yes | Date as YYYY-MM-DD (UTC) or epoch ms; null clears it | | `client_id` | `string` | no | | | `statuses` | `"draft" \| "pending_approval" \| "approved" \| "active" \| "expired"[]` | no | | ### `list_contracts` List client contracts (support, retainer, subscriptions…), soonest end first, with the client’s name * **Kind:** Read * **Permission:** Checked inside the tool, with the same rules as the REST API. | Argument | Type | Required | Description | | ----------- | ------------------------------------------------------------------------------------- | -------- | ----------------------------------- | | `client_id` | `string` | no | | | `status` | `"draft" \| "pending_approval" \| "approved" \| "active" \| "expired" \| "cancelled"` | no | | | `search` | `string` | no | Matches the contract or client name | ### `list_custom_fields` List custom field definitions for a project (options parsed, not raw JSON). * **Kind:** Read * **Permission:** Checked inside the tool, with the same rules as the REST API. | Argument | Type | Required | Description | | ------------ | -------- | -------- | ----------- | | `project_id` | `string` | yes | | ### `list_decisions` List open decision tasks (is\_decision) across the tenant: the portfolio decision inbox * **Kind:** Read * **Permission:** Checked inside the tool, with the same rules as the REST API. No arguments. ### `list_folders` List project folders in the current tenant (grouping level above projects) * **Kind:** Read * **Permission:** Checked inside the tool, with the same rules as the REST API. No arguments. ### `list_labels` List tenant labels * **Kind:** Read * **Permission:** Checked inside the tool, with the same rules as the REST API. No arguments. ### `list_links` List external links on a task * **Kind:** Read * **Permission:** Checked inside the tool, with the same rules as the REST API. | Argument | Type | Required | Description | | --------- | -------- | -------- | ----------- | | `task_id` | `string` | yes | | ### `list_members` List members of a project * **Kind:** Read * **Permission:** Checked inside the tool, with the same rules as the REST API. | Argument | Type | Required | Description | | ------------ | -------- | -------- | ----------- | | `project_id` | `string` | yes | | ### `list_modules` List modules in a project * **Kind:** Read * **Permission:** Checked inside the tool, with the same rules as the REST API. | Argument | Type | Required | Description | | ------------ | -------- | -------- | ----------- | | `project_id` | `string` | yes | | ### `list_my_tasks` List tasks assigned to the calling user across every project in the tenant (the My Issues page), ordered by target date. scope=active hides completed/cancelled tasks. * **Kind:** Read * **Permission:** Checked inside the tool, with the same rules as the REST API. | Argument | Type | Required | Description | | -------- | ---------- | -------- | ------------------------------ | | `scope` | `"active"` | no | active = open tasks only | | `limit` | `integer` | no | Max rows (default 50, max 200) | ### `list_pages` List wiki pages (optionally in a project) * **Kind:** Read * **Permission:** Checked inside the tool, with the same rules as the REST API. | Argument | Type | Required | Description | | ------------ | -------- | -------- | ----------- | | `project_id` | `string` | no | | ### `list_projects` List all projects in the current tenant * **Kind:** Read * **Permission:** Checked inside the tool, with the same rules as the REST API. No arguments. ### `list_reactions` List reactions on a task * **Kind:** Read * **Permission:** Checked inside the tool, with the same rules as the REST API. | Argument | Type | Required | Description | | --------- | -------- | -------- | ----------- | | `task_id` | `string` | yes | | ### `list_relations` List relations on a task * **Kind:** Read * **Permission:** Checked inside the tool, with the same rules as the REST API. | Argument | Type | Required | Description | | --------- | -------- | -------- | ----------- | | `task_id` | `string` | yes | | ### `list_sprints` List sprints in a project * **Kind:** Read * **Permission:** Checked inside the tool, with the same rules as the REST API. | Argument | Type | Required | Description | | ------------ | -------- | -------- | ----------- | | `project_id` | `string` | yes | | ### `list_states` List workflow states for a project * **Kind:** Read * **Permission:** Checked inside the tool, with the same rules as the REST API. | Argument | Type | Required | Description | | ------------ | -------- | -------- | ----------- | | `project_id` | `string` | yes | | ### `list_subscribers` List subscribers on a task * **Kind:** Read * **Permission:** Checked inside the tool, with the same rules as the REST API. | Argument | Type | Required | Description | | --------- | -------- | -------- | ----------- | | `task_id` | `string` | yes | | ### `list_task_attachments` List a task’s attachments (R2-backed evidence files or SharePoint files: see `storage`/`web_url`), newest first, with serve URLs and parsed attributes. Each row is the LATEST version (`version`, `asset`, `url`); `versions` lists the superseded versions newest first, each with its own `url`. * **Kind:** Read * **Permission:** Checked inside the tool, with the same rules as the REST API. | Argument | Type | Required | Description | | --------- | -------- | -------- | ----------- | | `task_id` | `string` | yes | | ### `list_tasks` List tasks (optionally in a project), newest first * **Kind:** Read * **Permission:** Checked inside the tool, with the same rules as the REST API. | Argument | Type | Required | Description | | ------------ | ---------- | -------- | --------------------------------------------------------------------------------------- | | `project_id` | `string` | no | | | `state` | `string` | no | Filter by state ID | | `limit` | `integer` | no | | | `offset` | `integer` | no | | | `slim` | `boolean` | no | Return slim rows (id, sequence\_id, name, state\_id, priority) instead of full tasks | | `include` | `string[]` | no | With slim:true, fields to carry back in, e.g. \[“description”] (truncated at 500 chars) | ### `list_whiteboards` List the whiteboards (Excalidraw boards) of a project, most recently edited first * **Kind:** Read * **Permission:** `pmo:whiteboard:read` | Argument | Type | Required | Description | | ------------ | -------- | -------- | ----------- | | `project_id` | `string` | yes | | ### `list_workspace_members` List all users in the current tenant * **Kind:** Read * **Permission:** Checked inside the tool, with the same rules as the REST API. No arguments. ### `remove_assignee` Remove a user from a task’s assignees (soft-delete the assignment) * **Kind:** Write * **Permission:** `pmo:task:update` | Argument | Type | Required | Description | | ------------- | -------- | -------- | -------------------------------- | | `task_id` | `string` | yes | | | `assignee_id` | `string` | yes | user\_profile.id of the assignee | ### `remove_contract_line` Remove a line from a contract * **Kind:** Write * **Permission:** `pmo:project:update` | Argument | Type | Required | Description | | ------------- | -------- | -------- | ----------- | | `contract_id` | `string` | yes | | | `line_id` | `string` | yes | | ### `remove_link` Remove a link from a task * **Kind:** Write * **Permission:** `pmo:task:update` | Argument | Type | Required | Description | | --------- | -------- | -------- | ----------- | | `task_id` | `string` | yes | | | `link_id` | `string` | yes | | ### `remove_reaction` Remove your own reaction from a task * **Kind:** Write * **Permission:** `pmo:task:update` | Argument | Type | Required | Description | | ------------- | -------- | -------- | ----------- | | `task_id` | `string` | yes | | | `reaction_id` | `string` | yes | | ### `remove_relation` Remove a relation by ID * **Kind:** Write * **Permission:** `pmo:task:update` | Argument | Type | Required | Description | | ------------- | -------- | -------- | ----------- | | `relation_id` | `string` | yes | | ### `remove_subscriber` Remove a subscriber from a task * **Kind:** Write * **Permission:** `pmo:task:update` | Argument | Type | Required | Description | | --------- | -------- | -------- | -------------------------------------------- | | `task_id` | `string` | yes | | | `user_id` | `string` | yes | user\_profile.id of the subscriber to remove | ### `remove_task_attachment` Remove an attachment from a task (soft delete, same as the UI’s remove). The stored file and its version history are kept; a SharePoint file is never deleted. * **Kind:** Write * **Permission:** `pmo:task:update` | Argument | Type | Required | Description | | --------------- | -------- | -------- | ------------------------------------------------------------------ | | `task_id` | `string` | yes | | | `attachment_id` | `string` | yes | Attachment id from list\_task\_attachments / add\_task\_attachment | ### `remove_task_from_module` Remove a task from a module * **Kind:** Write * **Permission:** `pmo:project:update` | Argument | Type | Required | Description | | ----------- | -------- | -------- | ----------- | | `module_id` | `string` | yes | | | `task_id` | `string` | yes | | ### `remove_task_from_sprint` Remove a task from a sprint * **Kind:** Write * **Permission:** `pmo:project:update` | Argument | Type | Required | Description | | ----------- | -------- | -------- | ----------- | | `sprint_id` | `string` | yes | | | `task_id` | `string` | yes | | ### `replace_task_attachment` Upload a new VERSION of an existing task attachment instead of adding a new one. Upload the bytes FIRST via multipart POST /api/uploads, then pass the returned id (R2 key, must be from your own tenant) as `asset`. The attachment id stays stable; list/get/URL show the new version, the previous one is kept in `versions` (its file is never deleted). On a SharePoint attachment the uploaded bytes are copied into SharePoint as a new SharePoint version (the R2 object is only a transport). If `name` is omitted the previous file name is kept; size/type are not inherited. Logs an activity entry on the task. * **Kind:** Write * **Permission:** `pmo:task:update` | Argument | Type | Required | Description | | --------------- | -------- | -------- | --------------------------------------------------- | | `task_id` | `string` | yes | | | `attachment_id` | `string` | yes | | | `asset` | `string` | yes | R2 key: the id returned by POST /api/uploads | | `name` | `string` | no | File name (defaults to the previous version’s name) | | `size` | `number` | no | File size in bytes | | `type` | `string` | no | MIME type (e.g. application/pdf) | ### `search_tasks` Search tasks by name/description or task key (29, #29, ABC-29) across the tenant * **Kind:** Read * **Permission:** Checked inside the tool, with the same rules as the REST API. | Argument | Type | Required | Description | | --------- | ---------- | -------- | --------------------------------------------------------------------------------------- | | `query` | `string` | yes | | | `limit` | `integer` | no | | | `slim` | `boolean` | no | Return slim rows (id, sequence\_id, name, state\_id, priority) instead of full tasks | | `include` | `string[]` | no | With slim:true, fields to carry back in, e.g. \[“description”] (truncated at 500 chars) | ### `set_assignee` Assign (or re-assign) a user to a task. If the assignment already exists it is a no-op * **Kind:** Write * **Permission:** `pmo:task:update` | Argument | Type | Required | Description | | ------------- | -------- | -------- | -------------------------------- | | `task_id` | `string` | yes | | | `assignee_id` | `string` | yes | user\_profile.id of the assignee | ### `set_contract_renewal_settings` Change renewal automation. Recipients by user id or by email (people in this workspace); omit a field to keep it. * **Kind:** Write * **Permission:** `pmo:project:update` | Argument | Type | Required | Description | | --------------------- | ----------- | -------- | -------------------- | | `reminders_enabled` | `boolean` | no | | | `lead_days` | `integer[]` | no | e.g. \[90,60,30,7,0] | | `recipient_user_ids` | `string[]` | no | | | `recipient_emails` | `string[]` | no | | | `auto_deal_enabled` | `boolean` | no | | | `auto_deal_lead_days` | `integer` | no | | ### `set_contract_status` Move a contract along draft → pending\_approval → approved → active → expired; cancelled from draft/pending/approved/active; pending\_approval → draft rejects it * **Kind:** Write * **Permission:** `pmo:project:update` | Argument | Type | Required | Description | | ----------------- | ------------------------------------------------------------------------------------- | -------- | ----------- | | `contract_id` | `string` | yes | | | `status` | `"draft" \| "pending_approval" \| "approved" \| "active" \| "expired" \| "cancelled"` | yes | | | `rejected_reason` | `string` | no | | ### `set_project_folder` Move a project into a folder (or out: pass folder\_id null). * **Kind:** Write * **Permission:** `pmo:project:update` | Argument | Type | Required | Description | | ------------ | ---------------- | -------- | ------------------------------------- | | `project_id` | `string` | yes | | | `folder_id` | `string \| null` | no | Target folder UUID, or null to remove | ### `set_task_custom_value` Set one custom field value on a task. Pass null to clear. Type-checked against the definition. * **Kind:** Write * **Permission:** `pmo:task:update` | Argument | Type | Required | Description | | ----------------- | ---------------- | -------- | ------------------------- | | `task_id` | `string` | yes | | | `custom_field_id` | `string` | yes | | | `value` | `string \| null` | no | String value; null clears | ### `update_comment` Update a comment’s HTML and/or stripped text * **Kind:** Write * **Permission:** `pmo:task:update` | Argument | Type | Required | Description | | ------------------ | --------- | -------- | ------------------------------------------------------------------ | | `comment_id` | `string` | yes | | | `comment_html` | `string` | no | | | `comment_stripped` | `string` | no | | | `slim` | `boolean` | no | Return a slim identifying comment instead of the full comment body | ### `update_contract` Change a contract’s name, type, dates, currency, amount or auto-renew * **Kind:** Write * **Permission:** `pmo:project:update` | Argument | Type | Required | Description | | -------------- | ------------------------------------------------------------------------------------------------------------------ | -------- | ---------------------------------------------------- | | `contract_id` | `string` | yes | | | `name` | `string` | no | | | `type` | `"retainer" \| "annual_support" \| "implementation" \| "change_request" \| "presales" \| "internal" \| "training"` | no | | | `start_date` | `string \| integer` | no | Date as YYYY-MM-DD (UTC) or epoch ms; null clears it | | `end_date` | `string \| integer` | no | Date as YYYY-MM-DD (UTC) or epoch ms; null clears it | | `currency` | `string` | no | | | `amount_cents` | `integer` | no | | | `auto_renew` | `boolean` | no | | ### `update_contract_line` Change a contract line * **Kind:** Write * **Permission:** `pmo:project:update` | Argument | Type | Required | Description | | ------------------ | ------------------------------------- | -------- | ----------------------------------------------------------------------------------------------- | | `contract_id` | `string` | yes | | | `line_id` | `string` | yes | | | `name` | `string` | no | What is sold, e.g. “Device subscription” | | `description` | `string` | no | | | `quantity` | `number` | no | Units, e.g. 20 devices | | `unit_label` | `string` | no | Unit name, e.g. “device”, “user” | | `unit_price_cents` | `integer` | no | Price per unit per billing period in cents of the contract currency (IDR 2.535.000 = 253500000) | | `billing_period` | `"one_time" \| "monthly" \| "annual"` | no | Default annual | | `start_date` | `string \| integer` | no | Date as YYYY-MM-DD (UTC) or epoch ms; null clears it | | `end_date` | `string \| integer` | no | Date as YYYY-MM-DD (UTC) or epoch ms; null clears it. Omit to use the contract’s end date | | `renews_line_id` | `string` | no | The line on an earlier contract this line continues (marks it renewed) | ### `update_folder` Update a project folder (name/color/sort\_order). * **Kind:** Write * **Permission:** `pmo:project:update` | Argument | Type | Required | Description | | ------------ | -------- | -------- | ----------- | | `folder_id` | `string` | yes | | | `name` | `string` | no | | | `color` | `string` | no | | | `sort_order` | `number` | no | | ### `update_module` Update a module (partial: only provided fields change) * **Kind:** Write * **Permission:** `pmo:project:update` | Argument | Type | Required | Description | | ------------- | ------------------------------------------- | -------- | ----------- | | `module_id` | `string` | yes | | | `name` | `string` | no | | | `description` | `string` | no | | | `status` | `"planned" \| "in_progress" \| "completed"` | no | | | `start_date` | `integer` | no | Epoch ms | | `target_date` | `integer` | no | Epoch ms | ### `update_page` Update a wiki page (name/description/access) * **Kind:** Write * **Permission:** Checked inside the tool, with the same rules as the REST API. | Argument | Type | Required | Description | | ------------------ | --------- | -------- | ----------- | | `page_id` | `string` | yes | | | `name` | `string` | no | | | `description_html` | `string` | no | | | `access` | `integer` | no | | ### `update_sprint` Update a sprint (name/description/dates) * **Kind:** Write * **Permission:** `pmo:project:update` | Argument | Type | Required | Description | | ------------- | --------- | -------- | ----------- | | `sprint_id` | `string` | yes | | | `name` | `string` | no | | | `description` | `string` | no | | | `start_date` | `integer` | no | Epoch ms | | `end_date` | `integer` | no | Epoch ms | ### `update_task` Update a task (name/description/priority/state/dates/estimate) * **Kind:** Write * **Permission:** `pmo:task:update` | Argument | Type | Required | Description | | ------------------ | --------------------------------------------------- | -------- | --------------------------------------------------------- | | `task_id` | `string` | yes | | | `name` | `string` | no | | | `description_html` | `string` | no | | | `priority` | `"none" \| "urgent" \| "high" \| "medium" \| "low"` | no | | | `state_id` | `string` | no | | | `start_date` | `integer` | no | Epoch ms | | `target_date` | `integer` | no | Epoch ms | | `estimate_points` | `integer` | no | | | `is_decision` | `boolean` | no | Flag/unflag as a portfolio-level decision task | | `slim` | `boolean` | no | Return a slim identifying subset instead of the full task | ## CRM ### `create_contact` Create a CRM lead/contact * **Kind:** Write * **Permission:** `crm:record:write` | Argument | Type | Required | Description | | --------- | --------------------------------- | -------- | ----------- | | `email` | `string` | yes | | | `name` | `string` | no | | | `company` | `string` | no | | | `phone` | `string` | no | | | `source` | `string` | no | | | `status` | `"lead" \| "active" \| "churned"` | no | | ### `create_deal` Create a CRM deal * **Kind:** Write * **Permission:** `crm:record:write` | Argument | Type | Required | Description | | ------------------- | --------------------------------------------------------------------------------------- | -------- | --------------------------------------- | | `name` | `string` | yes | min length 1, max length 200 | | `contact_id` | `string` | no | | | `company_id` | `string \| null` | no | | | `project_id` | `string` | no | | | `notes` | `string \| null` | no | max length 5000 | | `amount_cents` | `integer` | no | | | `currency` | `string` | no | | | `stage` | `"lead" \| "qualified" \| "demo_poc" \| "proposal" \| "negotiation" \| "won" \| "lost"` | no | | | `win_probability` | `integer` | no | Override % 0-100 (null = stage default) | | `lost_reason` | `"price" \| "scope" \| "no_budget" \| "competitor" \| "stalled"` | no | | | `competitor_name` | `string` | no | | | `expected_close_at` | `integer` | no | Epoch ms | | `sales_owner_id` | `string` | no | Active sales owner id (deal owner) | ### `get_contact` Get a CRM contact by ID * **Kind:** Read * **Permission:** `crm:record:read` | Argument | Type | Required | Description | | ------------ | -------- | -------- | ----------- | | `contact_id` | `string` | yes | | ### `get_deal` Get a CRM deal by ID * **Kind:** Read * **Permission:** `crm:record:read` | Argument | Type | Required | Description | | --------- | -------- | -------- | ----------- | | `deal_id` | `string` | yes | | ### `list_contacts` List CRM contacts in the tenant * **Kind:** Read * **Permission:** `crm:record:read` | Argument | Type | Required | Description | | -------- | --------- | -------- | ----------- | | `limit` | `integer` | no | | | `offset` | `integer` | no | | ### `list_deals` List CRM deals in the tenant (by pipeline stage) * **Kind:** Read * **Permission:** `crm:record:read` | Argument | Type | Required | Description | | -------- | --------- | -------- | ----------- | | `limit` | `integer` | no | | | `offset` | `integer` | no | | ### `list_facts` List evidence facts for a contact or company * **Kind:** Read * **Permission:** `crm:record:read` | Argument | Type | Required | Description | | ------------ | -------------------------------------------------------- | -------- | ----------- | | `contact_id` | `string` | no | | | `company_id` | `string` | no | | | `status` | `"PROPOSED" \| "APPLIED" \| "DISMISSED" \| "SUPERSEDED"` | no | | | `limit` | `integer` | no | | | `offset` | `integer` | no | | ### `move_deal_stage` Move a deal to a new pipeline stage (stamps stage\_sort + closed\_at; lost requires lost\_reason) * **Kind:** Write * **Permission:** `crm:record:write` | Argument | Type | Required | Description | | ----------------- | --------------------------------------------------------------------------------------- | -------- | --------------------------- | | `deal_id` | `string` | yes | | | `stage` | `"lead" \| "qualified" \| "demo_poc" \| "proposal" \| "negotiation" \| "won" \| "lost"` | yes | | | `lost_reason` | `"price" \| "scope" \| "no_budget" \| "competitor" \| "stalled"` | no | Required when stage is lost | | `competitor_name` | `string` | no | | ### `record_fact` Record an evidence-led fact about a contact or company. Strong evidence (score >= 1.0 across independent sources) auto-applies to the record; weaker evidence is stored as a PROPOSED suggestion a human can apply/dismiss. Never write contact fields directly: use this. * **Kind:** Write * **Permission:** `crm:record:write` | Argument | Type | Required | Description | | ------------------- | ------------------------------------------------------------------------------------ | -------- | ------------------------------------------------------------------------------------------------------------------------- | | `contact_id` | `string` | no | | | `company_id` | `string` | no | | | `field` | `string` | yes | Allowlisted field: contact → name\|title\|phone\|company\|address; company → name\|website\|domain\|industry\|description | | `value` | `string` | yes | | | `evidence` | `object[]` | yes | | | `evidence[].source` | `string` | yes | | | `evidence[].method` | `"signature" \| "email_thread" \| "social" \| "web_search" \| "manual" \| "unknown"` | yes | | | `evidence[].url` | `string` | no | | | `method` | `string` | no | | | `source_url` | `string` | no | | | `observed_at` | `integer` | no | Epoch ms | ### `update_contact` Update a CRM contact * **Kind:** Write * **Permission:** `crm:record:write` | Argument | Type | Required | Description | | ------------ | --------------------------------- | -------- | ----------- | | `contact_id` | `string` | yes | | | `email` | `string` | no | | | `name` | `string` | no | | | `company` | `string` | no | | | `phone` | `string` | no | | | `status` | `"lead" \| "active" \| "churned"` | no | | | `source` | `string` | no | | ### `update_deal` Update a CRM deal (amount/stage/close/name) * **Kind:** Write * **Permission:** `crm:record:write` | Argument | Type | Required | Description | | ------------------- | --------------------------------------------------------------------------------------- | -------- | ------------------------------------------ | | `deal_id` | `string` | yes | | | `name` | `string` | no | min length 1, max length 200 | | `company_id` | `string \| null` | no | | | `notes` | `string \| null` | no | max length 5000 | | `amount_cents` | `integer` | no | | | `currency` | `string` | no | | | `stage` | `"lead" \| "qualified" \| "demo_poc" \| "proposal" \| "negotiation" \| "won" \| "lost"` | no | | | `win_probability` | `integer` | no | Override % 0-100 (null = stage default) | | `lost_reason` | `"price" \| "scope" \| "no_budget" \| "competitor" \| "stalled"` | no | | | `competitor_name` | `string` | no | | | `expected_close_at` | `integer` | no | Epoch ms | | `sales_owner_id` | `string \| null` | no | Sales owner id to assign (null = unassign) | ## Timesheets ### `approve_timesheet` Approve pending time: a member’s whole week (week\_id from list\_pending\_timesheet\_approvals) or specific entry\_ids. Same rules as the Approvals page: needs timesheets:approvals:approve, never your own time, lead/PM roles only on assigned projects; entries that cannot be reviewed are returned under skipped with a reason. * **Kind:** Write * **Permission:** `timesheets:approvals:approve` | Argument | Type | Required | Description | | ----------- | ---------- | -------- | ----------------------- | | `week_id` | `string` | no | ‘\:’ | | `entry_ids` | `string[]` | no | Specific time entry ids | ### `create_time_entry` Log time on a task. Either pass duration\_seconds (positive multiple of 60) with an optional date (YYYY-MM-DD), or pass started\_at/ended\_at (epoch ms) for an exact clock slot: with started\_at+ended\_at the span defines the duration, with started\_at+duration\_seconds ended\_at is derived. The entry is created as the calling user, status pending. AI agents logging their own work MUST pass source=‘agent’ plus agent\_name, model, and the token counts (input/output/cache\_read/cache\_write/reasoning): omit unknown token fields rather than guess. Agent entries default billable=false and are excluded from human timesheet cost reports. * **Kind:** Write * **Permission:** `timesheets:entry:create` | Argument | Type | Required | Description | | -------------------- | --------- | -------- | --------------------------------------------------------------------------------------------------------------- | | `task_id` | `string` | yes | Task to log time against | | `duration_seconds` | `number` | no | Seconds spent; positive, multiple of 60 (whole minutes). Required unless started\_at+ended\_at are both given | | `date` | `string` | no | Work date (YYYY-MM-DD); defaults to today. Mutually exclusive with started\_at/ended\_at | | `started_at` | `number` | no | Optional: block start (epoch ms). Pair with ended\_at (span = duration) or with duration\_seconds (end derived) | | `ended_at` | `number` | no | Optional: block end (epoch ms); requires started\_at | | `description` | `string` | no | What was done (max 4000 chars) | | `billable` | `boolean` | no | Billable flag; defaults to true (false for agent entries) | | `source` | `"agent"` | no | AI-agent telemetry marker; omit entirely for normal manual logging | | `agent_name` | `string` | no | Required when source is “agent”: harness/agent identity (e.g. “omp/firstmate”) | | `model` | `string` | no | Model id exactly as reported by the harness (e.g. zai/glm-5.3-flash) | | `input_tokens` | `number` | no | Input tokens (billing bucket) | | `output_tokens` | `number` | no | Output tokens (billing bucket) | | `cache_read_tokens` | `number` | no | Cache-read tokens | | `cache_write_tokens` | `number` | no | Cache-write tokens | | `reasoning_tokens` | `number` | no | Reasoning tokens (billed as output) | ### `delete_time_entry` Soft-delete a time entry. Your own entries, or anyone’s with timesheets:entry:delete\_others; running and finalized (approved/invoiced) entries cannot be deleted. * **Kind:** Write * **Permission:** `timesheets:entry:delete_own` or `timesheets:entry:delete_others` | Argument | Type | Required | Description | | -------- | -------- | -------- | ------------- | | `id` | `string` | yes | Time entry id | ### `get_agent_usage` Agent bookkeeping KPI (Atur parity): roll up agent-attributed time entries by agent, model, and task with token totals and USD cost via the global model\_prices rate card. Unpriced models return cost\_usd: null: never $0. Human timesheet reports exclude agent entries. Needs timesheets:report:read\_others. * **Kind:** Read * **Permission:** `timesheets:report:read_others` | Argument | Type | Required | Description | | ------------ | -------- | -------- | ------------------------------------ | | `from` | `string` | no | Window start (YYYY-MM-DD, inclusive) | | `to` | `string` | no | Window end (YYYY-MM-DD, inclusive) | | `project_id` | `string` | no | Filter to one project | ### `list_my_time_entries` List the calling user’s time entries in a date range, including UI/timer-created entries with no task link (list\_time\_entries only sees task-linked rows). Newest first. Pass user\_id to read someone else’s entries (needs timesheets:entry:read\_others). list\_time\_entries shows only your own rows without that code. * **Kind:** Read * **Permission:** `timesheets:entry:read_own` or `timesheets:entry:read_others` | Argument | Type | Required | Description | | ------------ | -------- | -------- | --------------------------------------------------------------------------- | | `from` | `string` | yes | Range start (YYYY-MM-DD, inclusive) | | `to` | `string` | yes | Range end (YYYY-MM-DD, inclusive) | | `user_id` | `string` | no | Optional: read another user’s entries (needs timesheets:entry:read\_others) | | `project_id` | `string` | no | Filter to one project | | `limit` | `number` | no | Max entries to return (default 200, max 500) | ### `list_pending_timesheet_approvals` The approver’s queue: pending time grouped by member and week (week\_id = ‘\:’), oldest week first. Only time the caller may review is listed: never their own, and for lead/PM roles only projects they are assigned to. Needs timesheets:approvals:approve. Feed week\_id (or entry\_ids) to approve\_timesheet / reject\_timesheet. * **Kind:** Read * **Permission:** `timesheets:approvals:approve` | Argument | Type | Required | Description | | -------- | -------- | -------- | ----------------------------------------- | | `limit` | `number` | no | Max weeks to return (default 50, max 200) | ### `list_time_entries` List time entries logged against a task, newest first. * **Kind:** Read * **Permission:** `timesheets:entry:read_own` or `timesheets:entry:read_others` | Argument | Type | Required | Description | | --------- | -------- | -------- | ------------------------------------------- | | `task_id` | `string` | yes | | | `limit` | `number` | no | Max entries to return (default 50, max 200) | ### `reject_timesheet` Reject pending time with a required reason (shown to the member, who edits and resubmits). Targets a week\_id or entry\_ids; same permission and scope rules as approve\_timesheet. * **Kind:** Write * **Permission:** `timesheets:approvals:approve` | Argument | Type | Required | Description | | ----------- | ---------- | -------- | --------------------------------------- | | `week_id` | `string` | no | ‘\:’ | | `entry_ids` | `string[]` | no | Specific time entry ids | | `reason` | `string` | yes | Why the time is rejected (1-1000 chars) | ### `update_time_entry` Edit a time entry (your own, or anyone’s with timesheets:entry:update\_others). Pass only the fields to change. Clock fields (epoch ms) derive omitted siblings from the entry’s current duration: started\_at alone moves the block, ended\_at alone shifts its start, duration\_minutes alone resizes it from the current start. Running and finalized entries (approved on approval-flow projects, invoiced everywhere) are rejected, as are entries outside the editable policy window. Editing a rejected entry resubmits it (pending, or approved on flag-less projects). * **Kind:** Write * **Permission:** `timesheets:entry:update_own` or `timesheets:entry:update_others` | Argument | Type | Required | Description | | ------------------ | ---------------- | -------- | ------------------------------------------- | | `id` | `string` | yes | Time entry id | | `description` | `string \| null` | no | What was done (max 4000 chars); null clears | | `started_at` | `number` | no | Block start (epoch ms) | | `ended_at` | `number` | no | Block end (epoch ms) | | `duration_minutes` | `number` | no | Whole minutes; positive integer | | `billable` | `boolean` | no | Billable flag | ## Helpdesk ### `add_ticket_comment` Post a reply or internal note on a ticket. internal=true posts a staff-only internal note (requires internal-staff access; never send for customer-facing replies). Staff may pass status\_purpose to move the ticket with the reply (e.g. RESOLVED). Notifies requester/assignee and fans out to CC’d collaborators on public replies. A staff public reply carries the author’s email signature, and any /api/files/ links of this workspace in the body are attached to the client email (links instead when over the mail size limit). * **Kind:** Write * **Permission:** Checked inside the tool, with the same rules as the REST API. | Argument | Type | Required | Description | | ---------------- | --------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | | `ticket_id` | `string` | yes | Ticket id (from list\_tickets/get\_ticket). | | `body` | `string` | yes | Comment text (1-20000 chars). | | `internal` | `boolean` | no | Post as internal staff note instead of a public reply (default false). | | `status_purpose` | `string` | no | Staff-only: move the ticket after the reply. Pass a Status Workflow status code (e.g. RESOLVED, or any custom code configured in this workspace). | ### `assign_ticket` Assign (or unassign with assignee\_id=null) a ticket to a workspace user. Requires the helpdesk:ticket:assign permission; the assignee must be a tenant member and the ticket’s AI triage must be settled (use the override flow in the UI otherwise). * **Kind:** Write * **Permission:** Checked inside the tool, with the same rules as the REST API. | Argument | Type | Required | Description | | ------------- | -------- | -------- | ----------------------------------------------- | | `ticket_id` | `string` | yes | Ticket id (from list\_tickets/get\_ticket). | | `assignee_id` | `string` | yes | User profile id to assign, or null to unassign. | ### `create_ticket` Create a support ticket on behalf of the caller (requester = caller). Needs either project\_id or product\_id (ids from the workspace’s projects/products); title (3-200 chars) and body required. Sets priority/category masters, initial workflow status and SLA, notifies staff, and runs the same triage and ticket\_created automation rules (receipt email, CC copies) as the web form. * **Kind:** Write * **Permission:** Checked inside the tool, with the same rules as the REST API. | Argument | Type | Required | Description | | ------------- | ----------------------------------------- | -------- | ------------------------------------------------------------------------ | | `title` | `string` | yes | Ticket title (3-200 chars). | | `body` | `string` | yes | Ticket description (supports HTML, 1-20000 chars). | | `project_id` | `string` | no | Existing project id (takes precedence over product\_id). | | `product_id` | `string` | no | Product master id; the ‘ ’ project is found-or-created. | | `company_id` | `string` | no | Customer company id (staff callers only on the product path). | | `priority_id` | `string` | no | Ticket Priority master id (optional). | | `category_id` | `string` | no | Ticket Category master id (optional; defaults to the workspace default). | | `priority` | `"low" \| "normal" \| "high" \| "urgent"` | no | Fallback legacy priority when no priority\_id (default normal). | | `module` | `string` | no | Module name (free text, ≤80 chars). | ### `get_kb_article` Get one knowledge-base document by id, including its indexed source text when stored inline. Use after list\_kb\_articles to read an article. * **Kind:** Read * **Permission:** Checked inside the tool, with the same rules as the REST API. | Argument | Type | Required | Description | | ------------ | -------- | -------- | ----------------------------------------- | | `article_id` | `string` | yes | KB document id (from list\_kb\_articles). | ### `get_ticket` Get one support ticket by id with its recent thread (comments, internal notes for staff viewers, status changes). Use after list\_tickets to read the full conversation before replying or updating. Internal notes are hidden from non-staff viewers. * **Kind:** Read * **Permission:** Checked inside the tool, with the same rules as the REST API. | Argument | Type | Required | Description | | -------------- | -------- | -------- | -------------------------------------------------- | | `ticket_id` | `string` | yes | Ticket id (from list\_tickets). | | `thread_limit` | `number` | no | Max thread events to return (default 20, max 100). | ### `list_kb_articles` List knowledge-base documents in the tenant (source name, product, module, status). Use to browse KB content ids. * **Kind:** Read * **Permission:** Checked inside the tool, with the same rules as the REST API. | Argument | Type | Required | Description | | -------- | -------- | -------- | --------------------------------------------------- | | `search` | `string` | no | Optional text filter on source name/module/version. | | `limit` | `number` | no | Max results to return (default 20, max 100). | ### `list_ticket_statuses` List the workspace’s ticket workflow statuses (ids, codes, categories). Call before create\_ticket/update flows to obtain valid status master ids and to understand the lifecycle. * **Kind:** Read * **Permission:** Checked inside the tool, with the same rules as the REST API. No arguments. ### `list_tickets` List support tickets in the tenant, scoped to the caller’s visibility (requesters see only their own + looped-in tickets, consultants their assigned/group tickets, staff see all). Use to find ticket ids, check status/priority/SLA or browse a workload. Filters: status/priority legacy text or master ids, assignee, requester, company (staff only), free-text search, open-only. * **Kind:** Read * **Permission:** Checked inside the tool, with the same rules as the REST API. | Argument | Type | Required | Description | | -------------- | ---------- | -------- | -------------------------------------------------------- | | `status` | `string` | no | Legacy status text filter (e.g. ‘new’, ‘in\_progress’). | | `status_ids` | `string[]` | no | Ticket Status master ids (from list\_ticket\_statuses). | | `priority` | `string` | no | Legacy priority text filter (low\|normal\|high\|urgent). | | `priority_ids` | `string[]` | no | Ticket Priority master ids. | | `assignee_id` | `string` | no | Filter by assignee user id. | | `requester_id` | `string` | no | Filter by requester user id (staff callers only). | | `company_id` | `string` | no | Filter by customer company id (managers/admins only). | | `search` | `string` | no | Free-text search over ticket number/title/body fields. | | `open` | `boolean` | no | Only tickets not in a final status. | | `limit` | `number` | no | Max results to return (default 20, max 100). | ### `search_kb` Search knowledge-base documents by keyword (matches source name, module, Epicor version and inline text). Use to find documentation that may answer a customer question. * **Kind:** Read * **Permission:** Checked inside the tool, with the same rules as the REST API. | Argument | Type | Required | Description | | -------- | -------- | -------- | -------------------------------------------- | | `query` | `string` | yes | Search text. | | `limit` | `number` | no | Max results to return (default 20, max 100). | ### `update_ticket` Update a ticket’s Priority, Category, Product or Module (the same fields the web header edit allows; use add\_ticket\_comment for replies and assign\_ticket for assignment). Requires the helpdesk:ticket:work permission. Logs a fields-updated history entry. * **Kind:** Write * **Permission:** Checked inside the tool, with the same rules as the REST API. | Argument | Type | Required | Description | | ------------- | -------- | -------- | ------------------------------------------- | | `ticket_id` | `string` | yes | Ticket id (from list\_tickets/get\_ticket). | | `priority_id` | `string` | no | New Ticket Priority master id. | | `category_id` | `string` | no | New Ticket Category master id. | | `product_id` | `string` | no | New product master id, or null to clear. | | `module` | `string` | no | New module text, or null to clear. | ## Expenses ### `approve_expense` Approve a pending expense (pending → approved): requires the expenses approval permission and, for lead/PM roles, an active grant on the expense’s project. Optional comment is recorded on the audit timeline. Expenses linked to a submission are decided via the submission instead. * **Kind:** Write * **Permission:** Checked inside the tool, with the same rules as the REST API. | Argument | Type | Required | Description | | ------------ | -------- | -------- | --------------------------------------------------- | | `expense_id` | `string` | yes | Expense id (from list\_pending\_expense\_approvals) | | `comment` | `string` | no | Optional reviewer note (max 1000) | ### `create_expense` Create a draft expense document as the calling user (no file upload / OCR: pass the known fields). It stays draft until submit\_expense. Vendor, amounts in minor units (cents), currency (default USD), category, and an optional in-tenant project\_id. Optionally attach line items (description/qty/unitAmountCents/amountCents/taxCents/glCode). * **Kind:** Write * **Permission:** Checked inside the tool, with the same rules as the REST API. | Argument | Type | Required | Description | | ------------------------- | ---------------------------------------------------------- | -------- | --------------------------------------------------- | | `vendor_name` | `string` | no | Vendor/merchant name (max 200) | | `vendor_tax_id` | `string` | no | Vendor tax id (max 60) | | `invoice_number` | `string` | no | Invoice/reference number (max 120) | | `document_kind` | `"invoice" \| "receipt" \| "nota" \| "billing" \| "other"` | no | Document kind; default ‘other’ | | `issued_at` | `number` | no | Document date (epoch ms) | | `currency` | `string` | no | ISO code, default USD (max 8 chars) | | `subtotal_cents` | `number` | no | Subtotal in minor units | | `tax_cents` | `number` | no | Tax in minor units | | `total_cents` | `number` | no | Total in minor units | | `category` | `string` | no | One of list\_expense\_categories (max 120) | | `project_id` | `string` | no | In-tenant project for cost attribution | | `subject_type` | `"ticket" \| "task"` | no | Optional work-item link type | | `subject_id` | `string` | no | Work-item id (required with subject\_type) | | `lines` | `object[]` | no | Optional line items (replaces nothing: initial set) | | `lines[].description` | `string` | no | | | `lines[].qty` | `number` | no | | | `lines[].unitAmountCents` | `number` | no | | | `lines[].amountCents` | `number` | no | | | `lines[].taxCents` | `number` | no | | | `lines[].glCode` | `string` | no | | ### `delete_expense` Soft-delete a draft expense (drafts only: anything submitted/approved/paid is a record and stays; expenses in a submission leave via the submission instead). No restore tool: recreate if needed. * **Kind:** Write * **Permission:** Checked inside the tool, with the same rules as the REST API. | Argument | Type | Required | Description | | ------------ | -------- | -------- | -------------------------------- | | `expense_id` | `string` | yes | Expense id (from list\_expenses) | ### `get_expense` Get one expense document by id: vendor, totals, currency, category, status, submission link, rejection reason, plus its line items. Use after list\_expenses to inspect details before a decision. * **Kind:** Read * **Permission:** Checked inside the tool, with the same rules as the REST API. | Argument | Type | Required | Description | | ------------ | -------- | -------- | -------------------------------- | | `expense_id` | `string` | yes | Expense id (from list\_expenses) | ### `list_expense_categories` Reference data for filling expense write arguments: the canonical expense categories, and the tenant’s expense-eligible projects (id + name + currency-independent: pass project\_id on create\_expense). Call when unsure which category/project values are valid. * **Kind:** Read * **Permission:** Checked inside the tool, with the same rules as the REST API. No arguments. ### `list_expenses` List expense documents in the caller’s tenant (read scope: own filings plus actively assigned projects for consultant/lead/PM roles; tenant-wide for admin). Use for ‘my expenses’, ‘what did X spend’, or finding an expense id before get\_expense / submit\_expense. Filter by status (draft|pending|approved|rejected|paid), date range on the document date, category, or project\_id. * **Kind:** Read * **Permission:** Checked inside the tool, with the same rules as the REST API. | Argument | Type | Required | Description | | ------------- | ------------------------------------------------------------ | -------- | ---------------------------------------------------- | | `mine` | `boolean` | no | Only the caller’s own expenses | | `status` | `"draft" \| "pending" \| "approved" \| "rejected" \| "paid"` | no | Workflow status filter | | `issued_from` | `number` | no | Document date from (epoch ms, inclusive) | | `issued_to` | `number` | no | Document date to (epoch ms, inclusive) | | `category` | `string` | no | Exact category match (see list\_expense\_categories) | | `project_id` | `string` | no | Project attribution filter | | `limit` | `number` | no | Max rows (default 20, max 100), newest first | ### `list_pending_expense_approvals` The approver’s queue: pending expenses awaiting a decision, scoped to the caller’s assigned projects (tenant-wide for admin). Requires the expenses approval permission. Use before approve\_expense/reject\_expense. * **Kind:** Read * **Permission:** Checked inside the tool, with the same rules as the REST API. | Argument | Type | Required | Description | | ------------ | -------- | -------- | -------------------------------------------- | | `project_id` | `string` | no | Narrow to one assigned project | | `limit` | `number` | no | Max rows (default 20, max 100), oldest first | ### `reject_expense` Reject a pending expense with a required reason (surfaces to the submitter and reopens the document to draft on their next edit). Same permission and project scope as approve\_expense. * **Kind:** Write * **Permission:** Checked inside the tool, with the same rules as the REST API. | Argument | Type | Required | Description | | ------------ | -------- | -------- | ---------------------------------------------------------- | | `expense_id` | `string` | yes | Expense id (from list\_pending\_expense\_approvals) | | `reason` | `string` | yes | Why it is rejected (1..1000 chars, shown to the submitter) | ### `submit_expense` Submit a draft (or rejected) expense for approval: status becomes pending and the document locks. Submitter or a submission-manager role. Expenses linked to a submission transition via the submission instead. * **Kind:** Write * **Permission:** Checked inside the tool, with the same rules as the REST API. | Argument | Type | Required | Description | | ------------ | -------- | -------- | -------------------------------- | | `expense_id` | `string` | yes | Expense id (from list\_expenses) | ### `update_expense` Edit an expense (only drafts or rejected documents: editing a rejected one reopens it to draft). Owner or a submission-manager role; pass only the fields to change. Lines, when given, replace the existing set wholesale. Pending/approved/paid documents are locked. * **Kind:** Write * **Permission:** Checked inside the tool, with the same rules as the REST API. | Argument | Type | Required | Description | | ------------------------- | ---------------------------------------------------------- | -------- | ---------------------------------------------------- | | `expense_id` | `string` | yes | Expense id (from list\_expenses) | | `vendor_name` | `string` | no | | | `vendor_tax_id` | `string` | no | | | `invoice_number` | `string` | no | | | `document_kind` | `"invoice" \| "receipt" \| "nota" \| "billing" \| "other"` | no | | | `issued_at` | `number` | no | Document date (epoch ms) | | `due_at` | `number` | no | Due date (epoch ms); pass 0 to clear | | `currency` | `string` | no | | | `subtotal_cents` | `number` | no | | | `tax_cents` | `number` | no | | | `total_cents` | `number` | no | | | `category` | `string` | no | | | `project_id` | `string` | no | In-tenant project; not editable once in a submission | | `subject_type` | `"ticket" \| "task"` | no | Work-item link type | | `subject_id` | `string` | no | Work-item id | | `lines` | `object[]` | no | Replaces the line-item set wholesale | | `lines[].description` | `string` | no | | | `lines[].qty` | `number` | no | | | `lines[].unitAmountCents` | `number` | no | | | `lines[].amountCents` | `number` | no | | | `lines[].taxCents` | `number` | no | | | `lines[].glCode` | `string` | no | | ## Leave ### `approve_leave_request` Approve a PENDING leave request as one of its current approvers (or with the leave approval override). In a multi-stage workflow this approves the caller’s stage; the request is approved once the last stage is. Optional decision\_note is stored and shown to the requester. * **Kind:** Write * **Permission:** Checked inside the tool, with the same rules as the REST API. | Argument | Type | Required | Description | | --------------- | -------- | -------- | ----------------------------- | | `request_id` | `string` | yes | | | `decision_note` | `string` | no | Optional note (1..1000 chars) | ### `cancel_leave_request` Cancel a PENDING leave request. The owner may cancel their own pending request; a leave approver may cancel any pending one. Approved/rejected/cancelled requests can no longer be cancelled. * **Kind:** Write * **Permission:** Checked inside the tool, with the same rules as the REST API. | Argument | Type | Required | Description | | ------------ | -------- | -------- | ----------- | | `request_id` | `string` | yes | | ### `create_leave_request` Create and submit a leave request for the CALLER (status pending). Weekdays are computed server-side; the window may span at most 60 days and must not overlap the caller’s own pending/approved leave. type\_id comes from list\_leave\_types; covering\_peer\_id must be another active teammate (list\_leave\_peers). Who approves follows the workspace’s approval workflow; it cannot be chosen here. * **Kind:** Write * **Permission:** Checked inside the tool, with the same rules as the REST API. | Argument | Type | Required | Description | | ------------------ | ------------------- | -------- | ------------------------------------------------------------------ | | `type_id` | `string` | yes | Leave type id (list\_leave\_types) | | `start_date` | `integer \| string` | yes | Epoch ms or YYYY-MM-DD (inclusive) | | `end_date` | `integer \| string` | yes | Epoch ms or YYYY-MM-DD (inclusive) | | `reason` | `string` | yes | 1..2000 chars, shown to the approver | | `covering_peer_id` | `string` | yes | Teammate covering the absence (list\_leave\_peers; not the caller) | ### `get_leave_request` Get one leave request by id, including requester, type and covering-peer names, status and decision note. The caller must own the request or hold the leave approval permission. Get ids from list\_leave\_requests / list\_pending\_leave\_approvals. * **Kind:** Read * **Permission:** Checked inside the tool, with the same rules as the REST API. | Argument | Type | Required | Description | | ------------ | -------- | -------- | ----------- | | `request_id` | `string` | yes | | ### `list_leave_peers` List active workspace members (excluding the caller) eligible as covering\_peer\_id for create\_leave\_request. Optional search matches name or email. * **Kind:** Read * **Permission:** Checked inside the tool, with the same rules as the REST API. | Argument | Type | Required | Description | | -------- | --------- | -------- | -------------------------------- | | `search` | `string` | no | Substring match on name or email | | `limit` | `integer` | no | Max items (default 20, max 50) | ### `list_leave_requests` List leave requests with requester/type/covering-peer names. Defaults to the caller’s OWN requests; scope=team covers the whole workspace and requires the leave approval permission. from/to select requests OVERLAPPING the window (request ends on/after from, starts on/before to). * **Kind:** Read * **Permission:** Checked inside the tool, with the same rules as the REST API. | Argument | Type | Required | Description | | -------- | ------------------------------------------------------------------------------ | -------- | ------------------------------------------------------------------------------------ | | `scope` | `"mine" \| "team"` | no | mine (default) = own requests; team = whole workspace (needs leave:approval:approve) | | `status` | `"pending" \| "approved" \| "rejected" \| "cancelled" \| "revision_requested"` | no | | | `from` | `integer \| string` | no | Epoch ms or YYYY-MM-DD: window start (inclusive) | | `to` | `integer \| string` | no | Epoch ms or YYYY-MM-DD: window end (inclusive) | | `limit` | `integer` | no | Max items (default 20, max 100) | | `offset` | `integer` | no | | ### `list_leave_types` List the workspace’s leave types (Annual/Sick/Unpaid are seeded on first call). Use it to get the type\_id required by create\_leave\_request. * **Kind:** Read * **Permission:** Checked inside the tool, with the same rules as the REST API. No arguments. ### `list_pending_leave_approvals` List PENDING leave requests awaiting a decision in the workspace (requires the leave approval permission). Use it to find request\_id values before approve\_leave\_request / reject\_leave\_request. * **Kind:** Read * **Permission:** Checked inside the tool, with the same rules as the REST API. | Argument | Type | Required | Description | | -------- | --------- | -------- | ------------------------------- | | `limit` | `integer` | no | Max items (default 20, max 100) | ### `reject_leave_request` Reject a PENDING leave request as one of its current approvers (or with the leave approval override); a reason is mandatory and becomes the decision note. * **Kind:** Write * **Permission:** Checked inside the tool, with the same rules as the REST API. | Argument | Type | Required | Description | | ------------ | -------- | -------- | ------------------------------------------- | | `request_id` | `string` | yes | | | `reason` | `string` | yes | Why the request is rejected (1..1000 chars) | ## Approvals (every product) ### `decide_approval_task` Approve or reject one of the CALLER’s pending approval tasks (task\_id from list\_my\_approval\_tasks). Only the task’s assignee can decide it. A conflict means someone else decided or the request changed: list the tasks again. * **Kind:** Write * **Permission:** Checked inside the tool, with the same rules as the REST API. | Argument | Type | Required | Description | | ---------- | -------------------------- | -------- | ----------------------------------------------------- | | `task_id` | `string` | yes | | | `decision` | `"approved" \| "rejected"` | yes | | | `comment` | `string` | no | Optional note shown to the requester (max 2000 chars) | ### `list_my_approval_tasks` List approval tasks waiting for the CALLER’s decision across every product (leave, expenses, timesheets…), oldest first. Each item has a task\_id for decide\_approval\_task, the product, the record, the stage and how many approvals the stage still needs. * **Kind:** Read * **Permission:** Checked inside the tool, with the same rules as the REST API. | Argument | Type | Required | Description | | -------- | --------- | -------- | ------------------------------- | | `limit` | `integer` | no | Max items (default 20, max 100) | # Quickstart > Create an API key in the app and make your first API call. This takes about five minutes. You need an OpexAIO account in a workspace with an Enterprise plan on at least one product (the API is an Enterprise feature), and a terminal with `curl` (and [`jq`](https://jqlang.org/) to read the answers more easily). ## 1. Create an API key 1. Sign in at [app.aio.opexcg.com](https://app.aio.opexcg.com). 2. In the sidebar, open **MCP**. 3. Choose **Create API key**, give it a label such as `Reporting script`, and choose **Create**. 4. Copy the key. It starts with `pk_live_` and is shown **only once**. The key acts as you, in the workspace you were in when you created it. Treat it like a password: keep it out of source code and revoke it on the same page if it leaks. ## 2. Set two variables ```bash export OPEX=https://app.aio.opexcg.com export OPEX_API_KEY=pk_live_your_key_here ``` Every example in these docs uses them. To try things on staging first, use `https://staging.app.aio.opexcg.com` with a key created there. ## 3. Check who you are ```bash curl -s "$OPEX/api/me" -H "X-API-Key: $OPEX_API_KEY" \ | jq '{userId, role, tenantName, email, entitlements, permissions: (.permissions | length)}' ``` ```json { "userId": "usr-dewi-lestari", "role": "admin", "tenantName": "Nusantara Digital", "email": "dewi.lestari@example.com", "entitlements": ["timesheets", "helpdesk", "pmo", "crm", "expenses", "leave"], "permissions": 118 } ``` `entitlements` are the products your workspace can use, and `permissions` the actions your roles allow. [Authentication and permissions](/docs/authentication/) explains both. ## 4. Read some data ```bash curl -s "$OPEX/api/projects?pageSize=2" -H "X-API-Key: $OPEX_API_KEY" \ | jq '{total, page, pageSize, items: [.items[] | {id, name, status}]}' ``` ```json { "total": 21, "page": 1, "pageSize": 2, "items": [ { "id": "prj-epicor", "name": "ABC Epicor ERP", "status": "active" }, { "id": "prj-opexmx", "name": "ABC OPEXmx Portal", "status": "active" } ] } ``` ## 5. See what an error looks like Without a key: ```bash curl -s -w ' %{http_code}\n' "$OPEX/api/me" ``` ```text {"error":"unauthorized"} 401 ``` Errors always carry a machine-readable code. [Conventions](/docs/conventions/#errors) lists how to handle them. ## Next * Pick a [product guide](/docs/guides/helpdesk/) for a ready-made recipe. * Browse the [API reference](/docs/reference/), or load [`/openapi.json`](/openapi.json) into Postman or Insomnia. * Connect an AI assistant through [MCP](/docs/mcp/). # API reference > Every v1 endpoint of the OpexAIO API, generated from the code. The reference covers the **v1 API**: 55 endpoints that are stable and kept backwards compatible. It is generated from the same schemas the server validates with, so it matches the running code. | Section | What it covers | Endpoints | | ----------------------------------------- | ---------------------------------------------- | --------- | | [Account](/docs/reference/account/) | The current user and notifications. | 4 | | [Helpdesk](/docs/reference/helpdesk/) | Tickets: open, read, reply, update and close. | 6 | | [Timesheets](/docs/reference/timesheets/) | Time entries and the projects you log against. | 5 | | [Project](/docs/reference/pmo/) | Projects and their tasks. | 8 | | [CRM](/docs/reference/crm/) | Contacts, companies, deals and activities. | 15 | | [Expenses](/docs/reference/expenses/) | Expenses, receipt capture and categories. | 7 | | [Leave](/docs/reference/leave/) | Leave requests, balances, types and cover. | 7 | | [Approvals](/docs/reference/approvals/) | One approval inbox for every product. | 3 | ## OpenAPI The whole reference is also an OpenAPI 3.1 document: [`/openapi.json`](/openapi.json). Load it into Postman, Insomnia or a client generator, or hand it to an AI assistant. ## What is not in v1 The app calls many more endpoints than these. They follow the app’s screens and can change without notice, so they are not documented and not supported for integrations. If you need something that is missing, write to support and say what you are building. # Account API > The current user and notifications. The v1 endpoints, with parameters, responses and examples. The current user and notifications. Every endpoint below is part of the stable v1 contract. Base URL `https://app.aio.opexcg.com`; send your key in `X-API-Key`. * `GET /api/me`: Get the current user * `GET /api/notifications`: List notifications * `POST /api/notifications/:id/read`: Mark a notification read * `POST /api/notifications/read-all`: Mark all notifications read ## Get the current user `GET /api/me` Who the API key acts as: user id, roles, the permission codes those roles grant in this workspace, and the products the workspace is entitled to. Call it first to check what a key can do. * **Product:** none (any workspace) * **Permission:** any member ### Response `200` The caller’s profile. | Field | Type | Description | | ---------------------------------- | ------------------------------------------------------------------------- | --------------------------------------------------------------- | | `userId` | `string` | Your user id. | | `role` | `string` | Primary role in this workspace, e.g. `admin`, `consultant`. | | `roles` | `string[]` | Every role you hold in this workspace. | | `permissions` | `string[]` | Permission codes your roles grant here, e.g. `crm:record:read`. | | `tenantId` | `string` | The workspace this key acts in. | | `tenantName` | `string` | | | `displayName` | `string \| null` | | | `email` | `string` | | | `companyId` | `string \| null` | Your company, for client users. | | `language` | `string` | `en` or `id`. | | `entitlements` | `"helpdesk" \| "pmo" \| "crm" \| "timesheets" \| "expenses" \| "leave"[]` | Products the workspace can use (read and write). | | `readOnlyProducts` | `"helpdesk" \| "pmo" \| "crm" \| "timesheets" \| "expenses" \| "leave"[]` | Products whose trial ended: still readable, writes answer 402. | | `entitlementDetails` | `object[]` | | | `entitlementDetails[].product` | `"helpdesk" \| "pmo" \| "crm" \| "timesheets" \| "expenses" \| "leave"` | | | `entitlementDetails[].status` | `"active" \| "trial" \| "expired" \| "suspended"` | | | `entitlementDetails[].plan` | `string` | | | `entitlementDetails[].trialEndsAt` | `number \| null` | | Objects may carry more fields than listed; only the listed ones are part of the contract. ### Example ```bash curl -X GET 'https://app.aio.opexcg.com/api/me' \ -H "X-API-Key: $OPEX_API_KEY" ``` Response `200`: ```json { "userId": "usr-fitri-handayani", "role": "admin", "roles": [ "admin" ], "permissions": [ "ticket:notes:read", "helpdesk:masters:manage" ], "tenantId": "opexcg-tenant", "homeTenantId": "opexcg-tenant", "defaultTenantId": "opexcg-tenant", "tenantName": "OpexCG", "displayName": "Fitri Handayani", "avatarUrl": null, "email": "fitri.handayani@example.com", "companyId": null, "accessibleTenants": [ { "id": "opexcg-tenant", "name": "OpexCG" } ], "theme": "system", "language": "en", "currency": null, "entitlements": [ "timesheets", "helpdesk" ], "readOnlyProducts": [], "productAccessRestricted": false, "entitlementDetails": [ { "product": "timesheets", "status": "active", "plan": "dev", "trialEndsAt": null, "provisionedAt": 0, "settingsJson": "{}", "restricted": false }, { "product": "helpdesk", "status": "active", "plan": "dev", "trialEndsAt": null, "provisionedAt": 0, "settingsJson": "{}", "restricted": false } ] } ``` ## List notifications `GET /api/notifications` The caller’s 50 most recent notifications in this workspace, newest first, plus the unread count. There is no paging: older notifications are not returned. * **Product:** none (any workspace) * **Permission:** any member ### Response `200` Recent notifications and the unread count. | Field | Type | Description | | --------------------- | ---------------- | ------------------------------------------------ | | `items` | `object[]` | | | `items[].id` | `string` | | | `items[].kind` | `string` | What happened, e.g. `ticket_assigned`. | | `items[].title` | `string` | | | `items[].body` | `string \| null` | | | `items[].actor_name` | `string \| null` | | | `items[].entity_type` | `string \| null` | Record type the notification is about. | | `items[].entity_id` | `string \| null` | | | `items[].link` | `string \| null` | Path in the web app, relative to the app origin. | | `items[].read` | `number` | 1 = read, 0 = unread. | | `items[].created_at` | `number` | Epoch milliseconds. | | `unread` | `number` | | Objects may carry more fields than listed; only the listed ones are part of the contract. ### Example ```bash curl -X GET 'https://app.aio.opexcg.com/api/notifications' \ -H "X-API-Key: $OPEX_API_KEY" ``` Response `200`: ```json { "items": [ { "id": "d16873d6-2906-415c-b926-deef865e7c10", "tenant_id": "opexcg-tenant", "user_id": "usr-fajar-nugroho", "ticket_id": null, "entity_type": "leave_request", "entity_id": "f5e82a9f-325e-4069-a3a7-5e3e56a039d5", "link": "/leave/approvals?requestId=f5e82a9f-325e-4069-a3a7-5e3e56a039d5", "approval_task_id": null, "kind": "approval_decision", "title": "Approved: Sick leave for Fajar Nugroho", "body": "2028-03-31 → 2028-03-31 · 1 working day — Enjoy the day off", "actor_name": "Fitri Handayani", "read": 0, "created_at": 1794052052042, "created_by": "usr-fitri-handayani", "deleted_at": null, "deleted_by": null }, { "id": "f57e0d52-7c53-40a5-be96-9f4b97a76d46", "tenant_id": "opexcg-tenant", "user_id": "usr-fajar-nugroho", "ticket_id": "8defe6e2-afcd-46ba-a041-da8fdd7665ff", "entity_type": "ticket", "entity_id": "8defe6e2-afcd-46ba-a041-da8fdd7665ff", "link": "/helpdesk/tickets/8defe6e2-afcd-46ba-a041-da8fdd7665ff", "approval_task_id": null, "kind": "new_ticket", "title": "New ticket: Export to CSV times out", "body": "#SUP-2026-000013", "actor_name": "Fitri Handayani", "read": 0, "created_at": 1794052049439, "created_by": null, "deleted_at": null, "deleted_by": null } ], "unread": 2 } ``` ## Mark a notification read `POST /api/notifications/:id/read` Marks one of the caller’s notifications read. An id that is not the caller’s is ignored and still answers `ok`. * **Product:** none (any workspace) * **Permission:** any member ### Path parameters | Field | Type | Required | Description | | ----- | -------- | -------- | ---------------- | | `id` | `string` | yes | Notification id. | ### Response `200` Done. | Field | Type | Description | | ----- | --------- | ----------- | | `ok` | `boolean` | | Objects may carry more fields than listed; only the listed ones are part of the contract. ### Example ```bash curl -X POST 'https://app.aio.opexcg.com/api/notifications/d16873d6-2906-415c-b926-deef865e7c10/read' \ -H "X-API-Key: $OPEX_API_KEY" ``` Response `200`: ```json { "ok": true } ``` ## Mark all notifications read `POST /api/notifications/read-all` Marks every notification of the caller in this workspace read. * **Product:** none (any workspace) * **Permission:** any member ### Response `200` Done. | Field | Type | Description | | ----- | --------- | ----------- | | `ok` | `boolean` | | Objects may carry more fields than listed; only the listed ones are part of the contract. ### Example ```bash curl -X POST 'https://app.aio.opexcg.com/api/notifications/read-all' \ -H "X-API-Key: $OPEX_API_KEY" ``` Response `200`: ```json { "ok": true } ``` # Approvals API > One approval inbox for every product. The v1 endpoints, with parameters, responses and examples. One approval inbox for every product. Every endpoint below is part of the stable v1 contract. Base URL `https://app.aio.opexcg.com`; send your key in `X-API-Key`. * `GET /api/approvals/inbox`: List your pending approvals * `POST /api/approvals/tasks/:id/decide`: Approve or reject * `GET /api/approvals/instances/:id`: Get an approval’s timeline ## List your pending approvals `GET /api/approvals/inbox` Approval tasks waiting for the caller across every product the workspace can use, oldest first. Each item names the record (`product`, `entityType`, `entityId`) and carries `rev`, the instance revision. * **Product:** none (any workspace) * **Permission:** any member ### Query parameters | Field | Type | Required | Description | | --------- | --------- | -------- | ------------------------------------------------------------------------------------------------- | | `limit` | `integer` | no | Most tasks to return, 1 to 100. Default 50. min 1, max 100, default `50` | | `product` | `string` | no | Only this product’s tasks, e.g. `expenses`. All products when absent. min length 1, max length 32 | ### Response `200` Pending tasks. | Field | Type | Description | | ----------------------- | ---------------------------- | ----------------------------------------- | | `items` | `object[]` | | | `items[].taskId` | `string` | Decide with this id. | | `items[].instanceId` | `string` | | | `items[].product` | `string` | Owning product, e.g. `expenses`, `leave`. | | `items[].entityType` | `string` | | | `items[].entityId` | `string` | Id of the record being approved. | | `items[].requesterId` | `string` | | | `items[].requesterName` | `string \| null` | | | `items[].stageName` | `string` | | | `items[].stageIndex` | `number` | | | `items[].stageCount` | `number` | | | `items[].mode` | `"any" \| "all" \| "n_of_m"` | How many approvers a stage needs. | | `items[].requiredCount` | `number` | | | `items[].approvedCount` | `number` | | | `items[].rev` | `number` | Instance revision. | | `items[].submittedAt` | `number` | | | `items[].dueAt` | `number \| null` | | | `items[].title` | `string \| null` | | | `items[].summary` | `string \| null` | | | `items[].link` | `string \| null` | Path in the web app. | Objects may carry more fields than listed; only the listed ones are part of the contract. ### Example ```bash curl -X GET 'https://app.aio.opexcg.com/api/approvals/inbox' \ -H "X-API-Key: $OPEX_API_KEY" ``` Response `200`: ```json { "items": [ { "taskId": "5463c184-da51-4b84-9c77-4a7229e51fc2", "instanceId": "c85d566c-fe01-453e-bd0f-3088c2026c26", "product": "leave", "entityType": "leave_request", "entityId": "f5e82a9f-325e-4069-a3a7-5e3e56a039d5", "requesterId": "usr-fajar-nugroho", "requesterName": "Fajar Nugroho", "stageName": "Approval", "stageIndex": 0, "stageCount": 1, "mode": "any", "requiredCount": 1, "approvedCount": 0, "rev": 0, "submittedAt": 1794052051774, "dueAt": null, "title": "Sick leave for Fajar Nugroho", "summary": "2028-03-31 → 2028-03-31 · 1 working day", "link": "/leave/approvals?requestId=f5e82a9f-325e-4069-a3a7-5e3e56a039d5" } ] } ``` ## Approve or reject `POST /api/approvals/tasks/:id/decide` Records the caller’s decision on one approval task. The answer says what happened: the vote was `recorded` (the stage needs more approvers), the instance `advanced` to its next stage, or it ended `approved` or `rejected`. A task that was already decided, or whose instance moved on, answers 409; re-read the inbox and try again. * **Product:** none (any workspace) * **Permission:** any member * **Also:** Only the task’s assignee may decide it; the record’s product must be entitled. ### Path parameters | Field | Type | Required | Description | | ----- | -------- | -------- | ------------------------------------------- | | `id` | `string` | yes | Approval task id (`taskId` from the inbox). | ### Request body (JSON) | Field | Type | Required | Description | | ---------- | -------------------------- | -------- | ----------- | | `decision` | `"approved" \| "rejected"` | yes | | | `comment` | `string \| null` | no | | ### Response `200` The outcome. | Field | Type | Description | | -------------- | ------------------------------------------------------ | ---------------------- | | `instanceId` | `string` | | | `status` | `"pending" \| "approved" \| "rejected" \| "cancelled"` | | | `currentStage` | `number` | | | `outcome` | `"recorded" \| "advanced" \| "approved" \| "rejected"` | What the decision did. | Objects may carry more fields than listed; only the listed ones are part of the contract. **Errors:** `not_found`, `approval_conflict`, `approval_not_assignee`, `self_approval_not_allowed`, plus the [shared ones](/docs/conventions/#errors). Meanings: [error codes](/docs/errors/). ### Example ```bash curl -X POST 'https://app.aio.opexcg.com/api/approvals/tasks/5463c184-da51-4b84-9c77-4a7229e51fc2/decide' \ -H "X-API-Key: $OPEX_API_KEY" \ -H "content-type: application/json" \ -d '{"decision":"approved","comment":"Enjoy the day off"}' ``` Response `200`: ```json { "instanceId": "c85d566c-fe01-453e-bd0f-3088c2026c26", "status": "approved", "currentStage": 0, "outcome": "approved" } ``` ## Get an approval’s timeline `GET /api/approvals/instances/:id` One approval instance: its status, every stage with its tasks and decisions, and the event history. * **Product:** none (any workspace) * **Permission:** any member * **Also:** The requester, a participant, or a holder of the product’s approve or override permission. ### Path parameters | Field | Type | Required | Description | | ----- | -------- | -------- | ------------------------------------ | | `id` | `string` | yes | Approval instance id (`instanceId`). | ### Response `200` The timeline. | Field | Type | Description | | ------------------------------- | --------------------------------------------------------------------------------- | ----------------------------------- | | `id` | `string` | | | `product` | `string` | | | `entityType` | `string` | | | `entityId` | `string` | | | `requesterId` | `string` | | | `status` | `"pending" \| "approved" \| "rejected" \| "cancelled"` | | | `currentStage` | `number` | | | `rev` | `number` | | | `submittedAt` | `number` | | | `closedAt` | `number \| null` | | | `definitionName` | `string` | The approval workflow that applied. | | `version` | `number` | | | `stages` | `object[]` | | | `stages[].index` | `number` | | | `stages[].name` | `string` | | | `stages[].mode` | `"any" \| "all" \| "n_of_m"` | How many approvers a stage needs. | | `stages[].requiredCount` | `number` | | | `stages[].approvedCount` | `number` | | | `stages[].status` | `"pending" \| "approved" \| "rejected" \| "skipped" \| "cancelled" \| "upcoming"` | | | `stages[].dueAt` | `number \| null` | | | `stages[].tasks` | `object[]` | | | `stages[].tasks[].id` | `string` | | | `stages[].tasks[].assigneeId` | `string` | | | `stages[].tasks[].assigneeName` | `string \| null` | | | `stages[].tasks[].status` | `"pending" \| "approved" \| "rejected" \| "skipped" \| "superseded"` | | | `stages[].tasks[].decidedAt` | `number \| null` | | | `stages[].tasks[].comment` | `string \| null` | | | `events` | `object[]` | | | `events[].kind` | `string` | | | `events[].actorId` | `string \| null` | | | `events[].actorName` | `string \| null` | | | `events[].createdAt` | `number` | | Objects may carry more fields than listed; only the listed ones are part of the contract. **Errors:** `not_found`, `forbidden`, plus the [shared ones](/docs/conventions/#errors). Meanings: [error codes](/docs/errors/). ### Example ```bash curl -X GET 'https://app.aio.opexcg.com/api/approvals/instances/c85d566c-fe01-453e-bd0f-3088c2026c26' \ -H "X-API-Key: $OPEX_API_KEY" ``` Response `200`: ```json { "id": "c85d566c-fe01-453e-bd0f-3088c2026c26", "product": "leave", "entityType": "leave_request", "entityId": "f5e82a9f-325e-4069-a3a7-5e3e56a039d5", "requesterId": "usr-fajar-nugroho", "status": "pending", "currentStage": 0, "rev": 0, "submittedAt": 1794052051774, "closedAt": null, "definitionName": "Standard leave approval", "version": 1, "stages": [ { "index": 0, "key": "approve", "name": "Approval", "mode": "any", "requiredCount": 1, "approvedCount": 0, "status": "pending", "dueAt": null, "tasks": [ { "id": "9b522958-fa67-4bdb-b93f-c8ed3a0ff898", "assigneeId": "usr-sari-wulandari", "assigneeName": "Sari Wulandari", "delegatedFrom": null, "status": "pending", "decidedAt": null, "comment": null }, { "id": "5fb7f2ae-773e-4880-a915-86fbeca7bb8b", "assigneeId": "usr-wulan-sari", "assigneeName": "Wulan Sari", "delegatedFrom": null, "status": "pending", "decidedAt": null, "comment": null } ] } ], "events": [ { "kind": "submitted", "actorId": "usr-fajar-nugroho", "actorName": "Fajar Nugroho", "taskId": null, "createdAt": 1794052051774, "data": { "version": 1 } }, { "kind": "stage_opened", "actorId": null, "actorName": null, "taskId": null, "createdAt": 1794052051774, "data": { "stage": "approve", "approvers": 16, "fallback": false } } ] } ``` # CRM API > Contacts, companies, deals and activities. The v1 endpoints, with parameters, responses and examples. Contacts, companies, deals and activities. Every endpoint below is part of the stable v1 contract. Base URL `https://app.aio.opexcg.com`; send your key in `X-API-Key`. * `GET /api/crm/contacts`: List contacts * `GET /api/crm/contacts/:id`: Get a contact * `POST /api/crm/contacts`: Create a contact * `PATCH /api/crm/contacts/:id`: Update a contact * `GET /api/crm/companies`: List companies * `GET /api/crm/companies/:id`: Get a company * `POST /api/crm/companies`: Create a company * `PATCH /api/crm/companies/:id`: Update a company * `GET /api/crm/deals`: List deals * `GET /api/crm/deals/:id`: Get a deal * `POST /api/crm/deals`: Create a deal * `PATCH /api/crm/deals/:id`: Update a deal * `POST /api/crm/deals/:id/move`: Move a deal to another stage * `GET /api/crm/activities`: List activities * `POST /api/crm/activities`: Log an activity ## List contacts `GET /api/crm/contacts` Contacts, newest first by default. `search` matches name, email and company. Sort keys: `created` (default), `name`, `email`, `status`. * **Product:** CRM (`crm`) * **Permission (any of):** `crm:record:read` ### Query parameters | Field | Type | Required | Description | | ----------- | -------- | -------- | ---------------------------------------------------------------- | | `page` | `string` | no | 1-based page number. Default 1. | | `pageSize` | `string` | no | Rows per page, 1 to 100. Larger values are clamped. Default 20. | | `search` | `string` | no | Free-text filter (trimmed, first 200 characters). | | `sort` | `string` | no | Sort key. Unknown keys fall back to the endpoint’s default sort. | | `dir` | `string` | no | `asc` or `desc` (default). | | `status` | `string` | no | `lead`, `active` or `churned`. | | `companyId` | `string` | no | Only contacts of this company. | ### Response `200` One page of contacts. | Field | Type | Description | | --------------------- | --------------------------------- | ---------------------------------- | | `items` | `object[]` | | | `items[].id` | `string` | | | `items[].email` | `string` | | | `items[].name` | `string \| null` | | | `items[].company` | `string \| null` | Company name as typed (free text). | | `items[].company_id` | `string \| null` | Linked company record. | | `items[].title` | `string \| null` | | | `items[].phone` | `string \| null` | | | `items[].address` | `string \| null` | | | `items[].status` | `"lead" \| "active" \| "churned"` | | | `items[].source` | `string \| null` | | | `items[].notes` | `string \| null` | | | `items[].created_at` | `number` | | | `items[].modified_at` | `number` | | | `total` | `number` | | | `page` | `number` | | | `pageSize` | `number` | | Objects may carry more fields than listed; only the listed ones are part of the contract. ### Example ```bash curl -X GET 'https://app.aio.opexcg.com/api/crm/contacts?pageSize=2&search=Sari' \ -H "X-API-Key: $OPEX_API_KEY" ``` Response `200`: ```json { "items": [ { "id": "f611c550-75fd-452d-8de3-8ab46f9f1823", "tenant_id": "opexcg-tenant", "user_id": null, "company_id": "c5615616-096f-4886-9894-58e10bb0482a", "email": "sari@kencana.example", "name": "Sari Wulandari", "company": "Kencana Logistik Tbk", "title": "Head of Operations", "phone": null, "address": null, "avatar_url": null, "custom_fields_json": "{}", "status": "lead", "source": "api", "notes": null, "created_at": 1794052050080, "created_by": "usr-fitri-handayani", "modified_at": 1794052050080, "modified_by": "usr-fitri-handayani", "deleted_at": null, "deleted_by": null } ], "total": 1, "page": 1, "pageSize": 2 } ``` ## Get a contact `GET /api/crm/contacts/:id` One contact with its company link and status. * **Product:** CRM (`crm`) * **Permission (any of):** `crm:record:read` ### Path parameters | Field | Type | Required | Description | | ----- | -------- | -------- | ----------- | | `id` | `string` | yes | Contact id. | ### Response `200` The contact. | Field | Type | Description | | ------------- | --------------------------------- | ---------------------------------- | | `id` | `string` | | | `email` | `string` | | | `name` | `string \| null` | | | `company` | `string \| null` | Company name as typed (free text). | | `company_id` | `string \| null` | Linked company record. | | `title` | `string \| null` | | | `phone` | `string \| null` | | | `address` | `string \| null` | | | `status` | `"lead" \| "active" \| "churned"` | | | `source` | `string \| null` | | | `notes` | `string \| null` | | | `created_at` | `number` | | | `modified_at` | `number` | | Objects may carry more fields than listed; only the listed ones are part of the contract. **Errors:** `not_found`, plus the [shared ones](/docs/conventions/#errors). Meanings: [error codes](/docs/errors/). ### Example ```bash curl -X GET 'https://app.aio.opexcg.com/api/crm/contacts/f611c550-75fd-452d-8de3-8ab46f9f1823' \ -H "X-API-Key: $OPEX_API_KEY" ``` Response `200`: ```json { "id": "f611c550-75fd-452d-8de3-8ab46f9f1823", "tenant_id": "opexcg-tenant", "user_id": null, "company_id": "c5615616-096f-4886-9894-58e10bb0482a", "email": "sari@kencana.example", "name": "Sari Wulandari", "company": "Kencana Logistik Tbk", "title": "Head of Operations", "phone": null, "address": null, "avatar_url": null, "custom_fields_json": "{}", "status": "lead", "source": "api", "notes": null, "created_at": 1794052050080, "created_by": "usr-fitri-handayani", "modified_at": 1794052050080, "modified_by": "usr-fitri-handayani", "deleted_at": null, "deleted_by": null } ``` ## Create a contact `POST /api/crm/contacts` Creates a contact. Contacts are unique by email: posting an email that already exists answers **200** with the existing contact, filling only its blank fields from the request (nothing set is overwritten). Safe to retry. * **Product:** CRM (`crm`) * **Permission (any of):** `crm:record:write` ### Request body (JSON) | Field | Type | Required | Description | | ----------- | -------- | -------- | --------------- | | `email` | `string` | yes | | | `name` | `string` | no | max length 200 | | `company` | `string` | no | max length 200 | | `title` | `string` | no | max length 120 | | `phone` | `string` | no | max length 60 | | `address` | `string` | no | max length 500 | | `source` | `string` | no | max length 120 | | `notes` | `string` | no | max length 2000 | | `companyId` | `string` | no | | ### Response `201` The new contact. | Field | Type | Description | | ------------- | --------------------------------- | ---------------------------------- | | `id` | `string` | | | `email` | `string` | | | `name` | `string \| null` | | | `company` | `string \| null` | Company name as typed (free text). | | `company_id` | `string \| null` | Linked company record. | | `title` | `string \| null` | | | `phone` | `string \| null` | | | `address` | `string \| null` | | | `status` | `"lead" \| "active" \| "churned"` | | | `source` | `string \| null` | | | `notes` | `string \| null` | | | `created_at` | `number` | | | `modified_at` | `number` | | Objects may carry more fields than listed; only the listed ones are part of the contract. **Errors:** `company_not_found`, plus the [shared ones](/docs/conventions/#errors). Meanings: [error codes](/docs/errors/). ### Example ```bash curl -X POST 'https://app.aio.opexcg.com/api/crm/contacts' \ -H "X-API-Key: $OPEX_API_KEY" \ -H "content-type: application/json" \ -d '{"email":"sari@kencana.example","name":"Sari Wulandari","title":"Head of Operations","companyId":"c5615616-096f-4886-9894-58e10bb0482a","source":"api"}' ``` Response `201`: ```json { "id": "f611c550-75fd-452d-8de3-8ab46f9f1823", "tenant_id": "opexcg-tenant", "user_id": null, "company_id": "c5615616-096f-4886-9894-58e10bb0482a", "email": "sari@kencana.example", "name": "Sari Wulandari", "company": "Kencana Logistik Tbk", "title": "Head of Operations", "phone": null, "address": null, "avatar_url": null, "custom_fields_json": "{}", "status": "lead", "source": "api", "notes": null, "created_at": 1794052050080, "created_by": "usr-fitri-handayani", "modified_at": 1794052050080, "modified_by": "usr-fitri-handayani", "deleted_at": null, "deleted_by": null } ``` ## Update a contact `PATCH /api/crm/contacts/:id` Changes any of the given fields. `companyId: null` unlinks the company. * **Product:** CRM (`crm`) * **Permission (any of):** `crm:record:write` ### Path parameters | Field | Type | Required | Description | | ----- | -------- | -------- | ----------- | | `id` | `string` | yes | Contact id. | ### Request body (JSON) | Field | Type | Required | Description | | ----------- | --------------------------------- | -------- | --------------- | | `email` | `string` | no | | | `name` | `string` | no | max length 200 | | `company` | `string` | no | max length 200 | | `title` | `string` | no | max length 120 | | `phone` | `string` | no | max length 60 | | `address` | `string` | no | max length 500 | | `source` | `string` | no | max length 120 | | `notes` | `string` | no | max length 2000 | | `companyId` | `string \| null` | no | | | `status` | `"lead" \| "active" \| "churned"` | no | | ### Response `200` The updated contact. | Field | Type | Description | | ------------- | --------------------------------- | ---------------------------------- | | `id` | `string` | | | `email` | `string` | | | `name` | `string \| null` | | | `company` | `string \| null` | Company name as typed (free text). | | `company_id` | `string \| null` | Linked company record. | | `title` | `string \| null` | | | `phone` | `string \| null` | | | `address` | `string \| null` | | | `status` | `"lead" \| "active" \| "churned"` | | | `source` | `string \| null` | | | `notes` | `string \| null` | | | `created_at` | `number` | | | `modified_at` | `number` | | Objects may carry more fields than listed; only the listed ones are part of the contract. **Errors:** `not_found`, `company_not_found`, plus the [shared ones](/docs/conventions/#errors). Meanings: [error codes](/docs/errors/). ### Example ```bash curl -X PATCH 'https://app.aio.opexcg.com/api/crm/contacts/f611c550-75fd-452d-8de3-8ab46f9f1823' \ -H "X-API-Key: $OPEX_API_KEY" \ -H "content-type: application/json" \ -d '{"status":"active","phone":"+62 21 555 0100"}' ``` Response `200`: ```json { "id": "f611c550-75fd-452d-8de3-8ab46f9f1823", "tenant_id": "opexcg-tenant", "user_id": null, "company_id": "c5615616-096f-4886-9894-58e10bb0482a", "email": "sari@kencana.example", "name": "Sari Wulandari", "company": "Kencana Logistik Tbk", "title": "Head of Operations", "phone": "+62 21 555 0100", "address": null, "avatar_url": null, "custom_fields_json": "{}", "status": "active", "source": "api", "notes": null, "created_at": 1794052050080, "created_by": "usr-fitri-handayani", "modified_at": 1794052050163, "modified_by": "usr-fitri-handayani", "deleted_at": null, "deleted_by": null } ``` ## List companies `GET /api/crm/companies` Companies (your clients and your own organisation), with their contact and deal counts. Sort keys: `name` (default), `created`, `type`. * **Product:** CRM (`crm`) * **Permission (any of):** `crm:record:read` ### Query parameters | Field | Type | Required | Description | | ---------- | -------- | -------- | ---------------------------------------------------------------- | | `page` | `string` | no | 1-based page number. Default 1. | | `pageSize` | `string` | no | Rows per page, 1 to 100. Larger values are clamped. Default 20. | | `search` | `string` | no | Free-text filter (trimmed, first 200 characters). | | `sort` | `string` | no | Sort key. Unknown keys fall back to the endpoint’s default sort. | | `dir` | `string` | no | `asc` or `desc` (default). | | `type` | `string` | no | `client` or `internal`. | ### Response `200` One page of companies. | Field | Type | Description | | ---------------------- | ------------------------ | ----------- | | `items` | `object[]` | | | `items[].id` | `string` | | | `items[].name` | `string` | | | `items[].type` | `"client" \| "internal"` | | | `items[].created_at` | `number` | | | `items[].contactCount` | `number` | | | `items[].dealCount` | `number` | | | `total` | `number` | | | `page` | `number` | | | `pageSize` | `number` | | Objects may carry more fields than listed; only the listed ones are part of the contract. ### Example ```bash curl -X GET 'https://app.aio.opexcg.com/api/crm/companies?pageSize=5' \ -H "X-API-Key: $OPEX_API_KEY" ``` Response `200`: ```json { "items": [ { "id": "comp-xyzind", "tenant_id": "opexcg-tenant", "name": "XYZ Industries", "type": "client", "settings_json": "{}", "created_at": 1768132020883, "created_by": null, "modified_at": 1768132020883, "modified_by": null, "deleted_at": null, "deleted_by": null, "contactCount": 0, "dealCount": 0 }, { "id": "comp-opexcg", "tenant_id": "opexcg-tenant", "name": "OpexCG", "type": "internal", "settings_json": "{}", "created_at": 1759492020883, "created_by": null, "modified_at": 1759492020883, "modified_by": null, "deleted_at": null, "deleted_by": null, "contactCount": 0, "dealCount": 0 } ], "total": 5, "page": 1, "pageSize": 5 } ``` ## Get a company `GET /api/crm/companies/:id` One company with its contact count, deal count and pipeline totals. * **Product:** CRM (`crm`) * **Permission (any of):** `crm:record:read` ### Path parameters | Field | Type | Required | Description | | ----- | -------- | -------- | ----------- | | `id` | `string` | yes | Company id. | ### Response `200` The company. | Field | Type | Description | | ---------------------- | ------------------------ | ----------------------------- | | `company` | `object` | | | `company.id` | `string` | | | `company.name` | `string` | | | `company.type` | `"client" \| "internal"` | | | `company.created_at` | `number` | | | `rollups` | `object` | | | `rollups.contactCount` | `number` | | | `rollups.dealCount` | `number` | | | `rollups.totals` | `any` | Pipeline totals per currency. | Objects may carry more fields than listed; only the listed ones are part of the contract. **Errors:** `not_found`, plus the [shared ones](/docs/conventions/#errors). Meanings: [error codes](/docs/errors/). ### Example ```bash curl -X GET 'https://app.aio.opexcg.com/api/crm/companies/c5615616-096f-4886-9894-58e10bb0482a' \ -H "X-API-Key: $OPEX_API_KEY" ``` Response `200`: ```json { "company": { "id": "c5615616-096f-4886-9894-58e10bb0482a", "tenant_id": "opexcg-tenant", "name": "Kencana Logistik", "type": "client", "settings_json": null, "support_package": null, "email_domains_json": null, "website": null, "domain": null, "industry": null, "description": null, "created_at": 1794052049968, "created_by": "usr-fitri-handayani", "modified_at": 1794052049968, "modified_by": "usr-fitri-handayani", "deleted_at": null, "deleted_by": null }, "rollups": { "contactCount": 0, "dealCount": 0, "totals": [] } } ``` ## Create a company `POST /api/crm/companies` Creates a company. Needs `crm:company:create` as well as `crm:record:write`. * **Product:** CRM (`crm`) * **Permission (any of):** `crm:company:create` ### Request body (JSON) | Field | Type | Required | Description | | ------ | ------------------------ | -------- | ---------------------------- | | `name` | `string` | yes | min length 1, max length 200 | | `type` | `"client" \| "internal"` | no | | ### Response `201` The new company. | Field | Type | Description | | ------------ | ------------------------ | ----------- | | `id` | `string` | | | `name` | `string` | | | `type` | `"client" \| "internal"` | | | `created_at` | `number` | | Objects may carry more fields than listed; only the listed ones are part of the contract. **Errors:** `forbidden`, plus the [shared ones](/docs/conventions/#errors). Meanings: [error codes](/docs/errors/). ### Example ```bash curl -X POST 'https://app.aio.opexcg.com/api/crm/companies' \ -H "X-API-Key: $OPEX_API_KEY" \ -H "content-type: application/json" \ -d '{"name":"Kencana Logistik","type":"client"}' ``` Response `201`: ```json { "id": "c5615616-096f-4886-9894-58e10bb0482a", "tenant_id": "opexcg-tenant", "name": "Kencana Logistik", "type": "client", "settings_json": null, "support_package": null, "email_domains_json": null, "website": null, "domain": null, "industry": null, "description": null, "created_at": 1794052049968, "created_by": "usr-fitri-handayani", "modified_at": 1794052049968, "modified_by": "usr-fitri-handayani", "deleted_at": null, "deleted_by": null } ``` ## Update a company `PATCH /api/crm/companies/:id` Renames a company or changes its type. Needs `crm:company:update` as well as `crm:record:write`. * **Product:** CRM (`crm`) * **Permission (any of):** `crm:company:update` ### Path parameters | Field | Type | Required | Description | | ----- | -------- | -------- | ----------- | | `id` | `string` | yes | Company id. | ### Request body (JSON) | Field | Type | Required | Description | | ------ | ------------------------ | -------- | ---------------------------- | | `name` | `string` | no | min length 1, max length 200 | | `type` | `"client" \| "internal"` | no | | ### Response `200` The updated company. | Field | Type | Description | | ------------ | ------------------------ | ----------- | | `id` | `string` | | | `name` | `string` | | | `type` | `"client" \| "internal"` | | | `created_at` | `number` | | Objects may carry more fields than listed; only the listed ones are part of the contract. **Errors:** `not_found`, `forbidden`, plus the [shared ones](/docs/conventions/#errors). Meanings: [error codes](/docs/errors/). ### Example ```bash curl -X PATCH 'https://app.aio.opexcg.com/api/crm/companies/c5615616-096f-4886-9894-58e10bb0482a' \ -H "X-API-Key: $OPEX_API_KEY" \ -H "content-type: application/json" \ -d '{"name":"Kencana Logistik Tbk"}' ``` Response `200`: ```json { "id": "c5615616-096f-4886-9894-58e10bb0482a", "tenant_id": "opexcg-tenant", "name": "Kencana Logistik Tbk", "type": "client", "settings_json": null, "support_package": null, "email_domains_json": null, "website": null, "domain": null, "industry": null, "description": null, "created_at": 1794052049968, "created_by": "usr-fitri-handayani", "modified_at": 1794052050044, "modified_by": "usr-fitri-handayani", "deleted_at": null, "deleted_by": null } ``` ## List deals `GET /api/crm/deals` Deals, newest first by default. Amounts are integer minor units (`amount_cents`) in the deal’s `currency`. Sort keys: `created` (default), `name`, `amount`, `stage`, `expected_close`. * **Product:** CRM (`crm`) * **Permission (any of):** `crm:record:read` ### Query parameters | Field | Type | Required | Description | | ----------- | -------- | -------- | ---------------------------------------------------------------------------- | | `page` | `string` | no | 1-based page number. Default 1. | | `pageSize` | `string` | no | Rows per page, 1 to 100. Larger values are clamped. Default 20. | | `search` | `string` | no | Free-text filter (trimmed, first 200 characters). | | `sort` | `string` | no | Sort key. Unknown keys fall back to the endpoint’s default sort. | | `dir` | `string` | no | `asc` or `desc` (default). | | `stage` | `string` | no | `lead`, `qualified`, `demo_poc`, `proposal`, `negotiation`, `won` or `lost`. | | `contactId` | `string` | no | Only deals of this contact. | | `companyId` | `string` | no | Only deals of this company. | ### Response `200` One page of deals. | Field | Type | Description | | --------------------------- | --------------------------------------------------------------------------------------- | ----------------------------------------- | | `items` | `object[]` | | | `items[].id` | `string` | | | `items[].name` | `string` | | | `items[].contact_id` | `string \| null` | | | `items[].company_id` | `string \| null` | | | `items[].project_id` | `string \| null` | | | `items[].sales_owner_id` | `string \| null` | | | `items[].stage` | `"lead" \| "qualified" \| "demo_poc" \| "proposal" \| "negotiation" \| "won" \| "lost"` | | | `items[].amount_cents` | `number` | Integer minor units of `currency`. | | `items[].currency` | `string` | | | `items[].win_probability` | `number \| null` | 0 to 100; null follows the stage default. | | `items[].expected_close_at` | `number \| null` | Epoch milliseconds. | | `items[].closed_at` | `number \| null` | | | `items[].lost_reason` | `string \| null` | | | `items[].source` | `string \| null` | | | `items[].notes` | `string \| null` | | | `items[].created_at` | `number` | | | `items[].modified_at` | `number` | | | `total` | `number` | | | `page` | `number` | | | `pageSize` | `number` | | Objects may carry more fields than listed; only the listed ones are part of the contract. ### Example ```bash curl -X GET 'https://app.aio.opexcg.com/api/crm/deals?pageSize=2' \ -H "X-API-Key: $OPEX_API_KEY" ``` Response `200`: ```json { "items": [ { "id": "c80cad76-7ec0-4641-a5f2-30ea2aaa4561", "tenant_id": "opexcg-tenant", "contact_id": "f611c550-75fd-452d-8de3-8ab46f9f1823", "company_id": "c5615616-096f-4886-9894-58e10bb0482a", "project_id": null, "sales_owner_id": null, "name": "Fleet maintenance rollout", "amount_cents": 4500000000, "currency": "IDR", "stage": "qualified", "stage_sort": 1, "expected_close_at": 1796644050172, "source": null, "win_probability": null, "lost_reason": null, "competitor_name": null, "demand_role": null, "demand_hours_per_day": null, "demand_start_at": null, "demand_weeks": null, "win_reason": null, "loss_reason": null, "closed_at": null, "notes": null, "created_at": 1794052050203, "created_by": "usr-fitri-handayani", "modified_at": 1794052050203, "modified_by": "usr-fitri-handayani", "deleted_at": null, "deleted_by": null } ], "total": 1, "page": 1, "pageSize": 2 } ``` ## Get a deal `GET /api/crm/deals/:id` One deal with its stage, amount and linked contact, company and project. * **Product:** CRM (`crm`) * **Permission (any of):** `crm:record:read` ### Path parameters | Field | Type | Required | Description | | ----- | -------- | -------- | ----------- | | `id` | `string` | yes | Deal id. | ### Response `200` The deal. | Field | Type | Description | | ------------------- | --------------------------------------------------------------------------------------- | ----------------------------------------- | | `id` | `string` | | | `name` | `string` | | | `contact_id` | `string \| null` | | | `company_id` | `string \| null` | | | `project_id` | `string \| null` | | | `sales_owner_id` | `string \| null` | | | `stage` | `"lead" \| "qualified" \| "demo_poc" \| "proposal" \| "negotiation" \| "won" \| "lost"` | | | `amount_cents` | `number` | Integer minor units of `currency`. | | `currency` | `string` | | | `win_probability` | `number \| null` | 0 to 100; null follows the stage default. | | `expected_close_at` | `number \| null` | Epoch milliseconds. | | `closed_at` | `number \| null` | | | `lost_reason` | `string \| null` | | | `source` | `string \| null` | | | `notes` | `string \| null` | | | `created_at` | `number` | | | `modified_at` | `number` | | Objects may carry more fields than listed; only the listed ones are part of the contract. **Errors:** `not_found`, plus the [shared ones](/docs/conventions/#errors). Meanings: [error codes](/docs/errors/). ### Example ```bash curl -X GET 'https://app.aio.opexcg.com/api/crm/deals/c80cad76-7ec0-4641-a5f2-30ea2aaa4561' \ -H "X-API-Key: $OPEX_API_KEY" ``` Response `200`: ```json { "id": "c80cad76-7ec0-4641-a5f2-30ea2aaa4561", "tenant_id": "opexcg-tenant", "contact_id": "f611c550-75fd-452d-8de3-8ab46f9f1823", "company_id": "c5615616-096f-4886-9894-58e10bb0482a", "project_id": null, "sales_owner_id": null, "name": "Fleet maintenance rollout", "amount_cents": 4500000000, "currency": "IDR", "stage": "qualified", "stage_sort": 1, "expected_close_at": 1796644050172, "source": null, "win_probability": null, "lost_reason": null, "competitor_name": null, "demand_role": null, "demand_hours_per_day": null, "demand_start_at": null, "demand_weeks": null, "win_reason": null, "loss_reason": null, "closed_at": null, "notes": null, "created_at": 1794052050203, "created_by": "usr-fitri-handayani", "modified_at": 1794052050203, "modified_by": "usr-fitri-handayani", "deleted_at": null, "deleted_by": null } ``` ## Create a deal `POST /api/crm/deals` Creates a deal, by default in the `lead` stage. `amountCents` is in minor units of `currency`. A deal created as `lost` needs a `lostReason`. * **Product:** CRM (`crm`) * **Permission (any of):** `crm:record:write` ### Request body (JSON) | Field | Type | Required | Description | | ------------------- | --------------------------------------------------------------------------------------- | -------- | -------------- | | `name` | `string` | yes | | | `contactId` | `string` | no | | | `companyId` | `string \| null` | no | | | `projectId` | `string` | no | | | `notes` | `string \| null` | no | | | `salesOwnerId` | `string \| null` | no | | | `source` | `string` | no | max length 120 | | `amountCents` | `integer` | no | min 0 | | `currency` | `string` | no | max length 8 | | `expectedCloseAt` | `integer \| null` | no | | | `stage` | `"lead" \| "qualified" \| "demo_poc" \| "proposal" \| "negotiation" \| "won" \| "lost"` | no | | | `winProbability` | `integer \| null` | no | | | `lostReason` | `"price" \| "scope" \| "no_budget" \| "competitor" \| "stalled" \| null` | no | | | `competitorName` | `string \| null` | no | | | `demandRole` | `"SE" \| "FC" \| "TC" \| "PM" \| null` | no | | | `demandHoursPerDay` | `integer \| null` | no | | | `demandStartAt` | `integer \| null` | no | | | `demandWeeks` | `integer \| null` | no | | ### Response `201` The new deal. | Field | Type | Description | | ------------------- | --------------------------------------------------------------------------------------- | ----------------------------------------- | | `id` | `string` | | | `name` | `string` | | | `contact_id` | `string \| null` | | | `company_id` | `string \| null` | | | `project_id` | `string \| null` | | | `sales_owner_id` | `string \| null` | | | `stage` | `"lead" \| "qualified" \| "demo_poc" \| "proposal" \| "negotiation" \| "won" \| "lost"` | | | `amount_cents` | `number` | Integer minor units of `currency`. | | `currency` | `string` | | | `win_probability` | `number \| null` | 0 to 100; null follows the stage default. | | `expected_close_at` | `number \| null` | Epoch milliseconds. | | `closed_at` | `number \| null` | | | `lost_reason` | `string \| null` | | | `source` | `string \| null` | | | `notes` | `string \| null` | | | `created_at` | `number` | | | `modified_at` | `number` | | Objects may carry more fields than listed; only the listed ones are part of the contract. **Errors:** `company_not_found`, `missing_lost_reason`, plus the [shared ones](/docs/conventions/#errors). Meanings: [error codes](/docs/errors/). ### Example ```bash curl -X POST 'https://app.aio.opexcg.com/api/crm/deals' \ -H "X-API-Key: $OPEX_API_KEY" \ -H "content-type: application/json" \ -d '{"name":"Fleet maintenance rollout","contactId":"f611c550-75fd-452d-8de3-8ab46f9f1823","companyId":"c5615616-096f-4886-9894-58e10bb0482a","amountCents":4500000000,"currency":"IDR","stage":"qualified","expectedCloseAt":1796644050172}' ``` Response `201`: ```json { "id": "c80cad76-7ec0-4641-a5f2-30ea2aaa4561", "tenant_id": "opexcg-tenant", "contact_id": "f611c550-75fd-452d-8de3-8ab46f9f1823", "company_id": "c5615616-096f-4886-9894-58e10bb0482a", "project_id": null, "sales_owner_id": null, "name": "Fleet maintenance rollout", "amount_cents": 4500000000, "currency": "IDR", "stage": "qualified", "stage_sort": 1, "expected_close_at": 1796644050172, "source": null, "win_probability": null, "lost_reason": null, "competitor_name": null, "demand_role": null, "demand_hours_per_day": null, "demand_start_at": null, "demand_weeks": null, "win_reason": null, "loss_reason": null, "closed_at": null, "notes": null, "created_at": 1794052050203, "created_by": "usr-fitri-handayani", "modified_at": 1794052050203, "modified_by": "usr-fitri-handayani", "deleted_at": null, "deleted_by": null } ``` ## Update a deal `PATCH /api/crm/deals/:id` Changes any of the given fields. Use the move endpoint to change the stage with a timeline entry. * **Product:** CRM (`crm`) * **Permission (any of):** `crm:record:write` ### Path parameters | Field | Type | Required | Description | | ----- | -------- | -------- | ----------- | | `id` | `string` | yes | Deal id. | ### Request body (JSON) | Field | Type | Required | Description | | ------------------- | --------------------------------------------------------------------------------------- | -------- | ------------ | | `name` | `string` | no | | | `contactId` | `string \| null` | no | | | `companyId` | `string \| null` | no | | | `projectId` | `string \| null` | no | | | `notes` | `string \| null` | no | | | `salesOwnerId` | `string \| null` | no | | | `source` | `string \| null` | no | | | `amountCents` | `integer` | no | min 0 | | `currency` | `string` | no | max length 8 | | `expectedCloseAt` | `integer \| null` | no | | | `stage` | `"lead" \| "qualified" \| "demo_poc" \| "proposal" \| "negotiation" \| "won" \| "lost"` | no | | | `winProbability` | `integer \| null` | no | | | `lostReason` | `"price" \| "scope" \| "no_budget" \| "competitor" \| "stalled" \| null` | no | | | `competitorName` | `string \| null` | no | | | `demandRole` | `"SE" \| "FC" \| "TC" \| "PM" \| null` | no | | | `demandHoursPerDay` | `integer \| null` | no | | | `demandStartAt` | `integer \| null` | no | | | `demandWeeks` | `integer \| null` | no | | ### Response `200` The updated deal. | Field | Type | Description | | ------------------- | --------------------------------------------------------------------------------------- | ----------------------------------------- | | `id` | `string` | | | `name` | `string` | | | `contact_id` | `string \| null` | | | `company_id` | `string \| null` | | | `project_id` | `string \| null` | | | `sales_owner_id` | `string \| null` | | | `stage` | `"lead" \| "qualified" \| "demo_poc" \| "proposal" \| "negotiation" \| "won" \| "lost"` | | | `amount_cents` | `number` | Integer minor units of `currency`. | | `currency` | `string` | | | `win_probability` | `number \| null` | 0 to 100; null follows the stage default. | | `expected_close_at` | `number \| null` | Epoch milliseconds. | | `closed_at` | `number \| null` | | | `lost_reason` | `string \| null` | | | `source` | `string \| null` | | | `notes` | `string \| null` | | | `created_at` | `number` | | | `modified_at` | `number` | | Objects may carry more fields than listed; only the listed ones are part of the contract. **Errors:** `not_found`, `company_not_found`, `missing_lost_reason`, plus the [shared ones](/docs/conventions/#errors). Meanings: [error codes](/docs/errors/). ### Example ```bash curl -X PATCH 'https://app.aio.opexcg.com/api/crm/deals/c80cad76-7ec0-4641-a5f2-30ea2aaa4561' \ -H "X-API-Key: $OPEX_API_KEY" \ -H "content-type: application/json" \ -d '{"winProbability":60}' ``` Response `200`: ```json { "id": "c80cad76-7ec0-4641-a5f2-30ea2aaa4561", "tenant_id": "opexcg-tenant", "contact_id": "f611c550-75fd-452d-8de3-8ab46f9f1823", "company_id": "c5615616-096f-4886-9894-58e10bb0482a", "project_id": null, "sales_owner_id": null, "name": "Fleet maintenance rollout", "amount_cents": 4500000000, "currency": "IDR", "stage": "qualified", "stage_sort": 1, "expected_close_at": 1796644050172, "source": null, "win_probability": 60, "lost_reason": null, "competitor_name": null, "demand_role": null, "demand_hours_per_day": null, "demand_start_at": null, "demand_weeks": null, "win_reason": null, "loss_reason": null, "closed_at": null, "notes": null, "created_at": 1794052050203, "created_by": "usr-fitri-handayani", "modified_at": 1794052050299, "modified_by": "usr-fitri-handayani", "deleted_at": null, "deleted_by": null } ``` ## Move a deal to another stage `POST /api/crm/deals/:id/move` Moves a deal along the pipeline and records the move on its timeline. Moving to `won` or `lost` stamps `closed_at` (and `lost` needs a `lostReason`); moving back to an open stage clears it. * **Product:** CRM (`crm`) * **Permission (any of):** `crm:record:write` ### Path parameters | Field | Type | Required | Description | | ----- | -------- | -------- | ----------- | | `id` | `string` | yes | Deal id. | ### Request body (JSON) | Field | Type | Required | Description | | ---------------- | --------------------------------------------------------------------------------------- | -------- | -------------- | | `stage` | `"lead" \| "qualified" \| "demo_poc" \| "proposal" \| "negotiation" \| "won" \| "lost"` | yes | | | `lostReason` | `"price" \| "scope" \| "no_budget" \| "competitor" \| "stalled"` | no | | | `competitorName` | `string` | no | max length 200 | ### Response `200` The moved deal. | Field | Type | Description | | ------------------- | --------------------------------------------------------------------------------------- | ----------------------------------------- | | `id` | `string` | | | `name` | `string` | | | `contact_id` | `string \| null` | | | `company_id` | `string \| null` | | | `project_id` | `string \| null` | | | `sales_owner_id` | `string \| null` | | | `stage` | `"lead" \| "qualified" \| "demo_poc" \| "proposal" \| "negotiation" \| "won" \| "lost"` | | | `amount_cents` | `number` | Integer minor units of `currency`. | | `currency` | `string` | | | `win_probability` | `number \| null` | 0 to 100; null follows the stage default. | | `expected_close_at` | `number \| null` | Epoch milliseconds. | | `closed_at` | `number \| null` | | | `lost_reason` | `string \| null` | | | `source` | `string \| null` | | | `notes` | `string \| null` | | | `created_at` | `number` | | | `modified_at` | `number` | | Objects may carry more fields than listed; only the listed ones are part of the contract. **Errors:** `not_found`, `missing_lost_reason`, plus the [shared ones](/docs/conventions/#errors). Meanings: [error codes](/docs/errors/). ### Example ```bash curl -X POST 'https://app.aio.opexcg.com/api/crm/deals/c80cad76-7ec0-4641-a5f2-30ea2aaa4561/move' \ -H "X-API-Key: $OPEX_API_KEY" \ -H "content-type: application/json" \ -d '{"stage":"proposal"}' ``` Response `200`: ```json { "id": "c80cad76-7ec0-4641-a5f2-30ea2aaa4561", "tenant_id": "opexcg-tenant", "contact_id": "f611c550-75fd-452d-8de3-8ab46f9f1823", "company_id": "c5615616-096f-4886-9894-58e10bb0482a", "project_id": null, "sales_owner_id": null, "name": "Fleet maintenance rollout", "amount_cents": 4500000000, "currency": "IDR", "stage": "proposal", "stage_sort": 3, "expected_close_at": 1796644050172, "source": null, "win_probability": 60, "lost_reason": null, "competitor_name": null, "demand_role": null, "demand_hours_per_day": null, "demand_start_at": null, "demand_weeks": null, "win_reason": null, "loss_reason": null, "closed_at": null, "notes": null, "created_at": 1794052050203, "created_by": "usr-fitri-handayani", "modified_at": 1794052050329, "modified_by": "usr-fitri-handayani", "deleted_at": null, "deleted_by": null } ``` ## List activities `GET /api/crm/activities` Calls, emails, meetings and notes, most recent first. Pass `subjectType` and `subjectId` for one contact’s or deal’s timeline. * **Product:** CRM (`crm`) * **Permission (any of):** `crm:record:read` ### Query parameters | Field | Type | Required | Description | | ------------- | -------- | -------- | ---------------------------------------------------------------- | | `page` | `string` | no | 1-based page number. Default 1. | | `pageSize` | `string` | no | Rows per page, 1 to 100. Larger values are clamped. Default 20. | | `search` | `string` | no | Free-text filter (trimmed, first 200 characters). | | `sort` | `string` | no | Sort key. Unknown keys fall back to the endpoint’s default sort. | | `dir` | `string` | no | `asc` or `desc` (default). | | `subjectType` | `string` | no | `contact` or `deal`. | | `subjectId` | `string` | no | With `subjectType`: one contact’s or deal’s timeline. | | `kind` | `string` | no | `call`, `email`, `meeting`, `note` or `system`. | | `done` | `string` | no | `true` for completed follow-ups, `false` for open ones. | ### Response `200` One page of activities. | Field | Type | Description | | ---------------------- | ------------------------------------------------------ | ------------------- | | `items` | `object[]` | | | `items[].id` | `string` | | | `items[].subject_type` | `"contact" \| "deal"` | | | `items[].subject_id` | `string` | | | `items[].kind` | `"call" \| "email" \| "meeting" \| "note" \| "system"` | | | `items[].title` | `string \| null` | | | `items[].body` | `string \| null` | | | `items[].occurred_at` | `number` | Epoch milliseconds. | | `items[].due_at` | `number \| null` | | | `items[].done_at` | `number \| null` | | | `items[].created_by` | `string \| null` | | | `items[].created_at` | `number` | | | `total` | `number` | | | `page` | `number` | | | `pageSize` | `number` | | Objects may carry more fields than listed; only the listed ones are part of the contract. **Errors:** `invalid_subject_type`, plus the [shared ones](/docs/conventions/#errors). Meanings: [error codes](/docs/errors/). ### Example ```bash curl -X GET 'https://app.aio.opexcg.com/api/crm/activities?subjectType=deal&subjectId=c80cad76-7ec0-4641-a5f2-30ea2aaa4561&pageSize=2' \ -H "X-API-Key: $OPEX_API_KEY" ``` Response `200`: ```json { "items": [ { "id": "b5c5c795-91da-4d91-b53d-fe7bd8b48d91", "tenant_id": "opexcg-tenant", "subject_type": "deal", "subject_id": "c80cad76-7ec0-4641-a5f2-30ea2aaa4561", "kind": "meeting", "title": "Proposal walkthrough", "body": null, "occurred_at": 1794052050341, "due_at": null, "done_at": null, "created_at": 1794052050369, "created_by": "usr-fitri-handayani", "modified_at": 1794052050369, "modified_by": "usr-fitri-handayani", "deleted_at": null, "deleted_by": null }, { "id": "abef4b47-4708-4a32-b00f-d60262d580eb", "tenant_id": "opexcg-tenant", "subject_type": "deal", "subject_id": "c80cad76-7ec0-4641-a5f2-30ea2aaa4561", "kind": "system", "title": "Stage → Proposal sent", "body": null, "occurred_at": 1794052050335, "due_at": null, "done_at": null, "created_at": 1794052050335, "created_by": "usr-fitri-handayani", "modified_at": 1794052050335, "modified_by": "usr-fitri-handayani", "deleted_at": null, "deleted_by": null } ], "total": 2, "page": 1, "pageSize": 2 } ``` ## Log an activity `POST /api/crm/activities` Logs a call, email, meeting or note on a contact’s or deal’s timeline. `occurredAt` defaults to now; `dueAt` makes it a follow-up. Times are epoch milliseconds. * **Product:** CRM (`crm`) * **Permission (any of):** `crm:record:write` ### Request body (JSON) | Field | Type | Required | Description | | ------------- | ------------------------------------------------------ | -------- | --------------- | | `subjectType` | `"contact" \| "deal"` | yes | | | `subjectId` | `string` | yes | | | `kind` | `"call" \| "email" \| "meeting" \| "note" \| "system"` | yes | | | `title` | `string` | no | max length 300 | | `body` | `string` | no | max length 5000 | | `occurredAt` | `integer` | no | | | `dueAt` | `integer \| null` | no | | ### Response `201` The new activity. | Field | Type | Description | | -------------- | ------------------------------------------------------ | ------------------- | | `id` | `string` | | | `subject_type` | `"contact" \| "deal"` | | | `subject_id` | `string` | | | `kind` | `"call" \| "email" \| "meeting" \| "note" \| "system"` | | | `title` | `string \| null` | | | `body` | `string \| null` | | | `occurred_at` | `number` | Epoch milliseconds. | | `due_at` | `number \| null` | | | `done_at` | `number \| null` | | | `created_by` | `string \| null` | | | `created_at` | `number` | | Objects may carry more fields than listed; only the listed ones are part of the contract. **Errors:** `invalid_subject_type`, `subject_not_found`, plus the [shared ones](/docs/conventions/#errors). Meanings: [error codes](/docs/errors/). ### Example ```bash curl -X POST 'https://app.aio.opexcg.com/api/crm/activities' \ -H "X-API-Key: $OPEX_API_KEY" \ -H "content-type: application/json" \ -d '{"subjectType":"deal","subjectId":"c80cad76-7ec0-4641-a5f2-30ea2aaa4561","kind":"meeting","title":"Proposal walkthrough","occurredAt":1794052050341}' ``` Response `201`: ```json { "id": "b5c5c795-91da-4d91-b53d-fe7bd8b48d91", "tenant_id": "opexcg-tenant", "subject_type": "deal", "subject_id": "c80cad76-7ec0-4641-a5f2-30ea2aaa4561", "kind": "meeting", "title": "Proposal walkthrough", "body": null, "occurred_at": 1794052050341, "due_at": null, "done_at": null, "created_at": 1794052050369, "created_by": "usr-fitri-handayani", "modified_at": 1794052050369, "modified_by": "usr-fitri-handayani", "deleted_at": null, "deleted_by": null } ``` # Expenses API > Expenses, receipt capture and categories. The v1 endpoints, with parameters, responses and examples. Expenses, receipt capture and categories. Every endpoint below is part of the stable v1 contract. Base URL `https://app.aio.opexcg.com`; send your key in `X-API-Key`. * `GET /api/expenses`: List expenses * `GET /api/expenses/:id`: Get an expense * `POST /api/expenses`: Create an expense * `PATCH /api/expenses/:id`: Update an expense * `POST /api/expenses/:id/submit`: Submit an expense for approval * `POST /api/expenses/capture`: Capture a receipt * `GET /api/expenses/categories`: List expense categories ## List expenses `GET /api/expenses` Expenses you may see, newest first by default. A `dateFrom` or `dateTo` that is not `YYYY-MM-DD` answers 400. Amounts are integer minor units of `currency` (`totalCents: 8500000` in IDR is Rp 85.000). Sort keys: `created` (default), `issued`, `total`, `vendor`, `status`, `submittedBy`. * **Product:** Expenses (`expenses`) * **Permission:** any member ### Query parameters | Field | Type | Required | Description | | ------------- | -------- | -------- | ---------------------------------------------------------------- | | `page` | `string` | no | 1-based page number. Default 1. | | `pageSize` | `string` | no | Rows per page, 1 to 100. Larger values are clamped. Default 20. | | `search` | `string` | no | Free-text filter (trimmed, first 200 characters). | | `sort` | `string` | no | Sort key. Unknown keys fall back to the endpoint’s default sort. | | `dir` | `string` | no | `asc` or `desc` (default). | | `status` | `string` | no | `draft`, `pending`, `approved`, `rejected` or `paid`. | | `mine` | `string` | no | `1` or `true`: only expenses you submitted. | | `submitterId` | `string` | no | Only expenses of this member. | | `projectId` | `string` | no | Only expenses charged to this project. | | `dateFrom` | `string` | no | Issued on or after this day (`YYYY-MM-DD`). | | `dateTo` | `string` | no | Issued on or before this day (`YYYY-MM-DD`). | | `category` | `string` | no | Category name. | ### Response `200` One page of expenses. | Field | Type | Description | | ------------------------------ | ------------------------------------------------------------ | --------------------------------------------------- | | `items` | `object[]` | | | `items[].id` | `string` | | | `items[].submitted_by_user_id` | `string` | | | `items[].status` | `"draft" \| "pending" \| "approved" \| "rejected" \| "paid"` | | | `items[].vendor_name` | `string \| null` | | | `items[].invoice_number` | `string \| null` | | | `items[].document_kind` | `string` | `receipt`, `invoice`, … (`other` until recognised). | | `items[].issued_at` | `number \| null` | Epoch milliseconds. | | `items[].currency` | `string \| null` | | | `items[].subtotal_cents` | `number \| null` | | | `items[].tax_cents` | `number \| null` | | | `items[].total_cents` | `number \| null` | Integer minor units of `currency`. | | `items[].category` | `string \| null` | | | `items[].project_id` | `string \| null` | | | `items[].submission_id` | `string \| null` | The batch this expense was filed in, if any. | | `items[].rejection_reason` | `string \| null` | | | `items[].ocr_confidence` | `number \| null` | Set once receipt recognition ran. | | `items[].created_at` | `number` | | | `items[].project_name` | `string \| null` | | | `items[].submitted_by_name` | `string \| null` | | | `total` | `number` | | | `page` | `number` | | | `pageSize` | `number` | | Objects may carry more fields than listed; only the listed ones are part of the contract. **Errors:** `invalid_date_range`, plus the [shared ones](/docs/conventions/#errors). Meanings: [error codes](/docs/errors/). ### Example ```bash curl -X GET 'https://app.aio.opexcg.com/api/expenses?pageSize=2&search=Kopi' \ -H "X-API-Key: $OPEX_API_KEY" ``` Response `200`: ```json { "items": [ { "id": "79a3e8b7-b420-499b-adb9-a8d52c1fc5dc", "tenant_id": "opexcg-tenant", "submitted_by_user_id": "usr-fitri-handayani", "vendor_name": "Kopi Kenangan", "vendor_tax_id": null, "invoice_number": null, "document_kind": "receipt", "issued_at": 1793965650435, "due_at": null, "currency": "IDR", "subtotal_cents": 0, "tax_cents": 0, "total_cents": 8500000, "category": "Meals & Entertainment", "project_id": "99e5d1dd-334c-4bc3-88c7-7d84558bf7c6", "submission_id": null, "subject_type": null, "subject_id": null, "status": "draft", "ocr_raw_json": null, "ocr_confidence": null, "file_asset_id": null, "approved_by": null, "approved_at": null, "pm_approved_amount_cents": null, "pm_approved_currency": null, "pm_approved_project_id": null, "correction_requested_at": null, "rejection_reason": null, "reimbursed_at": null, "paid_at": null, "created_at": 1794052050465, "created_by": "usr-fitri-handayani", "modified_at": 1794052050465, "modified_by": "usr-fitri-handayani", "deleted_at": null, "deleted_by": null, "project_name": "Customer portal rollout", "submitted_by_name": "Fitri Handayani" }, { "id": "exp-opexcg-target-073", "tenant_id": "opexcg-tenant", "submitted_by_user_id": "usr-sari-wulandari", "vendor_name": "Kopi Kalyan", "vendor_tax_id": null, "invoice_number": "OPEXCG-TARGET-073", "document_kind": "receipt", "issued_at": 1789862400000, "due_at": null, "currency": "IDR", "subtotal_cents": 29000000, "tax_cents": 0, "total_cents": 29000000, "category": "Meals", "project_id": "prj-presales", "submission_id": "sub-opexcg-presales-01", "subject_type": null, "subject_id": null, "status": "pending", "ocr_raw_json": null, "ocr_confidence": null, "file_asset_id": null, "approved_by": null, "approved_at": null, "pm_approved_amount_cents": null, "pm_approved_currency": null, "pm_approved_project_id": null, "correction_requested_at": null, "rejection_reason": null, "reimbursed_at": null, "paid_at": null, "created_at": 1789776000000, "created_by": "usr-sari-wulandari", "modified_at": 1789776000000, "modified_by": "usr-sari-wulandari", "deleted_at": null, "deleted_by": null, "project_name": "Presales", "submitted_by_name": "Sari Wulandari" } ], "total": 2, "page": 1, "pageSize": 2 } ``` ## Get an expense `GET /api/expenses/:id` One expense with its line items. Amounts are integer minor units of `currency` (`totalCents: 8500000` in IDR is Rp 85.000). * **Product:** Expenses (`expenses`) * **Permission:** any member ### Path parameters | Field | Type | Required | Description | | ----- | -------- | -------- | ----------- | | `id` | `string` | yes | Expense id. | ### Response `200` The expense. | Field | Type | Description | | --------------------------- | ------------------------------------------------------------ | ----------------------------------------------------- | | `id` | `string` | | | `submitted_by_user_id` | `string` | | | `status` | `"draft" \| "pending" \| "approved" \| "rejected" \| "paid"` | | | `vendor_name` | `string \| null` | | | `invoice_number` | `string \| null` | | | `document_kind` | `string` | `receipt`, `invoice`, … (`other` until recognised). | | `issued_at` | `number \| null` | Epoch milliseconds. | | `currency` | `string \| null` | | | `subtotal_cents` | `number \| null` | | | `tax_cents` | `number \| null` | | | `total_cents` | `number \| null` | Integer minor units of `currency`. | | `category` | `string \| null` | | | `project_id` | `string \| null` | | | `submission_id` | `string \| null` | The batch this expense was filed in, if any. | | `rejection_reason` | `string \| null` | | | `ocr_confidence` | `number \| null` | Set once receipt recognition ran. | | `created_at` | `number` | | | `lines` | `object[]` | | | `lines[].id` | `string` | | | `lines[].description` | `string \| null` | | | `lines[].qty` | `number \| null` | | | `lines[].unit_amount_cents` | `number \| null` | | | `lines[].amount_cents` | `number` | | | `lines[].tax_cents` | `number` | | | `lines[].gl_code` | `string \| null` | | | `fileUrl` | `string \| null` | Path of the captured document (send your API key). | | `submitter_name` | `string \| null` | | | `approval_instance_id` | `string \| null` | Approval timeline: GET /api/approvals/instances/{id}. | Objects may carry more fields than listed; only the listed ones are part of the contract. **Errors:** `not_found`, plus the [shared ones](/docs/conventions/#errors). Meanings: [error codes](/docs/errors/). ### Example ```bash curl -X GET 'https://app.aio.opexcg.com/api/expenses/79a3e8b7-b420-499b-adb9-a8d52c1fc5dc' \ -H "X-API-Key: $OPEX_API_KEY" ``` Response `200`: ```json { "id": "79a3e8b7-b420-499b-adb9-a8d52c1fc5dc", "tenant_id": "opexcg-tenant", "submitted_by_user_id": "usr-fitri-handayani", "vendor_name": "Kopi Kenangan", "vendor_tax_id": null, "invoice_number": null, "document_kind": "receipt", "issued_at": 1793965650435, "due_at": null, "currency": "IDR", "subtotal_cents": 0, "tax_cents": 0, "total_cents": 8500000, "category": "Meals & Entertainment", "project_id": "99e5d1dd-334c-4bc3-88c7-7d84558bf7c6", "submission_id": null, "subject_type": null, "subject_id": null, "status": "draft", "ocr_raw_json": null, "ocr_confidence": null, "file_asset_id": null, "approved_by": null, "approved_at": null, "pm_approved_amount_cents": null, "pm_approved_currency": null, "pm_approved_project_id": null, "correction_requested_at": null, "rejection_reason": null, "reimbursed_at": null, "paid_at": null, "created_at": 1794052050465, "created_by": "usr-fitri-handayani", "modified_at": 1794052050465, "modified_by": "usr-fitri-handayani", "deleted_at": null, "deleted_by": null, "lines": [], "fileUrl": null, "attachments": [], "submitter_currency": null, "submitter_name": "Fitri Handayani", "approval_instance_id": null } ``` ## Create an expense `POST /api/expenses` Creates a draft expense filed by the caller. Amounts are integer minor units of `currency` (`totalCents: 8500000` in IDR is Rp 85.000). Dates are epoch milliseconds. Charging a project needs access to that project. * **Product:** Expenses (`expenses`) * **Permission:** any member ### Request body (JSON) | Field | Type | Required | Description | | ------------------------- | ---------------------------------------------------------- | -------- | -------------- | | `vendorName` | `string` | no | max length 200 | | `vendorTaxId` | `string` | no | max length 60 | | `invoiceNumber` | `string` | no | max length 120 | | `documentKind` | `"invoice" \| "receipt" \| "nota" \| "billing" \| "other"` | no | | | `issuedAt` | `integer` | no | | | `dueAt` | `integer \| null` | no | | | `currency` | `string` | no | max length 8 | | `subtotalCents` | `integer` | no | min 0 | | `taxCents` | `integer` | no | min 0 | | `totalCents` | `integer` | no | min 0 | | `category` | `string` | no | max length 120 | | `projectId` | `string \| null` | no | | | `subjectType` | `"ticket" \| "task" \| null` | no | | | `subjectId` | `string \| null` | no | | | `lines` | `object[]` | no | max 200 items | | `lines[].description` | `string` | no | max length 300 | | `lines[].qty` | `integer` | no | min 0 | | `lines[].unitAmountCents` | `integer` | no | min 0 | | `lines[].amountCents` | `integer` | no | min 0 | | `lines[].taxCents` | `integer` | no | min 0 | | `lines[].glCode` | `string` | no | max length 60 | ### Response `201` The new draft. | Field | Type | Description | | --------------------------- | ------------------------------------------------------------ | --------------------------------------------------- | | `id` | `string` | | | `submitted_by_user_id` | `string` | | | `status` | `"draft" \| "pending" \| "approved" \| "rejected" \| "paid"` | | | `vendor_name` | `string \| null` | | | `invoice_number` | `string \| null` | | | `document_kind` | `string` | `receipt`, `invoice`, … (`other` until recognised). | | `issued_at` | `number \| null` | Epoch milliseconds. | | `currency` | `string \| null` | | | `subtotal_cents` | `number \| null` | | | `tax_cents` | `number \| null` | | | `total_cents` | `number \| null` | Integer minor units of `currency`. | | `category` | `string \| null` | | | `project_id` | `string \| null` | | | `submission_id` | `string \| null` | The batch this expense was filed in, if any. | | `rejection_reason` | `string \| null` | | | `ocr_confidence` | `number \| null` | Set once receipt recognition ran. | | `created_at` | `number` | | | `lines` | `object[]` | | | `lines[].id` | `string` | | | `lines[].description` | `string \| null` | | | `lines[].qty` | `number \| null` | | | `lines[].unit_amount_cents` | `number \| null` | | | `lines[].amount_cents` | `number` | | | `lines[].tax_cents` | `number` | | | `lines[].gl_code` | `string \| null` | | Objects may carry more fields than listed; only the listed ones are part of the contract. ### Example ```bash curl -X POST 'https://app.aio.opexcg.com/api/expenses' \ -H "X-API-Key: $OPEX_API_KEY" \ -H "content-type: application/json" \ -d '{"vendorName":"Kopi Kenangan","documentKind":"receipt","issuedAt":1793965650435,"currency":"IDR","totalCents":8500000,"category":"Meals & Entertainment","projectId":"99e5d1dd-334c-4bc3-88c7-7d84558bf7c6"}' ``` Response `201`: ```json { "id": "79a3e8b7-b420-499b-adb9-a8d52c1fc5dc", "tenant_id": "opexcg-tenant", "submitted_by_user_id": "usr-fitri-handayani", "vendor_name": "Kopi Kenangan", "vendor_tax_id": null, "invoice_number": null, "document_kind": "receipt", "issued_at": 1793965650435, "due_at": null, "currency": "IDR", "subtotal_cents": 0, "tax_cents": 0, "total_cents": 8500000, "category": "Meals & Entertainment", "project_id": "99e5d1dd-334c-4bc3-88c7-7d84558bf7c6", "submission_id": null, "subject_type": null, "subject_id": null, "status": "draft", "ocr_raw_json": null, "ocr_confidence": null, "file_asset_id": null, "approved_by": null, "approved_at": null, "pm_approved_amount_cents": null, "pm_approved_currency": null, "pm_approved_project_id": null, "correction_requested_at": null, "rejection_reason": null, "reimbursed_at": null, "paid_at": null, "created_at": 1794052050465, "created_by": "usr-fitri-handayani", "modified_at": 1794052050465, "modified_by": "usr-fitri-handayani", "deleted_at": null, "deleted_by": null, "lines": [] } ``` ## Update an expense `PATCH /api/expenses/:id` Changes a draft. You can edit your own drafts; editing someone else’s needs `expenses:submission:manage`. Expenses that left draft answer 409 `locked`. * **Product:** Expenses (`expenses`) * **Permission:** any member * **Also:** Own drafts, or expenses:submission:manage. ### Path parameters | Field | Type | Required | Description | | ----- | -------- | -------- | ----------- | | `id` | `string` | yes | Expense id. | ### Request body (JSON) | Field | Type | Required | Description | | ------------------------- | ---------------------------------------------------------- | -------- | -------------- | | `vendorName` | `string` | no | max length 200 | | `vendorTaxId` | `string` | no | max length 60 | | `invoiceNumber` | `string` | no | max length 120 | | `documentKind` | `"invoice" \| "receipt" \| "nota" \| "billing" \| "other"` | no | | | `issuedAt` | `integer` | no | | | `dueAt` | `integer \| null` | no | | | `currency` | `string` | no | max length 8 | | `subtotalCents` | `integer` | no | min 0 | | `taxCents` | `integer` | no | min 0 | | `totalCents` | `integer` | no | min 0 | | `category` | `string` | no | max length 120 | | `projectId` | `string \| null` | no | | | `subjectType` | `"ticket" \| "task" \| null` | no | | | `subjectId` | `string \| null` | no | | | `lines` | `object[]` | no | max 200 items | | `lines[].description` | `string` | no | max length 300 | | `lines[].qty` | `integer` | no | min 0 | | `lines[].unitAmountCents` | `integer` | no | min 0 | | `lines[].amountCents` | `integer` | no | min 0 | | `lines[].taxCents` | `integer` | no | min 0 | | `lines[].glCode` | `string` | no | max length 60 | ### Response `200` The updated draft. | Field | Type | Description | | --------------------------- | ------------------------------------------------------------ | --------------------------------------------------- | | `id` | `string` | | | `submitted_by_user_id` | `string` | | | `status` | `"draft" \| "pending" \| "approved" \| "rejected" \| "paid"` | | | `vendor_name` | `string \| null` | | | `invoice_number` | `string \| null` | | | `document_kind` | `string` | `receipt`, `invoice`, … (`other` until recognised). | | `issued_at` | `number \| null` | Epoch milliseconds. | | `currency` | `string \| null` | | | `subtotal_cents` | `number \| null` | | | `tax_cents` | `number \| null` | | | `total_cents` | `number \| null` | Integer minor units of `currency`. | | `category` | `string \| null` | | | `project_id` | `string \| null` | | | `submission_id` | `string \| null` | The batch this expense was filed in, if any. | | `rejection_reason` | `string \| null` | | | `ocr_confidence` | `number \| null` | Set once receipt recognition ran. | | `created_at` | `number` | | | `lines` | `object[]` | | | `lines[].id` | `string` | | | `lines[].description` | `string \| null` | | | `lines[].qty` | `number \| null` | | | `lines[].unit_amount_cents` | `number \| null` | | | `lines[].amount_cents` | `number` | | | `lines[].tax_cents` | `number` | | | `lines[].gl_code` | `string \| null` | | Objects may carry more fields than listed; only the listed ones are part of the contract. **Errors:** `not_found`, `forbidden`, `locked`, `project_mismatch`, plus the [shared ones](/docs/conventions/#errors). Meanings: [error codes](/docs/errors/). ### Example ```bash curl -X PATCH 'https://app.aio.opexcg.com/api/expenses/79a3e8b7-b420-499b-adb9-a8d52c1fc5dc' \ -H "X-API-Key: $OPEX_API_KEY" \ -H "content-type: application/json" \ -d '{"totalCents":9000000}' ``` Response `200`: ```json { "id": "79a3e8b7-b420-499b-adb9-a8d52c1fc5dc", "tenant_id": "opexcg-tenant", "submitted_by_user_id": "usr-fitri-handayani", "vendor_name": "Kopi Kenangan", "vendor_tax_id": null, "invoice_number": null, "document_kind": "receipt", "issued_at": 1793965650435, "due_at": null, "currency": "IDR", "subtotal_cents": 0, "tax_cents": 0, "total_cents": 9000000, "category": "Meals & Entertainment", "project_id": "99e5d1dd-334c-4bc3-88c7-7d84558bf7c6", "submission_id": null, "subject_type": null, "subject_id": null, "status": "draft", "ocr_raw_json": null, "ocr_confidence": null, "file_asset_id": null, "approved_by": null, "approved_at": null, "pm_approved_amount_cents": null, "pm_approved_currency": null, "pm_approved_project_id": null, "correction_requested_at": null, "rejection_reason": null, "reimbursed_at": null, "paid_at": null, "created_at": 1794052050465, "created_by": "usr-fitri-handayani", "modified_at": 1794052050649, "modified_by": "usr-fitri-handayani", "deleted_at": null, "deleted_by": null, "lines": [] } ``` ## Submit an expense for approval `POST /api/expenses/:id/submit` Sends a draft (or a rejected expense) for approval. The answer carries the new status, usually `pending`; approvers then decide it through the approvals endpoints. Pending, approved and paid expenses answer 409 `invalid_transition`. * **Product:** Expenses (`expenses`) * **Permission:** any member * **Also:** Own drafts, or expenses:submission:manage. ### Path parameters | Field | Type | Required | Description | | ----- | -------- | -------- | ----------- | | `id` | `string` | yes | Expense id. | ### Response `200` The submitted expense. | Field | Type | Description | | ---------------------- | ------------------------------------------------------------ | --------------------------------------------------- | | `id` | `string` | | | `submitted_by_user_id` | `string` | | | `status` | `"draft" \| "pending" \| "approved" \| "rejected" \| "paid"` | | | `vendor_name` | `string \| null` | | | `invoice_number` | `string \| null` | | | `document_kind` | `string` | `receipt`, `invoice`, … (`other` until recognised). | | `issued_at` | `number \| null` | Epoch milliseconds. | | `currency` | `string \| null` | | | `subtotal_cents` | `number \| null` | | | `tax_cents` | `number \| null` | | | `total_cents` | `number \| null` | Integer minor units of `currency`. | | `category` | `string \| null` | | | `project_id` | `string \| null` | | | `submission_id` | `string \| null` | The batch this expense was filed in, if any. | | `rejection_reason` | `string \| null` | | | `ocr_confidence` | `number \| null` | Set once receipt recognition ran. | | `created_at` | `number` | | Objects may carry more fields than listed; only the listed ones are part of the contract. **Errors:** `not_found`, `forbidden`, `invalid_transition`, `submission_locked`, plus the [shared ones](/docs/conventions/#errors). Meanings: [error codes](/docs/errors/). ### Example ```bash curl -X POST 'https://app.aio.opexcg.com/api/expenses/79a3e8b7-b420-499b-adb9-a8d52c1fc5dc/submit' \ -H "X-API-Key: $OPEX_API_KEY" ``` Response `200`: ```json { "id": "79a3e8b7-b420-499b-adb9-a8d52c1fc5dc", "tenant_id": "opexcg-tenant", "submitted_by_user_id": "usr-fitri-handayani", "vendor_name": "Kopi Kenangan", "vendor_tax_id": null, "invoice_number": null, "document_kind": "receipt", "issued_at": 1793965650435, "due_at": null, "currency": "IDR", "subtotal_cents": 0, "tax_cents": 0, "total_cents": 9000000, "category": "Meals & Entertainment", "project_id": "99e5d1dd-334c-4bc3-88c7-7d84558bf7c6", "submission_id": null, "subject_type": null, "subject_id": null, "status": "pending", "ocr_raw_json": null, "ocr_confidence": null, "file_asset_id": null, "approved_by": null, "approved_at": null, "pm_approved_amount_cents": null, "pm_approved_currency": null, "pm_approved_project_id": null, "correction_requested_at": null, "rejection_reason": null, "reimbursed_at": null, "paid_at": null, "created_at": 1794052050465, "created_by": "usr-fitri-handayani", "modified_at": 1794052050824, "modified_by": "usr-fitri-handayani", "deleted_at": null, "deleted_by": null } ``` ## Capture a receipt `POST /api/expenses/capture` Uploads a receipt or invoice as `multipart/form-data` (field `file`) and creates a draft expense for it. Text recognition fills vendor, totals and lines a few seconds later, so read the expense again before submitting. Needs the Expenses `pro` tier; the file counts toward the workspace’s storage. * **Product:** Expenses (`expenses`) * **Permission:** any member * **Also:** Expenses pro tier (402 tier\_required otherwise). ### Request body (multipart/form-data) | Field | Type | Required | Description | | ------ | ------ | -------- | ----------------------------------------------------- | | `file` | `file` | yes | The receipt or invoice: an image or PDF, up to 25 MB. | ### Response `201` The new draft’s id. | Field | Type | Description | | ----- | -------- | ------------------- | | `id` | `string` | The new draft’s id. | Objects may carry more fields than listed; only the listed ones are part of the contract. **Errors:** `no_file`, `empty_file`, `too_large`, `quota_exceeded`, `tier_required`, plus the [shared ones](/docs/conventions/#errors). Meanings: [error codes](/docs/errors/). ### Example ```bash curl -X POST 'https://app.aio.opexcg.com/api/expenses/capture' \ -H "X-API-Key: $OPEX_API_KEY" \ -F "file=@receipt.jpg" ``` Response `201`: ```json { "id": "91a2aee5-6803-4a61-b64e-47e0b3462139" } ``` ## List expense categories `GET /api/expenses/categories` The workspace’s active expense categories. Use a category `name` as `category` on an expense. * **Product:** Expenses (`expenses`) * **Permission:** any member ### Response `200` The categories. | Field | Type | Description | | ----------------------- | ---------------- | ----------- | | `items` | `object[]` | | | `items[].id` | `string` | | | `items[].name` | `string` | | | `items[].description` | `string \| null` | | | `items[].is_active` | `number` | | | `items[].display_order` | `number` | | Objects may carry more fields than listed; only the listed ones are part of the contract. ### Example ```bash curl -X GET 'https://app.aio.opexcg.com/api/expenses/categories' \ -H "X-API-Key: $OPEX_API_KEY" ``` Response `200`: ```json { "items": [ { "id": "canonical:Travel & Transportation", "tenant_id": "", "name": "Travel & Transportation", "description": null, "is_active": 1, "display_order": 0, "created_at": 0, "created_by": null, "modified_at": 0, "modified_by": null, "deleted_at": null, "deleted_by": null }, { "id": "canonical:Meals & Entertainment", "tenant_id": "", "name": "Meals & Entertainment", "description": null, "is_active": 1, "display_order": 1, "created_at": 0, "created_by": null, "modified_at": 0, "modified_by": null, "deleted_at": null, "deleted_by": null } ] } ``` # Helpdesk API > Tickets: open, read, reply, update and close. The v1 endpoints, with parameters, responses and examples. Tickets: open, read, reply, update and close. Every endpoint below is part of the stable v1 contract. Base URL `https://app.aio.opexcg.com`; send your key in `X-API-Key`. * `GET /api/helpdesk/tickets`: List tickets * `GET /api/helpdesk/tickets/:id`: Get a ticket * `POST /api/helpdesk/tickets`: Open a ticket * `PATCH /api/helpdesk/tickets/:id`: Update a ticket * `POST /api/helpdesk/tickets/:id/events`: Reply or add a note * `POST /api/helpdesk/tickets/:id/close`: Close a ticket ## List tickets `GET /api/helpdesk/tickets` Tickets visible to the caller, newest first by default. Without `ticket:read` the page is empty. The workspace-wide queue needs `helpdesk:tickets:browse`; without it, pass `mine=1` to list your own tickets. Client users see their own tickets, and client admins their company’s. Sort keys: `created_at` (default), `modified_at`, `priority`, `status`, `number`, `title`, `sla_due` (soonest first). * **Product:** Helpdesk (`helpdesk`) * **Permission (any of):** `ticket:read` ### Query parameters | Field | Type | Required | Description | | ---------- | -------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `page` | `string` | no | 1-based page number. Default 1. | | `pageSize` | `string` | no | Rows per page, 1 to 100. Larger values are clamped. Default 20. | | `search` | `string` | no | Free-text filter (trimmed, first 200 characters). | | `sort` | `string` | no | Sort key. Unknown keys fall back to the endpoint’s default sort. | | `dir` | `string` | no | `asc` or `desc` (default). | | `mine` | `string` | no | Only tickets you requested, created or the requester cc’d you on (collaborators). Follower assignments made by admins or support managers are not included. `1` or `true` to enable. Callers without helpdesk:tickets:browse need it to see anything. | | `status` | `string` | no | Status code, e.g. `new`, `in_progress`, `resolved`. | | `priority` | `string` | no | Priority: `low`, `normal`, `high` or `urgent`. | | `category` | `string` | no | Category text. | | `from` | `string` | no | Created at or after this time (epoch milliseconds). | | `to` | `string` | no | Created at or before this time (epoch milliseconds). | ### Response `200` One page of tickets. | Field | Type | Description | | -------------------------------- | ---------------- | -------------------------------------------------- | | `items` | `object[]` | | | `items[].id` | `string` | | | `items[].number` | `string` | Human-facing number, e.g. `SUP-2026-000011`. | | `items[].title` | `string` | | | `items[].body` | `string` | HTML. | | `items[].status` | `string` | Current status code. | | `items[].priority` | `string` | | | `items[].category` | `string \| null` | | | `items[].module` | `string \| null` | | | `items[].product` | `string \| null` | | | `items[].project_id` | `string \| null` | | | `items[].product_id` | `string \| null` | | | `items[].requester_id` | `string \| null` | | | `items[].requester_name` | `string \| null` | | | `items[].assignee_id` | `string \| null` | | | `items[].assignee_name` | `string \| null` | | | `items[].company_name` | `string \| null` | | | `items[].sla_due` | `number \| null` | Resolution deadline, epoch milliseconds. | | `items[].ai_answered` | `number` | 1 when the AI answered the ticket. | | `items[].created_at` | `number` | | | `items[].modified_at` | `number \| null` | | | `items[].resolved_at` | `number \| null` | | | `items[].masters` | `object` | Display data of the status, priority and category. | | `items[].masters.status` | `object` | | | `items[].masters.status.id` | `string \| null` | | | `items[].masters.status.code` | `string` | | | `items[].masters.status.name` | `string` | | | `items[].masters.status.color` | `string \| null` | | | `items[].masters.status.final` | `boolean` | Status only: whether this status ends the ticket. | | `items[].masters.priority` | `object` | | | `items[].masters.priority.id` | `string \| null` | | | `items[].masters.priority.code` | `string` | | | `items[].masters.priority.name` | `string` | | | `items[].masters.priority.color` | `string \| null` | | | `items[].masters.priority.final` | `boolean` | Status only: whether this status ends the ticket. | | `items[].masters.category` | `object` | | | `items[].masters.category.id` | `string \| null` | | | `items[].masters.category.code` | `string` | | | `items[].masters.category.name` | `string` | | | `items[].masters.category.color` | `string \| null` | | | `items[].masters.category.final` | `boolean` | Status only: whether this status ends the ticket. | | `total` | `number` | | | `page` | `number` | | | `pageSize` | `number` | | Objects may carry more fields than listed; only the listed ones are part of the contract. ### Example ```bash curl -X GET 'https://app.aio.opexcg.com/api/helpdesk/tickets?pageSize=2&search=CSV' \ -H "X-API-Key: $OPEX_API_KEY" ``` Response `200`: ```json { "items": [ { "id": "8defe6e2-afcd-46ba-a041-da8fdd7665ff", "tenant_id": "opexcg-tenant", "company_id": "comp-xyzind", "project_id": "99e5d1dd-334c-4bc3-88c7-7d84558bf7c6", "product_id": "prod-epicor", "scope": null, "impact": null, "complexity": null, "service_contract_id": null, "number": "SUP-2026-000013", "title": "Export to CSV times out", "body": "Exporting more than 5,000 rows times out after 30 seconds.", "module": null, "product": null, "epicor_environment": null, "priority": "high", "status": "new", "category": null, "triage_confidence": null, "triage_reasoning": null, "triage_completed_at": null, "triage_completed_by": null, "triage_completed_reason": null, "triage_completed_manually": 0, "ai_answered": 0, "suggested_assignee_id": null, "assignee_id": null, "assigned_product_group_id": null, "assigned_project_group_id": null, "requester_id": "usr-fitri-handayani", "external_requester_email": null, "external_requester_name": null, "email_route_id": null, "source": "web", "external_id": null, "duplicate_of_id": null, "dup_score": null, "resolution_text": null, "sla_due": 1794138449198, "sla_policy_id": "slp-default", "sla_response_mins": 240, "sla_resolution_mins": 1440, "sla_business_hours": "24x7", "effort_hours": null, "week_start": null, "created_at": 1794052049198, "created_by": "usr-fitri-handayani", "modified_at": 1794052049198, "modified_by": "usr-fitri-handayani", "deleted_at": null, "deleted_by": null, "resolved_at": null, "last_client_reply_at": 1794052049198, "last_agent_reply_at": 1794052049198, "last_status_change_at": 1794052049198, "external_updated_at": null, "ticket_category_id": null, "ticket_priority_id": null, "ticket_status_id": "st-NEW", "masters": { "category": { "id": null, "code": "", "name": "—", "color": null, "group": null, "group_name": null, "rank": null, "active": false, "resolved": false, "final": false, "isFallback": true }, "priority": { "id": null, "code": "high", "name": "High", "color": null, "group": null, "group_name": null, "rank": null, "active": false, "resolved": false, "final": false, "isFallback": true }, "status": { "id": "st-NEW", "code": "NEW", "name": "New", "color": "blue", "group": "OPEN", "group_name": "Open", "rank": null, "active": true, "resolved": false, "final": false, "isFallback": false } }, "company_name": "XYZ Industries", "requester_name": "Fitri Handayani", "product_name": "Epicor", "assignee_name": null, "assignee_avatar_url": null, "assignee_active": null, "sla_policy_name": "Workspace Default", "triage": { "locked": true, "lockReason": "Complete the triage review before assigning a consultant." } } ], "total": 1, "page": 1, "pageSize": 2 } ``` ## Get a ticket `GET /api/helpdesk/tickets/:id` One ticket with its conversation (`events`). Internal notes are included only for internal staff. * **Product:** Helpdesk (`helpdesk`) * **Permission (any of):** `ticket:read` ### Path parameters | Field | Type | Required | Description | | ----- | -------- | -------- | -------------------------------- | | `id` | `string` | yes | Ticket id (not the SUP- number). | ### Response `200` The ticket. | Field | Type | Description | | ------------------------------- | ----------------------------- | -------------------------------------------------- | | `ticket` | `object` | | | `ticket.id` | `string` | | | `ticket.number` | `string` | Human-facing number, e.g. `SUP-2026-000011`. | | `ticket.title` | `string` | | | `ticket.body` | `string` | HTML. | | `ticket.status` | `string` | Current status code. | | `ticket.priority` | `string` | | | `ticket.category` | `string \| null` | | | `ticket.module` | `string \| null` | | | `ticket.product` | `string \| null` | | | `ticket.project_id` | `string \| null` | | | `ticket.product_id` | `string \| null` | | | `ticket.requester_id` | `string \| null` | | | `ticket.requester_name` | `string \| null` | | | `ticket.assignee_id` | `string \| null` | | | `ticket.assignee_name` | `string \| null` | | | `ticket.company_name` | `string \| null` | | | `ticket.sla_due` | `number \| null` | Resolution deadline, epoch milliseconds. | | `ticket.ai_answered` | `number` | 1 when the AI answered the ticket. | | `ticket.created_at` | `number` | | | `ticket.modified_at` | `number \| null` | | | `ticket.resolved_at` | `number \| null` | | | `ticket.masters` | `object` | Display data of the status, priority and category. | | `ticket.masters.status` | `object` | | | `ticket.masters.status.id` | `string \| null` | | | `ticket.masters.status.code` | `string` | | | `ticket.masters.status.name` | `string` | | | `ticket.masters.status.color` | `string \| null` | | | `ticket.masters.status.final` | `boolean` | Status only: whether this status ends the ticket. | | `ticket.masters.priority` | `object` | | | `ticket.masters.priority.id` | `string \| null` | | | `ticket.masters.priority.code` | `string` | | | `ticket.masters.priority.name` | `string` | | | `ticket.masters.priority.color` | `string \| null` | | | `ticket.masters.priority.final` | `boolean` | Status only: whether this status ends the ticket. | | `ticket.masters.category` | `object` | | | `ticket.masters.category.id` | `string \| null` | | | `ticket.masters.category.code` | `string` | | | `ticket.masters.category.name` | `string` | | | `ticket.masters.category.color` | `string \| null` | | | `ticket.masters.category.final` | `boolean` | Status only: whether this status ends the ticket. | | `events` | `object[]` | The conversation, oldest first. | | `events[].id` | `string` | | | `events[].kind` | `string` | `comment`, `internal_note`, `status_change`, … | | `events[].author_kind` | `"human" \| "ai" \| "system"` | | | `events[].author_id` | `string \| null` | | | `events[].author_name` | `string \| null` | | | `events[].body` | `string \| null` | HTML. | | `events[].created_at` | `number` | | Objects may carry more fields than listed; only the listed ones are part of the contract. **Errors:** `not_found`, `forbidden`, plus the [shared ones](/docs/conventions/#errors). Meanings: [error codes](/docs/errors/). ### Example ```bash curl -X GET 'https://app.aio.opexcg.com/api/helpdesk/tickets/8defe6e2-afcd-46ba-a041-da8fdd7665ff' \ -H "X-API-Key: $OPEX_API_KEY" ``` Response `200`: ```json { "ticket": { "id": "8defe6e2-afcd-46ba-a041-da8fdd7665ff", "tenant_id": "opexcg-tenant", "company_id": "comp-xyzind", "project_id": "99e5d1dd-334c-4bc3-88c7-7d84558bf7c6", "product_id": "prod-epicor", "scope": null, "impact": null, "complexity": null, "service_contract_id": null, "number": "SUP-2026-000013", "title": "Export to CSV times out", "body": "Exporting more than 5,000 rows times out after 30 seconds.", "module": null, "product": null, "epicor_environment": null, "priority": "high", "status": "new", "category": null, "triage_confidence": null, "triage_reasoning": null, "triage_completed_at": null, "triage_completed_by": null, "triage_completed_reason": null, "triage_completed_manually": 0, "ai_answered": 0, "suggested_assignee_id": null, "assignee_id": null, "assigned_product_group_id": null, "assigned_project_group_id": null, "requester_id": "usr-fitri-handayani", "external_requester_email": null, "external_requester_name": null, "email_route_id": null, "source": "web", "external_id": null, "duplicate_of_id": null, "dup_score": null, "resolution_text": null, "sla_due": 1794138449198, "sla_policy_id": "slp-default", "sla_response_mins": 240, "sla_resolution_mins": 1440, "sla_business_hours": "24x7", "effort_hours": null, "week_start": null, "created_at": 1794052049198, "created_by": "usr-fitri-handayani", "modified_at": 1794052049198, "modified_by": "usr-fitri-handayani", "deleted_at": null, "deleted_by": null, "resolved_at": null, "last_client_reply_at": 1794052049198, "last_agent_reply_at": 1794052049198, "last_status_change_at": 1794052049198, "external_updated_at": null, "ticket_category_id": null, "ticket_priority_id": null, "ticket_status_id": "st-NEW", "requester_name": "Fitri Handayani", "assignee_name": null, "assignee_avatar_url": null, "masters": { "category": { "id": null, "code": "", "name": "—", "color": null, "group": null, "group_name": null, "rank": null, "active": false, "resolved": false, "final": false, "isFallback": true }, "priority": { "id": null, "code": "high", "name": "High", "color": null, "group": null, "group_name": null, "rank": null, "active": false, "resolved": false, "final": false, "isFallback": true }, "status": { "id": "st-NEW", "code": "NEW", "name": "New", "color": "blue", "group": "OPEN", "group_name": "Open", "rank": null, "active": true, "resolved": false, "final": false, "isFallback": false } } }, "events": [ { "id": "5468efd1-0b36-4e67-9c5e-9abc6b03bd99", "tenant_id": "opexcg-tenant", "ticket_id": "8defe6e2-afcd-46ba-a041-da8fdd7665ff", "author_id": null, "author_kind": "system", "kind": "status_change", "body": "Ticket created — New", "meta_json": null, "created_at": 1794052049198, "created_by": "usr-fitri-handayani", "deleted_at": null, "deleted_by": null, "external_id": null, "synced": 0, "author_name": null, "author_avatar_url": null }, { "id": "85307395-dee3-48b7-bede-1308e17fe64d", "tenant_id": "opexcg-tenant", "ticket_id": "8defe6e2-afcd-46ba-a041-da8fdd7665ff", "author_id": null, "author_kind": "system", "kind": "comment", "body": "Thank you for contacting OpexCG support. Your ticket has been received and our team will review it shortly. Ticket number: SUP-2026-000013", "meta_json": "{\"source\":\"automation\",\"kind\":\"auto_reply\"}", "created_at": 1794052049404, "created_by": null, "deleted_at": null, "deleted_by": null, "external_id": null, "synced": 0, "author_name": null, "author_avatar_url": null } ], "supportWarning": { "type": "no_agreement", "message": "Project \"Customer portal rollout\" has no Support Service Agreement. Consider rejecting this ticket.", "internalMessage": "Project \"Customer portal rollout\" has no Support Service Agreement. Consider rejecting this ticket.", "clientMessage": "Project \"Customer portal rollout\" has no active Support Service Agreement. This ticket may be rejected.", "expiryDate": null }, "collaborators": null, "journey": { "visitedCodes": [ "NEW" ], "currentCategory": "OPEN", "previousStage": null }, "triage": { "complete": false, "completeWithoutAi": false, "awaitingReview": false, "locked": true, "lockReason": "Complete the triage review before assigning a consultant.", "phase": "queued" } } ``` ## Open a ticket `POST /api/helpdesk/tickets` Opens a ticket on a project (`projectId`), or on a product (`productId`), in which case the company is resolved from the requester’s email domain. Any member may open a ticket. The response says whether the ticket looks like a duplicate and whether the AI answered it straight away. * **Product:** Helpdesk (`helpdesk`) * **Permission:** any member ### Request body (JSON) | Field | Type | Required | Description | | ------------------- | ----------------------------------------- | -------- | ------------------------------ | | `projectId` | `string` | no | min length 1 | | `productId` | `string` | no | min length 1 | | `companyId` | `string` | no | min length 1 | | `companyName` | `string` | no | min length 1, max length 120 | | `title` | `string` | yes | min length 3, max length 200 | | `body` | `string` | yes | min length 1, max length 20000 | | `module` | `string` | no | max length 80 | | `epicorEnvironment` | `string` | no | max length 80 | | `priorityId` | `string` | no | min length 1 | | `categoryId` | `string` | no | min length 1 | | `priority` | `"low" \| "normal" \| "high" \| "urgent"` | no | default `"normal"` | | `customFields` | `object` | no | | | `collaboratorIds` | `string[]` | no | max 20 items | | `ccCompanyGroup` | `boolean` | no | | | `ccEmails` | `string[]` | no | max 10 items | ### Response `201` The new ticket. | Field | Type | Description | | ------------------------------- | ---------------- | ------------------------------------------------------------- | | `ticket` | `object` | | | `ticket.id` | `string` | | | `ticket.number` | `string` | Human-facing number, e.g. `SUP-2026-000011`. | | `ticket.title` | `string` | | | `ticket.body` | `string` | HTML. | | `ticket.status` | `string` | Current status code. | | `ticket.priority` | `string` | | | `ticket.category` | `string \| null` | | | `ticket.module` | `string \| null` | | | `ticket.product` | `string \| null` | | | `ticket.project_id` | `string \| null` | | | `ticket.product_id` | `string \| null` | | | `ticket.requester_id` | `string \| null` | | | `ticket.requester_name` | `string \| null` | | | `ticket.assignee_id` | `string \| null` | | | `ticket.assignee_name` | `string \| null` | | | `ticket.company_name` | `string \| null` | | | `ticket.sla_due` | `number \| null` | Resolution deadline, epoch milliseconds. | | `ticket.ai_answered` | `number` | 1 when the AI answered the ticket. | | `ticket.created_at` | `number` | | | `ticket.modified_at` | `number \| null` | | | `ticket.resolved_at` | `number \| null` | | | `ticket.masters` | `object` | Display data of the status, priority and category. | | `ticket.masters.status` | `object` | | | `ticket.masters.status.id` | `string \| null` | | | `ticket.masters.status.code` | `string` | | | `ticket.masters.status.name` | `string` | | | `ticket.masters.status.color` | `string \| null` | | | `ticket.masters.status.final` | `boolean` | Status only: whether this status ends the ticket. | | `ticket.masters.priority` | `object` | | | `ticket.masters.priority.id` | `string \| null` | | | `ticket.masters.priority.code` | `string` | | | `ticket.masters.priority.name` | `string` | | | `ticket.masters.priority.color` | `string \| null` | | | `ticket.masters.priority.final` | `boolean` | Status only: whether this status ends the ticket. | | `ticket.masters.category` | `object` | | | `ticket.masters.category.id` | `string \| null` | | | `ticket.masters.category.code` | `string` | | | `ticket.masters.category.name` | `string` | | | `ticket.masters.category.color` | `string \| null` | | | `ticket.masters.category.final` | `boolean` | Status only: whether this status ends the ticket. | | `duplicate` | `object \| null` | An open ticket this one most likely duplicates. | | `duplicate.id` | `string` | | | `duplicate.number` | `string` | | | `duplicate.title` | `string` | | | `duplicate.score` | `number` | | | `aiAnswered` | `boolean` | | | `aiAnswerBody` | `string \| null` | | | `supportWarning` | `object \| null` | Set when the project’s support service is missing or expired. | | `supportWarning.type` | `string` | | | `supportWarning.message` | `string` | | | `supportWarning.expiryDate` | `number \| null` | | Objects may carry more fields than listed; only the listed ones are part of the contract. **Errors:** `project_not_found`, `config_error`, plus the [shared ones](/docs/conventions/#errors). Meanings: [error codes](/docs/errors/). ### Example ```bash curl -X POST 'https://app.aio.opexcg.com/api/helpdesk/tickets' \ -H "X-API-Key: $OPEX_API_KEY" \ -H "content-type: application/json" \ -d '{"projectId":"99e5d1dd-334c-4bc3-88c7-7d84558bf7c6","title":"Export to CSV times out","body":"Exporting more than 5,000 rows times out after 30 seconds.","priority":"high"}' ``` Response `201`: ```json { "ticket": { "id": "8defe6e2-afcd-46ba-a041-da8fdd7665ff", "tenant_id": "opexcg-tenant", "company_id": "comp-xyzind", "project_id": "99e5d1dd-334c-4bc3-88c7-7d84558bf7c6", "product_id": "prod-epicor", "scope": null, "impact": null, "complexity": null, "service_contract_id": null, "number": "SUP-2026-000013", "title": "Export to CSV times out", "body": "Exporting more than 5,000 rows times out after 30 seconds.", "module": null, "product": null, "epicor_environment": null, "priority": "high", "status": "new", "category": null, "triage_confidence": null, "triage_reasoning": null, "triage_completed_at": null, "triage_completed_by": null, "triage_completed_reason": null, "triage_completed_manually": 0, "ai_answered": 0, "suggested_assignee_id": null, "assignee_id": null, "assigned_product_group_id": null, "assigned_project_group_id": null, "requester_id": "usr-fitri-handayani", "external_requester_email": null, "external_requester_name": null, "email_route_id": null, "source": "web", "external_id": null, "duplicate_of_id": null, "dup_score": null, "resolution_text": null, "sla_due": 1794138449198, "sla_policy_id": "slp-default", "sla_response_mins": 240, "sla_resolution_mins": 1440, "sla_business_hours": "24x7", "effort_hours": null, "week_start": null, "created_at": 1794052049198, "created_by": "usr-fitri-handayani", "modified_at": 1794052049198, "modified_by": "usr-fitri-handayani", "deleted_at": null, "deleted_by": null, "resolved_at": null, "last_client_reply_at": 1794052049198, "last_agent_reply_at": 1794052049198, "last_status_change_at": 1794052049198, "external_updated_at": null, "ticket_category_id": null, "ticket_priority_id": null, "ticket_status_id": "st-NEW", "requester_name": "Fitri Handayani", "assignee_name": null, "assignee_avatar_url": null, "masters": { "category": { "id": null, "code": "", "name": "—", "color": null, "group": null, "group_name": null, "rank": null, "active": false, "resolved": false, "final": false, "isFallback": true }, "priority": { "id": null, "code": "high", "name": "High", "color": null, "group": null, "group_name": null, "rank": null, "active": false, "resolved": false, "final": false, "isFallback": true }, "status": { "id": "st-NEW", "code": "NEW", "name": "New", "color": "blue", "group": "OPEN", "group_name": "Open", "rank": null, "active": true, "resolved": false, "final": false, "isFallback": false } } }, "duplicate": null, "aiAnswered": false, "aiAnswerBody": null, "supportWarning": { "type": "no_agreement", "message": "Project \"Customer portal rollout\" has no Support Service Agreement. Consider rejecting this ticket.", "internalMessage": "Project \"Customer portal rollout\" has no Support Service Agreement. Consider rejecting this ticket.", "clientMessage": "Project \"Customer portal rollout\" has no active Support Service Agreement. This ticket may be rejected.", "expiryDate": null } } ``` ## Update a ticket `PATCH /api/helpdesk/tickets/:id` Changes priority, category, product, project or module (staff only). Pass master ids from the workspace’s configured priorities and categories; omitted fields stay as they are. * **Product:** Helpdesk (`helpdesk`) * **Permission (any of):** `helpdesk:ticket:work` ### Path parameters | Field | Type | Required | Description | | ----- | -------- | -------- | -------------------------------- | | `id` | `string` | yes | Ticket id (not the SUP- number). | ### Request body (JSON) | Field | Type | Required | Description | | ------------- | ---------------- | -------- | ------------ | | `priorityId` | `string` | no | min length 1 | | `categoryId` | `string` | no | min length 1 | | `productId` | `string \| null` | no | | | `projectId` | `string \| null` | no | | | `companyId` | `string` | no | min length 1 | | `module` | `string \| null` | no | | | `requesterId` | `string` | no | min length 1 | ### Response `200` The updated ticket. | Field | Type | Description | | ------------------------------- | ---------------- | -------------------------------------------------- | | `ticket` | `object \| null` | | | `ticket.id` | `string` | | | `ticket.number` | `string` | Human-facing number, e.g. `SUP-2026-000011`. | | `ticket.title` | `string` | | | `ticket.body` | `string` | HTML. | | `ticket.status` | `string` | Current status code. | | `ticket.priority` | `string` | | | `ticket.category` | `string \| null` | | | `ticket.module` | `string \| null` | | | `ticket.product` | `string \| null` | | | `ticket.project_id` | `string \| null` | | | `ticket.product_id` | `string \| null` | | | `ticket.requester_id` | `string \| null` | | | `ticket.requester_name` | `string \| null` | | | `ticket.assignee_id` | `string \| null` | | | `ticket.assignee_name` | `string \| null` | | | `ticket.company_name` | `string \| null` | | | `ticket.sla_due` | `number \| null` | Resolution deadline, epoch milliseconds. | | `ticket.ai_answered` | `number` | 1 when the AI answered the ticket. | | `ticket.created_at` | `number` | | | `ticket.modified_at` | `number \| null` | | | `ticket.resolved_at` | `number \| null` | | | `ticket.masters` | `object` | Display data of the status, priority and category. | | `ticket.masters.status` | `object` | | | `ticket.masters.status.id` | `string \| null` | | | `ticket.masters.status.code` | `string` | | | `ticket.masters.status.name` | `string` | | | `ticket.masters.status.color` | `string \| null` | | | `ticket.masters.status.final` | `boolean` | Status only: whether this status ends the ticket. | | `ticket.masters.priority` | `object` | | | `ticket.masters.priority.id` | `string \| null` | | | `ticket.masters.priority.code` | `string` | | | `ticket.masters.priority.name` | `string` | | | `ticket.masters.priority.color` | `string \| null` | | | `ticket.masters.priority.final` | `boolean` | Status only: whether this status ends the ticket. | | `ticket.masters.category` | `object` | | | `ticket.masters.category.id` | `string \| null` | | | `ticket.masters.category.code` | `string` | | | `ticket.masters.category.name` | `string` | | | `ticket.masters.category.color` | `string \| null` | | | `ticket.masters.category.final` | `boolean` | Status only: whether this status ends the ticket. | Objects may carry more fields than listed; only the listed ones are part of the contract. **Errors:** `not_found`, `forbidden`, `master_invalid`, `product_not_found`, `project_not_found`, `project_inactive`, plus the [shared ones](/docs/conventions/#errors). Meanings: [error codes](/docs/errors/). ### Example ```bash curl -X PATCH 'https://app.aio.opexcg.com/api/helpdesk/tickets/8defe6e2-afcd-46ba-a041-da8fdd7665ff' \ -H "X-API-Key: $OPEX_API_KEY" \ -H "content-type: application/json" \ -d '{"priorityId":"prio-LOW"}' ``` Response `200`: ```json { "ticket": { "id": "8defe6e2-afcd-46ba-a041-da8fdd7665ff", "tenant_id": "opexcg-tenant", "company_id": "comp-xyzind", "project_id": "99e5d1dd-334c-4bc3-88c7-7d84558bf7c6", "product_id": "prod-epicor", "scope": null, "impact": null, "complexity": null, "service_contract_id": null, "number": "SUP-2026-000013", "title": "Export to CSV times out", "body": "Exporting more than 5,000 rows times out after 30 seconds.", "module": null, "product": null, "epicor_environment": null, "priority": "low", "status": "new", "category": null, "triage_confidence": null, "triage_reasoning": null, "triage_completed_at": null, "triage_completed_by": null, "triage_completed_reason": null, "triage_completed_manually": 0, "triage_phase": "queued", "ai_answered": 0, "suggested_assignee_id": null, "assignee_id": null, "assigned_product_group_id": null, "assigned_project_group_id": null, "requester_id": "usr-fitri-handayani", "external_requester_email": null, "external_requester_name": null, "email_route_id": null, "source": "web", "external_id": null, "duplicate_of_id": null, "dup_score": null, "resolution_text": null, "sla_due": 1794138449198, "sla_policy_id": "slp-default", "sla_response_mins": 240, "sla_resolution_mins": 1440, "sla_business_hours": "24x7", "effort_hours": null, "week_start": null, "created_at": 1794052049198, "created_by": "usr-fitri-handayani", "modified_at": 1794052049795, "modified_by": "usr-fitri-handayani", "deleted_at": null, "deleted_by": null, "resolved_at": null, "last_client_reply_at": 1794052049198, "last_agent_reply_at": 1794052049198, "last_status_change_at": 1794052049198, "external_updated_at": null, "ticket_category_id": null, "ticket_priority_id": "prio-LOW", "ticket_status_id": "st-NEW", "requester_name": "Fitri Handayani", "assignee_name": null, "assignee_avatar_url": null, "masters": { "category": { "id": null, "code": "", "name": "—", "color": null, "group": null, "group_name": null, "rank": null, "active": false, "resolved": false, "final": false, "isFallback": true }, "priority": { "id": "prio-LOW", "code": "LOW", "name": "Low", "color": "gray", "group": null, "group_name": null, "rank": 4, "active": true, "resolved": false, "final": false, "isFallback": false }, "status": { "id": "st-NEW", "code": "NEW", "name": "New", "color": "blue", "group": "OPEN", "group_name": "Open", "rank": null, "active": true, "resolved": false, "final": false, "isFallback": false } } } } ``` ## Reply or add a note `POST /api/helpdesk/tickets/:id/events` Adds a public reply, or an internal note with `internal: true` (staff only). Staff can move the ticket in the same call with `statusPurpose` (a status code of the workspace’s status workflow). Public staff replies are emailed to the requester. * **Product:** Helpdesk (`helpdesk`) * **Permission (any of):** `ticket:read` * **Also:** Requesters may reply to their own tickets; internal notes and status moves need staff access. ### Path parameters | Field | Type | Required | Description | | ----- | -------- | -------- | -------------------------------- | | `id` | `string` | yes | Ticket id (not the SUP- number). | ### Request body (JSON) | Field | Type | Required | Description | | --------------- | --------------------------------------------------------------------------------------- | -------- | ------------------------------ | | `body` | `string` | yes | min length 1, max length 20000 | | `internal` | `boolean` | no | default `false` | | `mentions` | `string[]` | no | max 20 items | | `status` | `"new" \| "in_progress" \| "awaiting_requester" \| "pending_third_party" \| "resolved"` | no | | | `statusPurpose` | `string` | no | min length 1, max length 40 | | `cc` | `string[]` | no | max 10 items | | `bcc` | `string[]` | no | max 10 items | | `signature` | `boolean` | no | | ### Response `200` The new event id. | Field | Type | Description | | ----- | -------- | ------------------- | | `ok` | `true` | | | `id` | `string` | The new event’s id. | Objects may carry more fields than listed; only the listed ones are part of the contract. **Errors:** `not_found`, `forbidden`, `cc_bcc_staff_only`, `cc_bcc_internal_note`, plus the [shared ones](/docs/conventions/#errors). Meanings: [error codes](/docs/errors/). ### Example ```bash curl -X POST 'https://app.aio.opexcg.com/api/helpdesk/tickets/8defe6e2-afcd-46ba-a041-da8fdd7665ff/events' \ -H "X-API-Key: $OPEX_API_KEY" \ -H "content-type: application/json" \ -d '{"body":"Reproduced on 6,200 rows. Looking at the query plan.","internal":true}' ``` Response `200`: ```json { "ok": true, "id": "35cb9a0a-601e-4425-8676-de8e317d3136" } ``` ## Close a ticket `POST /api/helpdesk/tickets/:id/close` Moves the ticket to the closed status of the workspace’s status workflow and emails the requester. Consultants can close only tickets assigned to them. When the workflow still waits for other actions, the ticket stays put and the answer lists them in `awaitingTriggers`. * **Product:** Helpdesk (`helpdesk`) * **Permission (any of):** `helpdesk:ticket:work` ### Path parameters | Field | Type | Required | Description | | ----- | -------- | -------- | -------------------------------- | | `id` | `string` | yes | Ticket id (not the SUP- number). | ### Response `200` The new status. | Field | Type | Description | | ------------------ | ---------- | --------------------------------------------------------------------- | | `ok` | `true` | | | `status` | `string` | The ticket’s status code after the call. | | `awaitingTriggers` | `string[]` | Actions the status workflow still waits for; the ticket did not move. | Objects may carry more fields than listed; only the listed ones are part of the contract. **Errors:** `not_found`, `forbidden`, plus the [shared ones](/docs/conventions/#errors). Meanings: [error codes](/docs/errors/). ### Example ```bash curl -X POST 'https://app.aio.opexcg.com/api/helpdesk/tickets/8defe6e2-afcd-46ba-a041-da8fdd7665ff/close' \ -H "X-API-Key: $OPEX_API_KEY" ``` Response `200`: ```json { "ok": true, "status": "CLOSED" } ``` # Leave API > Leave requests, balances, types and cover. The v1 endpoints, with parameters, responses and examples. Leave requests, balances, types and cover. Every endpoint below is part of the stable v1 contract. Base URL `https://app.aio.opexcg.com`; send your key in `X-API-Key`. * `GET /api/leave/requests`: List leave requests * `GET /api/leave/requests/:id`: Get a leave request * `POST /api/leave/requests`: Request leave * `POST /api/leave/requests/:id/cancel`: Cancel a leave request * `GET /api/leave/balances/mine`: Get your leave balances * `GET /api/leave/types`: List leave types * `GET /api/leave/peers`: List colleagues who can cover ## List leave requests `GET /api/leave/requests` Your own leave requests, or the team’s with `scope=team`. Dates are epoch milliseconds at UTC midnight. Sort keys: `start_date` (default), `status`, `created_at`. * **Product:** Leave (`leave`) * **Permission (any of):** `leave:request:read_own`, `leave:request:read_others`, `leave:report:read` ### Query parameters | Field | Type | Required | Description | | ---------- | -------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------ | | `page` | `string` | no | 1-based page number. Default 1. | | `pageSize` | `string` | no | Rows per page, 1 to 100. Larger values are clamped. Default 20. | | `search` | `string` | no | Free-text filter (trimmed, first 200 characters). | | `sort` | `string` | no | Sort key. Unknown keys fall back to the endpoint’s default sort. | | `dir` | `string` | no | `asc` or `desc` (default). | | `scope` | `string` | no | `mine` (default) or `team`. `team` needs leave:request:read\_others, leave:report:read, leave:approval:approve or leave:approval:override. | | `status` | `string` | no | `pending`, `approved`, `rejected`, `cancelled` or `revision_requested`. | | `from` | `string` | no | Requests ending on or after this time (epoch milliseconds). | | `to` | `string` | no | Requests starting on or before this time (epoch milliseconds). | | `year` | `string` | no | Calendar year, e.g. `2026`. | | `month` | `string` | no | Month `1` to `12` (with `year`). | | `type_id` | `string` | no | Only this leave type. | ### Response `200` One page of requests. | Field | Type | Description | | ------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------ | | `items` | `object[]` | | | `items[].id` | `string` | | | `items[].requester_id` | `string` | | | `items[].type_id` | `string` | | | `items[].start_date` | `number` | First day, epoch milliseconds (UTC midnight). | | `items[].end_date` | `number` | Last day, epoch milliseconds (UTC midnight). | | `items[].days` | `number` | Working days the request counts. | | `items[].is_backdated` | `number` | 1 = emergency or retroactive request filed on or after start date. | | `items[].reason` | `string` | | | `items[].covering_peer_id` | `string` | | | `items[].status` | `"pending" \| "approved" \| "rejected" \| "cancelled" \| "revision_requested"` | | | `items[].approver_id` | `string \| null` | | | `items[].decided_at` | `number \| null` | | | `items[].decision_note` | `string \| null` | | | `items[].created_at` | `number` | | | `items[].requester_name` | `string \| null` | | | `items[].type_name` | `string` | | | `items[].covering_peer_name` | `string \| null` | | | `items[].approval_instance_id` | `string \| null` | Approval timeline: GET /api/approvals/instances/{id}. | | `total` | `number` | | | `page` | `number` | | | `pageSize` | `number` | | Objects may carry more fields than listed; only the listed ones are part of the contract. **Errors:** `forbidden`, plus the [shared ones](/docs/conventions/#errors). Meanings: [error codes](/docs/errors/). ### Example ```bash curl -X GET 'https://app.aio.opexcg.com/api/leave/requests?pageSize=2' \ -H "X-API-Key: $OPEX_API_KEY" ``` Response `200`: ```json { "items": [ { "id": "cf0af695-a15a-4b4f-abba-4caa5cc54d7c", "tenant_id": "opexcg-tenant", "requester_id": "usr-fitri-handayani", "requester_name": "Fitri Handayani", "type_id": "e1ca06b1-cf8d-41e9-b2ff-85f1a1c3706a", "type_name": "Sick", "paid": 1, "start_date": 1837814400000, "end_date": 1837900800000, "days": 2, "reason": "Family event", "covering_peer_id": "usr-sari-wulandari", "covering_peer_name": "Sari Wulandari", "status": "pending", "approver_id": null, "approver_name": null, "decided_at": null, "decision_note": null, "created_at": 1794052051232, "modified_at": 1794052051232, "deleted_at": null, "approval_instance_id": "3ff4d93a-c92b-4a2c-b9de-3c3faf0718c9" } ], "total": 1, "page": 1, "pageSize": 2 } ``` ## Get a leave request `GET /api/leave/requests/:id` One leave request. Visible to the requester and to the people who approve or manage leave. * **Product:** Leave (`leave`) * **Permission:** any member ### Path parameters | Field | Type | Required | Description | | ----- | -------- | -------- | ----------------- | | `id` | `string` | yes | Leave request id. | ### Response `200` The request. | Field | Type | Description | | ---------------------- | ------------------------------------------------------------------------------ | ------------------------------------------------------------------ | | `id` | `string` | | | `requester_id` | `string` | | | `type_id` | `string` | | | `start_date` | `number` | First day, epoch milliseconds (UTC midnight). | | `end_date` | `number` | Last day, epoch milliseconds (UTC midnight). | | `days` | `number` | Working days the request counts. | | `is_backdated` | `number` | 1 = emergency or retroactive request filed on or after start date. | | `reason` | `string` | | | `covering_peer_id` | `string` | | | `status` | `"pending" \| "approved" \| "rejected" \| "cancelled" \| "revision_requested"` | | | `approver_id` | `string \| null` | | | `decided_at` | `number \| null` | | | `decision_note` | `string \| null` | | | `created_at` | `number` | | | `requester_name` | `string \| null` | | | `type_name` | `string` | | | `covering_peer_name` | `string \| null` | | | `approval_instance_id` | `string \| null` | Approval timeline: GET /api/approvals/instances/{id}. | Objects may carry more fields than listed; only the listed ones are part of the contract. **Errors:** `not_found`, `forbidden`, plus the [shared ones](/docs/conventions/#errors). Meanings: [error codes](/docs/errors/). ### Example ```bash curl -X GET 'https://app.aio.opexcg.com/api/leave/requests/cf0af695-a15a-4b4f-abba-4caa5cc54d7c' \ -H "X-API-Key: $OPEX_API_KEY" ``` Response `200`: ```json { "id": "cf0af695-a15a-4b4f-abba-4caa5cc54d7c", "tenant_id": "opexcg-tenant", "requester_id": "usr-fitri-handayani", "requester_name": "Fitri Handayani", "type_id": "e1ca06b1-cf8d-41e9-b2ff-85f1a1c3706a", "type_name": "Sick", "paid": 1, "start_date": 1837814400000, "end_date": 1837900800000, "days": 2, "reason": "Family event", "covering_peer_id": "usr-sari-wulandari", "covering_peer_name": "Sari Wulandari", "status": "pending", "approver_id": null, "approver_name": null, "decided_at": null, "decision_note": null, "created_at": 1794052051232, "modified_at": 1794052051232, "deleted_at": null, "approval_instance_id": "3ff4d93a-c92b-4a2c-b9de-3c3faf0718c9" } ``` ## Request leave `POST /api/leave/requests` Files a leave request for the caller and starts its approval. `start_date` and `end_date` are calendar days (`YYYY-MM-DD`); `covering_peer_id` is a colleague from the peers list who covers while you are away. * **Product:** Leave (`leave`) * **Permission (any of):** `leave:request:create` ### Request body (JSON) | Field | Type | Required | Description | | ------------------ | ------------------- | -------- | ----------------------------- | | `type_id` | `string` | yes | min length 1 | | `start_date` | `integer \| string` | yes | | | `end_date` | `integer \| string` | yes | | | `reason` | `string` | yes | min length 1, max length 2000 | | `covering_peer_id` | `string` | yes | min length 1 | ### Response `201` The new request. | Field | Type | Description | | ------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------ | | `id` | `string` | | | `requester_id` | `string` | | | `type_id` | `string` | | | `start_date` | `number` | First day, epoch milliseconds (UTC midnight). | | `end_date` | `number` | Last day, epoch milliseconds (UTC midnight). | | `days` | `number` | Working days the request counts. | | `is_backdated` | `number` | 1 = emergency or retroactive request filed on or after start date. | | `reason` | `string` | | | `covering_peer_id` | `string` | | | `status` | `"pending" \| "approved" \| "rejected" \| "cancelled" \| "revision_requested"` | | | `approver_id` | `string \| null` | | | `decided_at` | `number \| null` | | | `decision_note` | `string \| null` | | | `created_at` | `number` | | Objects may carry more fields than listed; only the listed ones are part of the contract. **Errors:** `forbidden`, `invalid_window`, `window_too_long`, `type_not_found`, `zero_working_days`, `overlapping_leave`, `leave_balance_not_allocated`, `backdated_not_allowed`, `exceeds_max_backdated_days`, plus the [shared ones](/docs/conventions/#errors). Meanings: [error codes](/docs/errors/). ### Example ```bash curl -X POST 'https://app.aio.opexcg.com/api/leave/requests' \ -H "X-API-Key: $OPEX_API_KEY" \ -H "content-type: application/json" \ -d '{"type_id":"e1ca06b1-cf8d-41e9-b2ff-85f1a1c3706a","start_date":"2028-03-28","end_date":"2028-03-29","reason":"Family event","covering_peer_id":"usr-sari-wulandari"}' ``` Response `201`: ```json { "id": "cf0af695-a15a-4b4f-abba-4caa5cc54d7c", "tenant_id": "opexcg-tenant", "requester_id": "usr-fitri-handayani", "type_id": "e1ca06b1-cf8d-41e9-b2ff-85f1a1c3706a", "start_date": 1837814400000, "end_date": 1837900800000, "days": 2, "reason": "Family event", "covering_peer_id": "usr-sari-wulandari", "status": "pending", "approver_id": null, "decided_at": null, "decision_note": null, "created_at": 1794052051232, "created_by": "usr-fitri-handayani", "modified_at": 1794052051232, "modified_by": "usr-fitri-handayani", "deleted_at": null, "deleted_by": null } ``` ## Cancel a leave request `POST /api/leave/requests/:id/cancel` Cancels a request. Your own need `leave:request:cancel_own`, anyone else’s `leave:request:cancel_others`. * **Product:** Leave (`leave`) * **Permission (any of):** `leave:request:cancel_own`, `leave:request:cancel_others` ### Path parameters | Field | Type | Required | Description | | ----- | -------- | -------- | ----------------- | | `id` | `string` | yes | Leave request id. | ### Response `200` The cancelled request. | Field | Type | Description | | ------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------ | | `id` | `string` | | | `requester_id` | `string` | | | `type_id` | `string` | | | `start_date` | `number` | First day, epoch milliseconds (UTC midnight). | | `end_date` | `number` | Last day, epoch milliseconds (UTC midnight). | | `days` | `number` | Working days the request counts. | | `is_backdated` | `number` | 1 = emergency or retroactive request filed on or after start date. | | `reason` | `string` | | | `covering_peer_id` | `string` | | | `status` | `"pending" \| "approved" \| "rejected" \| "cancelled" \| "revision_requested"` | | | `approver_id` | `string \| null` | | | `decided_at` | `number \| null` | | | `decision_note` | `string \| null` | | | `created_at` | `number` | | Objects may carry more fields than listed; only the listed ones are part of the contract. **Errors:** `not_found`, `forbidden`, `invalid_transition`, plus the [shared ones](/docs/conventions/#errors). Meanings: [error codes](/docs/errors/). ### Example ```bash curl -X POST 'https://app.aio.opexcg.com/api/leave/requests/cf0af695-a15a-4b4f-abba-4caa5cc54d7c/cancel' \ -H "X-API-Key: $OPEX_API_KEY" ``` Response `200`: ```json { "id": "cf0af695-a15a-4b4f-abba-4caa5cc54d7c", "tenant_id": "opexcg-tenant", "requester_id": "usr-fitri-handayani", "type_id": "e1ca06b1-cf8d-41e9-b2ff-85f1a1c3706a", "start_date": 1837814400000, "end_date": 1837900800000, "days": 2, "reason": "Family event", "covering_peer_id": "usr-sari-wulandari", "status": "cancelled", "approver_id": null, "decided_at": 1794052051531, "decision_note": null, "created_at": 1794052051232, "created_by": "usr-fitri-handayani", "modified_at": 1794052051532, "modified_by": "usr-fitri-handayani", "deleted_at": null, "deleted_by": null } ``` ## Get your leave balances `GET /api/leave/balances/mine` Your allowance, used and remaining days per leave type for one year. * **Product:** Leave (`leave`) * **Permission (any of):** `leave:balance:read_own` ### Query parameters | Field | Type | Required | Description | | ------ | -------- | -------- | ----------------------------------------------------------- | | `year` | `string` | no | Balance year, e.g. `2026`. Default: the current year (UTC). | ### Response `200` Your balances. | Field | Type | Description | | ------------------------- | ---------------- | -------------------------------------------- | | `items` | `object[]` | | | `items[].type_id` | `string` | | | `items[].type_name` | `string` | | | `items[].year` | `number` | | | `items[].total_allowance` | `number` | | | `items[].used_days` | `number` | | | `items[].pending_days` | `number` | Days in requests still waiting for approval. | | `items[].expires_at` | `number \| null` | | | `has_active_policy` | `boolean` | | | `missing_hire_date` | `boolean` | | | `missing_hire_date_count` | `number` | | Objects may carry more fields than listed; only the listed ones are part of the contract. ### Example ```bash curl -X GET 'https://app.aio.opexcg.com/api/leave/balances/mine' \ -H "X-API-Key: $OPEX_API_KEY" ``` Response `200`: ```json { "items": [] } ``` ## List leave types `GET /api/leave/types` The workspace’s leave types. Use an `id` as `type_id` when requesting leave. * **Product:** Leave (`leave`) * **Permission (any of):** `leave:type:read` ### Response `200` The leave types. | Field | Type | Description | | ---------------------------- | ---------------- | --------------------------------------------------- | | `items` | `object[]` | | | `items[].id` | `string` | | | `items[].name` | `string` | | | `items[].paid` | `number` | 1 = paid leave. | | `items[].requires_quota` | `number` | 1 = counted against a yearly allowance. | | `items[].default_allowance` | `number` | | | `items[].allow_backdated` | `number` | 1 = allows emergency or retroactive leave requests. | | `items[].max_backdated_days` | `number` | Maximum past days allowed for retroactive requests. | | `items[].description` | `string \| null` | | Objects may carry more fields than listed; only the listed ones are part of the contract. ### Example ```bash curl -X GET 'https://app.aio.opexcg.com/api/leave/types' \ -H "X-API-Key: $OPEX_API_KEY" ``` Response `200`: ```json { "items": [ { "id": "b09deadf-87b7-4f11-bce1-d9b2c63c34ce", "name": "Annual", "paid": 1, "requires_quota": 1, "default_allowance": 12, "description": "Cuti tahunan berbayar (12 hari/tahun)" }, { "id": "e1ca06b1-cf8d-41e9-b2ff-85f1a1c3706a", "name": "Sick", "paid": 1, "requires_quota": 0, "default_allowance": 0, "description": "Izin sakit berbayar tanpa pemotongan kuota" } ] } ``` ## List colleagues who can cover `GET /api/leave/peers` Active members of the workspace other than you (up to 100), for `covering_peer_id`. * **Product:** Leave (`leave`) * **Permission:** any member ### Query parameters | Field | Type | Required | Description | | ----------------- | -------- | -------- | ---------------------------------------- | | `search` | `string` | no | Substring of the member’s name or email. | | `includeInactive` | `string` | no | `true` to include deactivated members. | | `includeSelf` | `string` | no | `true` to include yourself. | ### Response `200` The members. | Field | Type | Description | | ------------------- | ---------------- | ----------- | | `items` | `object[]` | | | `items[].id` | `string` | | | `items[].name` | `string \| null` | | | `items[].email` | `string` | | | `items[].role` | `string` | | | `items[].is_active` | `number` | | Objects may carry more fields than listed; only the listed ones are part of the contract. ### Example ```bash curl -X GET 'https://app.aio.opexcg.com/api/leave/peers' \ -H "X-API-Key: $OPEX_API_KEY" ``` Response `200`: ```json { "items": [ { "id": "usr-sari-wulandari", "name": "Sari Wulandari", "email": "sari.wulandari@example.com", "role": "admin", "is_active": 1 }, { "id": "usr-budi-santoso", "name": "Budi Santoso", "email": "budi.santoso@example.com", "role": "admin", "is_active": 1 } ] } ``` # Project API > Projects and their tasks. The v1 endpoints, with parameters, responses and examples. Projects and their tasks. Every endpoint below is part of the stable v1 contract. Base URL `https://app.aio.opexcg.com`; send your key in `X-API-Key`. * `GET /api/projects`: List projects * `GET /api/projects/:id`: Get a project * `POST /api/projects`: Create a project * `PATCH /api/projects/:id`: Update a project * `POST /api/pmo/rpc/tasks/list`: List tasks * `POST /api/pmo/rpc/tasks/get`: Get a task * `POST /api/pmo/rpc/tasks/create`: Create a task * `POST /api/pmo/rpc/tasks/update`: Update a task ## List projects `GET /api/projects` Projects of the workspace, alphabetical by default. Client users see only their company’s projects. Consultants, consultant leads and project managers see only the projects they are assigned to unless they pass `scope=all`. Sort keys: `name` (default, ascending), `created_at`, `status`, `epicor_version`. * **Product:** none (any workspace) * **Permission:** any member ### Query parameters | Field | Type | Required | Description | | ----------- | ------------------------------------------- | -------- | -------------------------------------------------------------------------------------------- | | `page` | `string` | no | 1-based page number. Default 1. | | `pageSize` | `string` | no | Rows per page, 1 to 100. Larger values are clamped. Default 20. | | `search` | `string` | no | Free-text filter (trimmed, first 200 characters). | | `sort` | `string` | no | Sort key. Unknown keys fall back to the endpoint’s default sort. | | `dir` | `string` | no | `asc` or `desc` (default). | | `companyId` | `string` | no | Only this company’s projects (ignored for client users, who see their own). | | `scope` | `string` | no | `all` lists every project, not only the ones you are assigned to. | | `productId` | `string` | no | Only projects delivering this product (helpdesk catalog id). | | `support` | `"has" \| "none"` | no | `has` = only projects with a support contract, `none` = only without. | | `expiry` | `"expired" \| "expiring30" \| "expiring90"` | no | Support-contract expiry bucket: already expired, expiring within 30 days, or within 90 days. | ### Response `200` One page of projects. | Field | Type | Description | | ----------------------------- | ---------------- | ----------------------------------------------------------------------------------- | | `items` | `object[]` | | | `items[].id` | `string` | | | `items[].company_id` | `string` | | | `items[].name` | `string` | | | `items[].status` | `string` | Lifecycle status: `awaiting_payment`, `active`, `on_hold`, `completed`, `archived`. | | `items[].product_id` | `string \| null` | Product (helpdesk catalog) the project delivers. | | `items[].solution_summary` | `string \| null` | | | `items[].folder_id` | `string \| null` | | | `items[].planned_start_at` | `number \| null` | Epoch milliseconds. | | `items[].planned_end_at` | `number \| null` | | | `items[].actual_start_at` | `number \| null` | | | `items[].actual_end_at` | `number \| null` | | | `items[].budget_cents` | `number` | Budget in minor units of `budget_currency`. | | `items[].budget_hours` | `number` | | | `items[].budget_currency` | `string` | | | `items[].has_support_service` | `number` | 1 when the project includes a support service. | | `items[].support_expiry_date` | `number \| null` | | | `items[].color` | `string \| null` | | | `items[].created_at` | `number` | | | `total` | `number` | | | `page` | `number` | | | `pageSize` | `number` | | Objects may carry more fields than listed; only the listed ones are part of the contract. ### Example ```bash curl -X GET 'https://app.aio.opexcg.com/api/projects?pageSize=2&search=API+docs' \ -H "X-API-Key: $OPEX_API_KEY" ``` Response `200`: ```json { "items": [], "total": 0, "page": 1, "pageSize": 2 } ``` ## Get a project `GET /api/projects/:id` One project with its dates, budget and support settings. * **Product:** none (any workspace) * **Permission:** any member ### Path parameters | Field | Type | Required | Description | | ----- | -------- | -------- | ----------- | | `id` | `string` | yes | Project id. | ### Response `200` The project. | Field | Type | Description | | --------------------- | ---------------- | ----------------------------------------------------------------------------------- | | `id` | `string` | | | `company_id` | `string` | | | `name` | `string` | | | `status` | `string` | Lifecycle status: `awaiting_payment`, `active`, `on_hold`, `completed`, `archived`. | | `product_id` | `string \| null` | Product (helpdesk catalog) the project delivers. | | `solution_summary` | `string \| null` | | | `folder_id` | `string \| null` | | | `planned_start_at` | `number \| null` | Epoch milliseconds. | | `planned_end_at` | `number \| null` | | | `actual_start_at` | `number \| null` | | | `actual_end_at` | `number \| null` | | | `budget_cents` | `number` | Budget in minor units of `budget_currency`. | | `budget_hours` | `number` | | | `budget_currency` | `string` | | | `has_support_service` | `number` | 1 when the project includes a support service. | | `support_expiry_date` | `number \| null` | | | `color` | `string \| null` | | | `created_at` | `number` | | Objects may carry more fields than listed; only the listed ones are part of the contract. **Errors:** `not_found`, plus the [shared ones](/docs/conventions/#errors). Meanings: [error codes](/docs/errors/). ### Example ```bash curl -X GET 'https://app.aio.opexcg.com/api/projects/99e5d1dd-334c-4bc3-88c7-7d84558bf7c6' \ -H "X-API-Key: $OPEX_API_KEY" ``` Response `200`: ```json { "id": "99e5d1dd-334c-4bc3-88c7-7d84558bf7c6", "company_id": "comp-xyzind", "name": "Customer portal rollout", "solution_summary": null, "product_id": "prod-epicor", "epicor_instance": null, "epicor_version": null, "status": "active", "folder_id": null, "has_support_service": 0, "support_expiry_date": null, "budget_cents": 0, "budget_hours": 0, "budget_currency": "USD", "color": null, "created_at": 1794052048552, "planned_start_at": null, "planned_end_at": null, "actual_start_at": null, "actual_end_at": null } ``` ## Create a project `POST /api/projects` Creates a project for a company and product. Without `name`, the project is named ` `. Setting a budget also needs `pmo:budget:manage`. Dates are epoch milliseconds. * **Product:** none (any workspace) * **Permission (any of):** `pmo:project:create` ### Request body (JSON) | Field | Type | Required | Description | | ------------------- | -------------------------------------------------------------------------- | -------- | ------------------ | | `companyId` | `string` | yes | min length 1 | | `productId` | `string` | yes | min length 1 | | `name` | `string` | no | | | `status` | `"awaiting_payment" \| "active" \| "on_hold" \| "completed" \| "archived"` | no | default `"active"` | | `solutionSummary` | `string` | no | | | `epicorInstance` | `string` | no | | | `epicorVersion` | `string` | no | | | `hasSupportService` | `boolean` | no | default `false` | | `supportExpiryDate` | `integer \| null` | no | | | `plannedStartAt` | `integer \| null` | no | | | `plannedEndAt` | `integer \| null` | no | | | `actualStartAt` | `integer \| null` | no | | | `actualEndAt` | `integer \| null` | no | | | `budgetCents` | `integer` | no | min 0 | | `budgetHours` | `number` | no | min 0 | | `budgetCurrency` | `"IDR" \| "SGD" \| "MYR" \| "USD" \| "MVR"` | no | | | `color` | `string \| null` | no | | ### Response `201` The new project id. | Field | Type | Description | | ----- | -------- | --------------------- | | `id` | `string` | The new project’s id. | Objects may carry more fields than listed; only the listed ones are part of the contract. **Errors:** `org_not_found`, `product_not_found`, `name_taken`, plus the [shared ones](/docs/conventions/#errors). Meanings: [error codes](/docs/errors/). ### Example ```bash curl -X POST 'https://app.aio.opexcg.com/api/projects' \ -H "X-API-Key: $OPEX_API_KEY" \ -H "content-type: application/json" \ -d '{"companyId":"comp-xyzind","productId":"prod-epicor","name":"Customer portal rollout","status":"active"}' ``` Response `201`: ```json { "id": "99e5d1dd-334c-4bc3-88c7-7d84558bf7c6" } ``` ## Update a project `PATCH /api/projects/:id` Changes any of the given fields; omitted fields stay as they are. * **Product:** none (any workspace) * **Permission (any of):** `pmo:project:update` ### Path parameters | Field | Type | Required | Description | | ----- | -------- | -------- | ----------- | | `id` | `string` | yes | Project id. | ### Request body (JSON) | Field | Type | Required | Description | | ------------------- | -------------------------------------------------------------------------- | -------- | ----------- | | `name` | `string` | no | | | `productId` | `string \| null` | no | | | `epicorInstance` | `string` | no | | | `epicorVersion` | `string` | no | | | `solutionSummary` | `string` | no | | | `status` | `"awaiting_payment" \| "active" \| "on_hold" \| "completed" \| "archived"` | no | | | `folderId` | `string \| null` | no | | | `hasSupportService` | `boolean` | no | | | `supportExpiryDate` | `integer \| null` | no | | | `plannedStartAt` | `integer \| null` | no | | | `plannedEndAt` | `integer \| null` | no | | | `actualStartAt` | `integer \| null` | no | | | `actualEndAt` | `integer \| null` | no | | | `color` | `string \| null` | no | | ### Response `200` Done. | Field | Type | Description | | ----- | --------- | ----------- | | `ok` | `boolean` | | Objects may carry more fields than listed; only the listed ones are part of the contract. **Errors:** `not_found`, `product_not_found`, `folder_not_found`, `no_fields`, plus the [shared ones](/docs/conventions/#errors). Meanings: [error codes](/docs/errors/). ### Example ```bash curl -X PATCH 'https://app.aio.opexcg.com/api/projects/99e5d1dd-334c-4bc3-88c7-7d84558bf7c6' \ -H "X-API-Key: $OPEX_API_KEY" \ -H "content-type: application/json" \ -d '{"solutionSummary":"Roll out the public API to the integration team"}' ``` Response `200`: ```json { "ok": true } ``` ## List tasks `POST /api/pmo/rpc/tasks/list` Tasks of one project, paged. `pageSize` above 100 is clamped to 100. This is an RPC procedure: send the input as `{ "json": { … } }` with `content-type: application/json`, and read the result from the `json` field of the answer. Errors come back as `{ "json": { "code": "NOT_FOUND", "status": 404, "message": "not_found" } }`. * **Product:** Project (`pmo`) * **Permission:** any member ### Request body (JSON) | Field | Type | Required | Description | | ---------------- | ------------------------------------------------------------------ | -------- | ------------------------------- | | `json` | `object` | yes | | | `json.projectId` | `string` | yes | min length 1 | | `json.state` | `string` | no | | | `json.priority` | `"none" \| "urgent" \| "high" \| "medium" \| "low"` | no | | | `json.search` | `string` | no | | | `json.page` | `integer` | no | min 1, max 1000000, default `1` | | `json.pageSize` | `integer` | no | min 1, default `20` | | `json.sort` | `"created" \| "name" \| "priority" \| "sequence" \| "target_date"` | no | default `"created"` | | `json.dir` | `"asc" \| "desc"` | no | default `"desc"` | ### Response `200` One page of tasks. | Field | Type | Description | | --------------------------------------- | --------------------------------------------------- | ----------------------------------------------------------------- | | `json` | `object` | | | `json.items` | `object[]` | | | `json.items[].id` | `string` | | | `json.items[].project_id` | `string` | | | `json.items[].sequence_id` | `number` | Number of the task within its project. | | `json.items[].name` | `string` | | | `json.items[].priority` | `"none" \| "urgent" \| "high" \| "medium" \| "low"` | | | `json.items[].description_html` | `string \| null` | | | `json.items[].state_id` | `string \| null` | | | `json.items[].parent_id` | `string \| null` | | | `json.items[].milestone_id` | `string \| null` | | | `json.items[].start_date` | `number \| null` | Epoch milliseconds. | | `json.items[].target_date` | `number \| null` | Epoch milliseconds. | | `json.items[].completed_at` | `number \| null` | | | `json.items[].archived_at` | `number \| null` | | | `json.items[].estimate_points` | `number \| null` | | | `json.items[].created_at` | `number` | | | `json.items[].state` | `object \| null` | The workflow state, e.g. group `backlog`, `started`, `completed`. | | `json.items[].state.id` | `string` | | | `json.items[].state.name` | `string` | | | `json.items[].state.color` | `string \| null` | | | `json.items[].state.group_name` | `string` | | | `json.items[].assignees` | `object[]` | | | `json.items[].assignees[].id` | `string` | | | `json.items[].assignees[].display_name` | `string \| null` | | | `json.items[].assignees[].email` | `string \| null` | | | `json.items[].labels` | `object[]` | | | `json.items[].labels[].id` | `string` | | | `json.items[].labels[].name` | `string` | | | `json.items[].labels[].color` | `string \| null` | | | `json.items[].milestone` | `object \| null` | | | `json.items[].milestone.id` | `string` | | | `json.items[].milestone.name` | `string` | | | `json.items[].checklist_total` | `number` | | | `json.items[].checklist_done` | `number` | | | `json.total` | `number` | | | `json.page` | `number` | | | `json.pageSize` | `number` | | Objects may carry more fields than listed; only the listed ones are part of the contract. ### Example ```bash curl -X POST 'https://app.aio.opexcg.com/api/pmo/rpc/tasks/list' \ -H "X-API-Key: $OPEX_API_KEY" \ -H "content-type: application/json" \ -d '{"json":{"projectId":"99e5d1dd-334c-4bc3-88c7-7d84558bf7c6","pageSize":2}}' ``` Response `200`: ```json { "json": { "items": [ { "id": "28a5a651-5baa-4a8b-b9c8-76b9f1a2fc24", "tenant_id": "opexcg-tenant", "project_id": "99e5d1dd-334c-4bc3-88c7-7d84558bf7c6", "sequence_id": 1, "name": "Write the integration guide", "sort_order": 65535, "priority": "high", "start_date": null, "target_date": null, "completed_at": null, "archived_at": null, "is_draft": 0, "is_decision": 0, "description_json": null, "description_html": null, "description_stripped": null, "parent_id": null, "milestone_id": null, "state_id": "07a4b6e4-d64d-47d6-8c65-5e5a5e9fca57", "estimate_point_id": null, "estimate_points": null, "created_by_id": "usr-fitri-handayani", "external_source": null, "external_id": null, "recurrence_json": null, "recurrence_source_id": null, "recurrence_seq": null, "subject_type": null, "subject_id": null, "created_at": 1794052048728, "created_by": "usr-fitri-handayani", "modified_at": 1794052048728, "modified_by": "usr-fitri-handayani", "deleted_at": null, "deleted_by": null, "labels": [], "assignees": [], "state": { "id": "07a4b6e4-d64d-47d6-8c65-5e5a5e9fca57", "name": "Todo", "color": "#3B82F6", "group_name": "started" }, "milestone": null, "checklist_total": 0, "checklist_done": 0 } ], "total": 1, "page": 1, "pageSize": 2 } } ``` ## Get a task `POST /api/pmo/rpc/tasks/get` One task with its assignees and labels. This is an RPC procedure: send the input as `{ "json": { … } }` with `content-type: application/json`, and read the result from the `json` field of the answer. Errors come back as `{ "json": { "code": "NOT_FOUND", "status": 404, "message": "not_found" } }`. * **Product:** Project (`pmo`) * **Permission:** any member ### Request body (JSON) | Field | Type | Required | Description | | ---------------- | -------- | -------- | ------------ | | `json` | `object` | yes | | | `json.projectId` | `string` | yes | min length 1 | | `json.taskId` | `string` | yes | min length 1 | ### Response `200` The task. | Field | Type | Description | | ------------------------------- | --------------------------------------------------- | ----------------------------------------------------------------- | | `json` | `object` | | | `json.id` | `string` | | | `json.project_id` | `string` | | | `json.sequence_id` | `number` | Number of the task within its project. | | `json.name` | `string` | | | `json.priority` | `"none" \| "urgent" \| "high" \| "medium" \| "low"` | | | `json.description_html` | `string \| null` | | | `json.state_id` | `string \| null` | | | `json.parent_id` | `string \| null` | | | `json.milestone_id` | `string \| null` | | | `json.start_date` | `number \| null` | Epoch milliseconds. | | `json.target_date` | `number \| null` | Epoch milliseconds. | | `json.completed_at` | `number \| null` | | | `json.archived_at` | `number \| null` | | | `json.estimate_points` | `number \| null` | | | `json.created_at` | `number` | | | `json.state` | `object \| null` | The workflow state, e.g. group `backlog`, `started`, `completed`. | | `json.state.id` | `string` | | | `json.state.name` | `string` | | | `json.state.color` | `string \| null` | | | `json.state.group_name` | `string` | | | `json.assignees` | `object[]` | | | `json.assignees[].id` | `string` | | | `json.assignees[].display_name` | `string \| null` | | | `json.assignees[].email` | `string \| null` | | | `json.labels` | `object[]` | | | `json.labels[].id` | `string` | | | `json.labels[].name` | `string` | | | `json.labels[].color` | `string \| null` | | | `json.milestone` | `object \| null` | | | `json.milestone.id` | `string` | | | `json.milestone.name` | `string` | | | `json.checklist_total` | `number` | | | `json.checklist_done` | `number` | | Objects may carry more fields than listed; only the listed ones are part of the contract. **Errors:** `not_found`, plus the [shared ones](/docs/conventions/#errors). Meanings: [error codes](/docs/errors/). ### Example ```bash curl -X POST 'https://app.aio.opexcg.com/api/pmo/rpc/tasks/get' \ -H "X-API-Key: $OPEX_API_KEY" \ -H "content-type: application/json" \ -d '{"json":{"projectId":"99e5d1dd-334c-4bc3-88c7-7d84558bf7c6","taskId":"28a5a651-5baa-4a8b-b9c8-76b9f1a2fc24"}}' ``` Response `200`: ```json { "json": { "id": "28a5a651-5baa-4a8b-b9c8-76b9f1a2fc24", "tenant_id": "opexcg-tenant", "project_id": "99e5d1dd-334c-4bc3-88c7-7d84558bf7c6", "sequence_id": 1, "name": "Write the integration guide", "sort_order": 65535, "priority": "high", "start_date": null, "target_date": null, "completed_at": null, "archived_at": null, "is_draft": 0, "is_decision": 0, "description_json": null, "description_html": null, "description_stripped": null, "parent_id": null, "milestone_id": null, "state_id": "07a4b6e4-d64d-47d6-8c65-5e5a5e9fca57", "estimate_point_id": null, "estimate_points": null, "created_by_id": "usr-fitri-handayani", "external_source": null, "external_id": null, "recurrence_json": null, "recurrence_source_id": null, "recurrence_seq": null, "subject_type": null, "subject_id": null, "created_at": 1794052048728, "created_by": "usr-fitri-handayani", "modified_at": 1794052048728, "modified_by": "usr-fitri-handayani", "deleted_at": null, "deleted_by": null, "labels": [], "assignees": [], "state": { "id": "07a4b6e4-d64d-47d6-8c65-5e5a5e9fca57", "name": "Todo", "color": "#3B82F6", "group_name": "started" }, "milestone": null, "checklist_total": 0, "checklist_done": 0 } } ``` ## Create a task `POST /api/pmo/rpc/tasks/create` Creates a task in a project. Without `state_id` it starts in the project’s default state. Answers 200 (not 201). Dates are epoch milliseconds. This is an RPC procedure: send the input as `{ "json": { … } }` with `content-type: application/json`, and read the result from the `json` field of the answer. Errors come back as `{ "json": { "code": "NOT_FOUND", "status": 404, "message": "not_found" } }`. * **Product:** Project (`pmo`) * **Permission (any of):** `pmo:task:create` ### Request body (JSON) | Field | Type | Required | Description | | ----------------------- | --------------------------------------------------- | -------- | ---------------------------- | | `json` | `object` | yes | | | `json.name` | `string` | yes | min length 1, max length 300 | | `json.description_html` | `string` | no | | | `json.priority` | `"none" \| "urgent" \| "high" \| "medium" \| "low"` | no | default `"none"` | | `json.state_id` | `string` | no | | | `json.start_date` | `integer \| null` | no | | | `json.target_date` | `integer \| null` | no | | | `json.estimate_points` | `integer \| null` | no | | | `json.parent_id` | `string \| null` | no | | | `json.milestone_id` | `string \| null` | no | | | `json.label_ids` | `string[]` | no | | | `json.assignee_ids` | `string[]` | no | | | `json.projectId` | `string` | yes | min length 1 | ### Response `200` The new task. | Field | Type | Description | | ------------------------------- | --------------------------------------------------- | ----------------------------------------------------------------- | | `json` | `object` | | | `json.id` | `string` | | | `json.project_id` | `string` | | | `json.sequence_id` | `number` | Number of the task within its project. | | `json.name` | `string` | | | `json.priority` | `"none" \| "urgent" \| "high" \| "medium" \| "low"` | | | `json.description_html` | `string \| null` | | | `json.state_id` | `string \| null` | | | `json.parent_id` | `string \| null` | | | `json.milestone_id` | `string \| null` | | | `json.start_date` | `number \| null` | Epoch milliseconds. | | `json.target_date` | `number \| null` | Epoch milliseconds. | | `json.completed_at` | `number \| null` | | | `json.archived_at` | `number \| null` | | | `json.estimate_points` | `number \| null` | | | `json.created_at` | `number` | | | `json.state` | `object \| null` | The workflow state, e.g. group `backlog`, `started`, `completed`. | | `json.state.id` | `string` | | | `json.state.name` | `string` | | | `json.state.color` | `string \| null` | | | `json.state.group_name` | `string` | | | `json.assignees` | `object[]` | | | `json.assignees[].id` | `string` | | | `json.assignees[].display_name` | `string \| null` | | | `json.assignees[].email` | `string \| null` | | | `json.labels` | `object[]` | | | `json.labels[].id` | `string` | | | `json.labels[].name` | `string` | | | `json.labels[].color` | `string \| null` | | | `json.milestone` | `object \| null` | | | `json.milestone.id` | `string` | | | `json.milestone.name` | `string` | | | `json.checklist_total` | `number` | | | `json.checklist_done` | `number` | | Objects may carry more fields than listed; only the listed ones are part of the contract. **Errors:** `not_found`, `forbidden`, plus the [shared ones](/docs/conventions/#errors). Meanings: [error codes](/docs/errors/). ### Example ```bash curl -X POST 'https://app.aio.opexcg.com/api/pmo/rpc/tasks/create' \ -H "X-API-Key: $OPEX_API_KEY" \ -H "content-type: application/json" \ -d '{"json":{"projectId":"99e5d1dd-334c-4bc3-88c7-7d84558bf7c6","name":"Write the integration guide","priority":"high"}}' ``` Response `200`: ```json { "json": { "id": "28a5a651-5baa-4a8b-b9c8-76b9f1a2fc24", "tenant_id": "opexcg-tenant", "project_id": "99e5d1dd-334c-4bc3-88c7-7d84558bf7c6", "sequence_id": 1, "name": "Write the integration guide", "sort_order": 65535, "priority": "high", "start_date": null, "target_date": null, "completed_at": null, "archived_at": null, "is_draft": 0, "is_decision": 0, "description_json": null, "description_html": null, "description_stripped": null, "parent_id": null, "milestone_id": null, "state_id": "07a4b6e4-d64d-47d6-8c65-5e5a5e9fca57", "estimate_point_id": null, "estimate_points": null, "created_by_id": "usr-fitri-handayani", "external_source": null, "external_id": null, "recurrence_json": null, "recurrence_source_id": null, "recurrence_seq": null, "subject_type": null, "subject_id": null, "created_at": 1794052048728, "created_by": "usr-fitri-handayani", "modified_at": 1794052048728, "modified_by": "usr-fitri-handayani", "deleted_at": null, "deleted_by": null, "labels": [], "assignees": [], "state": { "id": "07a4b6e4-d64d-47d6-8c65-5e5a5e9fca57", "name": "Todo", "color": "#3B82F6", "group_name": "started" }, "milestone": null, "checklist_total": 0, "checklist_done": 0 } } ``` ## Update a task `POST /api/pmo/rpc/tasks/update` Changes any of the given fields of a task; `archived: true` archives it. This is an RPC procedure: send the input as `{ "json": { … } }` with `content-type: application/json`, and read the result from the `json` field of the answer. Errors come back as `{ "json": { "code": "NOT_FOUND", "status": 404, "message": "not_found" } }`. * **Product:** Project (`pmo`) * **Permission (any of):** `pmo:task:update` ### Request body (JSON) | Field | Type | Required | Description | | --------------------------- | --------------------------------------------------- | -------- | ---------------------------- | | `json` | `object` | yes | | | `json.name` | `string` | no | min length 1, max length 300 | | `json.description_html` | `string` | no | | | `json.priority` | `"none" \| "urgent" \| "high" \| "medium" \| "low"` | no | default `"none"` | | `json.state_id` | `string` | no | | | `json.start_date` | `integer \| null` | no | | | `json.target_date` | `integer \| null` | no | | | `json.estimate_points` | `integer \| null` | no | | | `json.parent_id` | `string \| null` | no | | | `json.milestone_id` | `string \| null` | no | | | `json.label_ids` | `string[]` | no | | | `json.assignee_ids` | `string[]` | no | | | `json.archived` | `boolean` | no | | | `json.sort_order` | `number` | no | | | `json.recurrence` | `object \| null` | no | | | `json.recurrence.frequency` | `"daily" \| "weekly" \| "monthly" \| "yearly"` | yes | | | `json.recurrence.interval` | `integer` | yes | min 1, max 365 | | `json.recurrence.weekdays` | `integer[]` | no | max 7 items | | `json.recurrence.anchor` | `string` | no | | | `json.recurrence.ends` | `object` | yes | | | `json.projectId` | `string` | yes | min length 1 | | `json.taskId` | `string` | yes | min length 1 | ### Response `200` The updated task. | Field | Type | Description | | ------ | -------- | ----------- | | `json` | `object` | | Objects may carry more fields than listed; only the listed ones are part of the contract. **Errors:** `not_found`, `forbidden`, plus the [shared ones](/docs/conventions/#errors). Meanings: [error codes](/docs/errors/). ### Example ```bash curl -X POST 'https://app.aio.opexcg.com/api/pmo/rpc/tasks/update' \ -H "X-API-Key: $OPEX_API_KEY" \ -H "content-type: application/json" \ -d '{"json":{"projectId":"99e5d1dd-334c-4bc3-88c7-7d84558bf7c6","taskId":"28a5a651-5baa-4a8b-b9c8-76b9f1a2fc24","priority":"urgent"}}' ``` Response `200`: ```json { "json": { "id": "28a5a651-5baa-4a8b-b9c8-76b9f1a2fc24", "tenant_id": "opexcg-tenant", "project_id": "99e5d1dd-334c-4bc3-88c7-7d84558bf7c6", "sequence_id": 1, "name": "Write the integration guide", "sort_order": 65535, "priority": "urgent", "start_date": null, "target_date": null, "completed_at": null, "archived_at": null, "is_draft": 0, "is_decision": 0, "description_json": null, "description_html": null, "description_stripped": null, "parent_id": null, "milestone_id": null, "state_id": "07a4b6e4-d64d-47d6-8c65-5e5a5e9fca57", "estimate_point_id": null, "estimate_points": null, "created_by_id": "usr-fitri-handayani", "external_source": null, "external_id": null, "recurrence_json": null, "recurrence_source_id": null, "recurrence_seq": null, "subject_type": null, "subject_id": null, "created_at": 1794052048728, "created_by": "usr-fitri-handayani", "modified_at": 1794052048854, "modified_by": "usr-fitri-handayani", "deleted_at": null, "deleted_by": null, "labels": [], "assignees": [], "state": { "id": "07a4b6e4-d64d-47d6-8c65-5e5a5e9fca57", "name": "Todo", "color": "#3B82F6", "group_name": "started" }, "milestone": null, "checklist_total": 0, "checklist_done": 0 } } ``` # Timesheets API > Time entries and the projects you log against. The v1 endpoints, with parameters, responses and examples. Time entries and the projects you log against. Every endpoint below is part of the stable v1 contract. Base URL `https://app.aio.opexcg.com`; send your key in `X-API-Key`. * `GET /api/timesheets`: List time entries * `POST /api/timesheets`: Log time * `PATCH /api/timesheets/:id`: Edit a time entry * `DELETE /api/timesheets/:id`: Delete a time entry * `GET /api/timesheets/projects`: List projects you can log time on ## List time entries `GET /api/timesheets` Time entries, newest first. Without `timesheets:entry:read_others` only your own entries are returned. This list pages with `limit` and `offset` (not `page`/`pageSize`). * **Product:** Timesheets (`timesheets`) * **Permission (any of):** `timesheets:entry:read_own`, `timesheets:entry:read_others` ### Query parameters | Field | Type | Required | Description | | ------------ | -------- | -------- | ---------------------------------------------------------------------------------------- | | `dateFrom` | `string` | no | Started on or after this day (`YYYY-MM-DD`). | | `dateTo` | `string` | no | Started on or before this day (`YYYY-MM-DD`, inclusive). | | `dateFromMs` | `string` | no | Like `dateFrom`, as epoch milliseconds. Wins over `dateFrom`. | | `dateToMs` | `string` | no | Like `dateTo`, as epoch milliseconds. Wins over `dateTo`. | | `projectId` | `string` | no | Only entries on this project. | | `status` | `string` | no | `running`, `pending`, `approved`, `rejected` or `invoiced`. Any other value answers 400. | | `userId` | `string` | no | Only this member’s entries. Needs timesheets:entry:read\_others for anyone but you. | | `mine` | `string` | no | `1` to return only your own entries. | | `search` | `string` | no | Substring of the description. | | `limit` | `string` | no | Rows per page, 1 to 500. Default 50. | | `offset` | `string` | no | Rows to skip. Default 0. | | `sort` | `string` | no | `started_at` (default), `duration` or `description`. | | `dir` | `string` | no | `asc` or `desc`. | ### Response `200` One page of entries. | Field | Type | Description | | ---------------------------- | ------------------------------------------------------------------ | ---------------------------------------------- | | `entries` | `object[]` | | | `entries[].id` | `string` | | | `entries[].user_id` | `string` | | | `entries[].project_id` | `string` | | | `entries[].description` | `string \| null` | | | `entries[].started_at` | `number` | Epoch milliseconds. | | `entries[].ended_at` | `number \| null` | | | `entries[].duration_minutes` | `number \| null` | | | `entries[].status` | `"running" \| "pending" \| "approved" \| "rejected" \| "invoiced"` | | | `entries[].billable` | `number` | 1 = billable. | | `entries[].source` | `string` | `manual`, `timer`, `calendar` or `agent`. | | `entries[].subject_type` | `"ticket" \| "task" \| null` | | | `entries[].subject_id` | `string \| null` | | | `entries[].created_at` | `number` | | | `entries[].total_cost` | `number \| null` | Cost at the member’s rate, when a rate is set. | | `entries[].project_name` | `string \| null` | | | `entries[].task_name` | `string \| null` | | | `entries[].user_name` | `string \| null` | | | `entries[].tagIds` | `string[]` | | | `total` | `number` | | | `limit` | `number` | | | `offset` | `number` | | Objects may carry more fields than listed; only the listed ones are part of the contract. **Errors:** `own_entries_only`, plus the [shared ones](/docs/conventions/#errors). Meanings: [error codes](/docs/errors/). ### Example ```bash curl -X GET 'https://app.aio.opexcg.com/api/timesheets?dateFrom=2026-11-06&mine=1&limit=2' \ -H "X-API-Key: $OPEX_API_KEY" ``` Response `200`: ```json { "entries": [ { "id": "728a50d8-ec6d-4b7e-b2f2-ea6d7ff79641", "tenant_id": "opexcg-tenant", "user_id": "usr-fitri-handayani", "project_id": "99e5d1dd-334c-4bc3-88c7-7d84558bf7c6", "description": "Integration workshop", "started_at": 1794044848931, "ended_at": 1794050248931, "duration_minutes": 90, "status": "approved", "entry_method": "manual", "source": "manual", "billable": 1, "subject_type": null, "subject_id": null, "clockify_id": null, "agent_name": null, "model": null, "input_tokens": null, "output_tokens": null, "cache_read_tokens": null, "cache_write_tokens": null, "reasoning_tokens": null, "approved_by": null, "approved_at": null, "rejection_reason": null, "cost_rate": null, "cost_currency": null, "cost_source": "uncosted", "cost_group_id": null, "checksum": "03ce1d14ade9e654bc81e32a9f8b2325ecbc84f1ce17532ca55e0ad82f08792b", "created_at": 1794052048976, "created_by": "usr-fitri-handayani", "modified_at": 1794052048976, "modified_by": "usr-fitri-handayani", "deleted_at": null, "deleted_by": null, "project_name": "Customer portal rollout", "task_name": null, "user_name": "Fitri Handayani", "tagIds": [], "total_cost": null, "totalCost": null, "costRate": null, "costCurrency": null, "costSource": "uncosted", "costGroupId": null } ], "total": 1, "limit": 2, "offset": 0 } ``` ## Log time `POST /api/timesheets` Logs a time entry for the caller. Give `startedAt` and `endedAt` (epoch milliseconds), or `durationMinutes`. The entry is always yours: the user, status and checksum are set by the server. * **Product:** Timesheets (`timesheets`) * **Permission (any of):** `timesheets:entry:create` ### Request body (JSON) | Field | Type | Required | Description | | ------------------ | ---------------------------------------------- | -------- | --------------- | | `projectId` | `string` | yes | min length 1 | | `description` | `string` | no | max length 4000 | | `startedAt` | `number` | no | | | `endedAt` | `number` | no | | | `durationMinutes` | `number` | no | min 0 | | `entryMethod` | `"timer" \| "manual" \| "import"` | no | | | `source` | `"timer" \| "manual" \| "calendar" \| "agent"` | no | | | `agentName` | `string` | no | max length 200 | | `model` | `string` | no | max length 200 | | `inputTokens` | `number` | no | | | `outputTokens` | `number` | no | | | `cacheReadTokens` | `number` | no | | | `cacheWriteTokens` | `number` | no | | | `reasoningTokens` | `number` | no | | | `billable` | `boolean` | no | | | `subjectType` | `"ticket" \| "task" \| null` | no | | | `subjectId` | `string \| null` | no | | | `tagIds` | `string[]` | no | | ### Response `201` The new entry. | Field | Type | Description | | ------------------ | ------------------------------------------------------------------ | ---------------------------------------------- | | `id` | `string` | | | `user_id` | `string` | | | `project_id` | `string` | | | `description` | `string \| null` | | | `started_at` | `number` | Epoch milliseconds. | | `ended_at` | `number \| null` | | | `duration_minutes` | `number \| null` | | | `status` | `"running" \| "pending" \| "approved" \| "rejected" \| "invoiced"` | | | `billable` | `number` | 1 = billable. | | `source` | `string` | `manual`, `timer`, `calendar` or `agent`. | | `subject_type` | `"ticket" \| "task" \| null` | | | `subject_id` | `string \| null` | | | `created_at` | `number` | | | `total_cost` | `number \| null` | Cost at the member’s rate, when a rate is set. | Objects may carry more fields than listed; only the listed ones are part of the contract. **Errors:** `project_archived`, `agent_name_required`, plus the [shared ones](/docs/conventions/#errors). Meanings: [error codes](/docs/errors/). ### Example ```bash curl -X POST 'https://app.aio.opexcg.com/api/timesheets' \ -H "X-API-Key: $OPEX_API_KEY" \ -H "content-type: application/json" \ -d '{"projectId":"99e5d1dd-334c-4bc3-88c7-7d84558bf7c6","description":"Integration workshop","startedAt":1794044848931,"endedAt":1794050248931,"billable":true}' ``` Response `201`: ```json { "id": "728a50d8-ec6d-4b7e-b2f2-ea6d7ff79641", "tenant_id": "opexcg-tenant", "user_id": "usr-fitri-handayani", "project_id": "99e5d1dd-334c-4bc3-88c7-7d84558bf7c6", "description": "Integration workshop", "started_at": 1794044848931, "ended_at": 1794050248931, "duration_minutes": 90, "status": "approved", "entry_method": "manual", "source": "manual", "billable": 1, "subject_type": null, "subject_id": null, "clockify_id": null, "agent_name": null, "model": null, "input_tokens": null, "output_tokens": null, "cache_read_tokens": null, "cache_write_tokens": null, "reasoning_tokens": null, "approved_by": null, "approved_at": null, "rejection_reason": null, "cost_rate": null, "cost_currency": null, "cost_source": "uncosted", "cost_group_id": null, "checksum": "03ce1d14ade9e654bc81e32a9f8b2325ecbc84f1ce17532ca55e0ad82f08792b", "created_at": 1794052048976, "created_by": "usr-fitri-handayani", "modified_at": 1794052048976, "modified_by": "usr-fitri-handayani", "deleted_at": null, "deleted_by": null, "total_cost": null, "totalCost": null } ``` ## Edit a time entry `PATCH /api/timesheets/:id` Changes an entry. Your own entries need `timesheets:entry:update_own`, anyone else’s `timesheets:entry:update_others`. Entries that are approved on a project requiring approval, invoiced, or older than the workspace’s edit window answer 409. * **Product:** Timesheets (`timesheets`) * **Permission (any of):** `timesheets:entry:update_own`, `timesheets:entry:update_others` ### Path parameters | Field | Type | Required | Description | | ----- | -------- | -------- | -------------- | | `id` | `string` | yes | Time entry id. | ### Request body (JSON) | Field | Type | Required | Description | | ----------------- | ----------------------------------- | -------- | ------------ | | `projectId` | `string` | no | min length 1 | | `source` | `"timer" \| "manual" \| "calendar"` | no | | | `description` | `string \| null` | no | | | `startedAt` | `number` | no | | | `endedAt` | `number \| null` | no | | | `durationMinutes` | `number` | no | min 0 | | `billable` | `boolean` | no | | | `subjectType` | `"ticket" \| "task" \| null` | no | | | `subjectId` | `string \| null` | no | | | `tagIds` | `string[]` | no | | ### Response `200` The updated entry. | Field | Type | Description | | ------------------ | ------------------------------------------------------------------ | ---------------------------------------------- | | `id` | `string` | | | `user_id` | `string` | | | `project_id` | `string` | | | `description` | `string \| null` | | | `started_at` | `number` | Epoch milliseconds. | | `ended_at` | `number \| null` | | | `duration_minutes` | `number \| null` | | | `status` | `"running" \| "pending" \| "approved" \| "rejected" \| "invoiced"` | | | `billable` | `number` | 1 = billable. | | `source` | `string` | `manual`, `timer`, `calendar` or `agent`. | | `subject_type` | `"ticket" \| "task" \| null` | | | `subject_id` | `string \| null` | | | `created_at` | `number` | | | `total_cost` | `number \| null` | Cost at the member’s rate, when a rate is set. | Objects may carry more fields than listed; only the listed ones are part of the contract. **Errors:** `entry_not_found`, `own_entries_only`, `timer_running`, `entry_finalized`, `entry_outside_window`, `project_archived`, `invalid_time_range`, plus the [shared ones](/docs/conventions/#errors). Meanings: [error codes](/docs/errors/). ### Example ```bash curl -X PATCH 'https://app.aio.opexcg.com/api/timesheets/728a50d8-ec6d-4b7e-b2f2-ea6d7ff79641' \ -H "X-API-Key: $OPEX_API_KEY" \ -H "content-type: application/json" \ -d '{"description":"Integration workshop with the client team"}' ``` Response `200`: ```json { "id": "728a50d8-ec6d-4b7e-b2f2-ea6d7ff79641", "tenant_id": "opexcg-tenant", "user_id": "usr-fitri-handayani", "project_id": "99e5d1dd-334c-4bc3-88c7-7d84558bf7c6", "description": "Integration workshop with the client team", "started_at": 1794044848931, "ended_at": 1794050248931, "duration_minutes": 90, "status": "approved", "entry_method": "manual", "source": "manual", "billable": 1, "subject_type": null, "subject_id": null, "clockify_id": null, "agent_name": null, "model": null, "input_tokens": null, "output_tokens": null, "cache_read_tokens": null, "cache_write_tokens": null, "reasoning_tokens": null, "approved_by": null, "approved_at": null, "rejection_reason": null, "cost_rate": null, "cost_currency": null, "cost_source": "uncosted", "cost_group_id": null, "checksum": "0cb792ff0a824c080c2b63bb4daa6bf82117fc1c0f894f1a6586fb832dfba063", "created_at": 1794052048976, "created_by": "usr-fitri-handayani", "modified_at": 1794052049083, "modified_by": "usr-fitri-handayani", "deleted_at": null, "deleted_by": null, "total_cost": null, "totalCost": null } ``` ## Delete a time entry `DELETE /api/timesheets/:id` Deletes an entry (soft delete). Your own entries need `timesheets:entry:delete_own`, anyone else’s `timesheets:entry:delete_others`. Entries that are approved on a project requiring approval, invoiced, or older than the workspace’s edit window answer 409. * **Product:** Timesheets (`timesheets`) * **Permission (any of):** `timesheets:entry:delete_own`, `timesheets:entry:delete_others` ### Path parameters | Field | Type | Required | Description | | ----- | -------- | -------- | -------------- | | `id` | `string` | yes | Time entry id. | ### Response `200` Done. | Field | Type | Description | | ----- | --------- | ----------- | | `ok` | `boolean` | | Objects may carry more fields than listed; only the listed ones are part of the contract. **Errors:** `entry_not_found`, `own_entries_only`, `timer_running`, `entry_finalized`, `entry_outside_window`, plus the [shared ones](/docs/conventions/#errors). Meanings: [error codes](/docs/errors/). ### Example ```bash curl -X DELETE 'https://app.aio.opexcg.com/api/timesheets/82d6610c-e504-4b71-abf1-5cc24c623e95' \ -H "X-API-Key: $OPEX_API_KEY" ``` Response `200`: ```json { "ok": true } ``` ## List projects you can log time on `GET /api/timesheets/projects` The workspace’s projects you can see, with their timesheet settings and logged totals, as a plain array (no paging). Public projects are visible to every member; private ones only to their team and admins. Use an `id` from here as `projectId` when logging time. * **Product:** Timesheets (`timesheets`) * **Permission:** any member ### Response `200` The projects. Type: `object[]` Objects may carry more fields than listed; only the listed ones are part of the contract. ### Example ```bash curl -X GET 'https://app.aio.opexcg.com/api/timesheets/projects' \ -H "X-API-Key: $OPEX_API_KEY" ``` Response `200`: ```json [ { "id": "99e5d1dd-334c-4bc3-88c7-7d84558bf7c6", "company_id": "comp-xyzind", "tenant_id": "opexcg-tenant", "name": "Customer portal rollout", "solution_summary": "Roll out the public API to the integration team", "product": null, "product_id": "prod-epicor", "epicor_instance": null, "epicor_version": null, "status": "planning", "folder_id": null, "has_support_service": 0, "support_expiry_date": null, "planned_start_at": null, "planned_end_at": null, "actual_start_at": null, "actual_end_at": null, "budget_cents": 0, "budget_hours": 0, "budget_currency": "USD", "color": null, "created_at": 1794052048552, "created_by": "usr-fitri-handayani", "modified_at": 1794052048631, "modified_by": "usr-fitri-handayani", "deleted_at": null, "deleted_by": null, "company_name": "XYZ Industries", "code": null, "start_date": null, "end_date": null, "logged_hours": 0, "actual_cost": 0, "access_type": "public", "is_billable": true, "hourly_rate": null, "requires_approval": false, "has_entries": false, "estimation_mode": "per_project", "progress_pct": null, "budgetCents": 0, "budgetHours": 0, "budgetCurrency": "USD", "startDate": null, "endDate": null, "loggedHours": 0, "actualCost": 0, "budgetUtilization": { "percentage": 0, "level": "normal" }, "accessType": "public", "isBillable": true, "hourlyRate": null, "estimationMode": "per_project", "starred": false, "progressPct": null }, { "id": "prj-adis", "company_id": "comp-opexcg", "tenant_id": "opexcg-tenant", "name": "ADIS", "solution_summary": null, "product": null, "product_id": null, "epicor_instance": null, "epicor_version": null, "status": "planning", "folder_id": null, "has_support_service": 0, "support_expiry_date": null, "planned_start_at": null, "planned_end_at": null, "actual_start_at": null, "actual_end_at": null, "budget_cents": 7500000000, "budget_hours": 0, "budget_currency": "IDR", "color": null, "created_at": 1794052020883, "created_by": "usr-sari-wulandari", "modified_at": 1794052020883, "modified_by": "usr-sari-wulandari", "deleted_at": null, "deleted_by": null, "company_name": "OpexCG", "code": null, "start_date": null, "end_date": null, "logged_hours": 0, "actual_cost": 0, "access_type": "public", "is_billable": true, "hourly_rate": null, "requires_approval": false, "has_entries": false, "estimation_mode": "per_project", "progress_pct": 0, "budgetCents": 7500000000, "budgetHours": 0, "budgetCurrency": "IDR", "startDate": null, "endDate": null, "loggedHours": 0, "actualCost": 0, "budgetUtilization": { "percentage": 0, "level": "normal" }, "accessType": "public", "isBillable": true, "hourlyRate": null, "estimationMode": "per_project", "starred": false, "progressPct": 0 } ] ```