开发者 · REST API v1.0.0

MetriCRM REST API

将您的 ERP、网站、BI 工具或任何其他系统连接到 MetriCRM。以下每个端点都由应用本身使用的同一规则生成,因此通过 API 能做的事情始终与密钥所有者在 MetriCRM 中能做的一致。

端点和字段说明为英文。

身份验证

在 设置 → API 密钥 中创建密钥,并作为 Bearer 令牌发送。密钥格式为 mck_您的工作区_…,以创建者的身份操作,且只能访问其范围内的资源。使用 api.metricrm.com/v1,或您的工作区地址加 /api/v1。

curl https://api.metricrm.com/v1/me \
  -H "Authorization: Bearer mck_your-workspace_…"

分页与筛选

列表每页最多返回 100 条记录并附带 nextCursor;将其作为 cursor 传回即可获取下一页。可按 createdAt 或 updatedAt 升序或降序排序,并使用 updatedSince 只同步有变化的记录。

curl "https://api.metricrm.com/v1/contacts?limit=50&updatedSince=2026-10-01T00:00:00Z&order=asc&sort=updatedAt"
# → { "data": [ … ], "nextCursor": "WyIyMDI2LTEwLTEz…" }
curl "https://api.metricrm.com/v1/contacts?limit=50&cursor=WyIyMDI2LTEwLTEz…"

错误

错误使用标准 HTTP 状态码和统一的 JSON 格式:可供程序判断的代码、易读的消息,以及输入无效时需要修正的字段。401 表示缺少密钥或密钥已失效;403 表示其范围、所有者角色或 IP 允许列表不允许该调用;404 也包括密钥无法查看的记录。

HTTP/1.1 400 Bad Request
{ "error": { "code": "invalid_request",
    "message": "Some fields are missing or invalid.",
    "details": [ { "path": "email", "message": "Invalid email address" } ] } }

速率限制

每个密钥有自己的每分钟限额(默认 600,在创建密钥时设置)。每个响应都会告诉您剩余额度;达到限额时,请等待 Retry-After 中的秒数。

HTTP/1.1 429 Too Many Requests
RateLimit-Limit: 600
RateLimit-Remaining: 0
RateLimit-Reset: 42
Retry-After: 42

幂等性

POST 请求请附带 Idempotency-Key 请求头。如果网络失败而您在 24 小时内以相同的键和内容重试,您将得到第一次的响应,而不会产生重复记录。

curl https://api.metricrm.com/v1/contacts \
  -H "Authorization: Bearer $METRICRM_API_KEY" \
  -H "Idempotency-Key: 6f1c2a9e-0b6d-4c1e-9a55-2f1d0e7b3c11" \
  -H "Content-Type: application/json" \
  -d '{"firstName":"Aisyah","lastName":"Rahman","email":"aisyah@sinar.my"}'

Webhook

设置 → Webhook 会把事件(case.created、invoice.paid 等)以 JSON 发送到您的 HTTPS 端点。每个请求按 Standard Webhooks 签名:用端点的 whsec_ 密钥校验 webhook-signature,拒绝过旧的时间戳,并用 webhook-id 忽略重复请求。返回任意 2xx 状态即可;其他响应会重试约 3.5 天。

// Node.js: verify a MetriCRM webhook (Standard Webhooks)
import { createHmac, timingSafeEqual } from "node:crypto";

function verify(secret, headers, rawBody) {
  const id = headers["webhook-id"], ts = headers["webhook-timestamp"];
  if (Math.abs(Date.now() / 1000 - Number(ts)) > 300) return false; // too old
  const key = Buffer.from(secret.replace(/^whsec_/, ""), "base64");
  const expected = createHmac("sha256", key).update(`${id}.${ts}.${rawBody}`).digest();
  return headers["webhook-signature"].split(" ").some((s) => {
    const sig = Buffer.from(s.split(",")[1] ?? "", "base64");
    return sig.length === expected.length && timingSafeEqual(sig, expected);
  });
}

// Body: { "type": "case.created", "timestamp": "…",
//         "data": { "id": "…", "entityType": "case", "object": { … }, "changes": { … } } }

Authentication

Check which key and workspace you are using.

curl "https://api.metricrm.com/v1/me?limit=10" \
  -H "Authorization: Bearer $METRICRM_API_KEY"
GET/v1/me— Check a key

Returns the workspace, the key's name and scopes, and the user it acts as.

Accounts

Companies you do business with.

curl "https://api.metricrm.com/v1/accounts?limit=10" \
  -H "Authorization: Bearer $METRICRM_API_KEY"
GET/v1/accounts— List accounts

Companies you do business with. Requires the `accounts:read` scope.

参数

limitintegerPage size, 1–100 (default 25).
cursorstringThe nextCursor of the previous page.
sort"createdAt" | "updatedAt"Sort field (default createdAt).
order"asc" | "desc"Sort order (default desc).
createdSincestring (date-time)Only records created after this time (ISO 8601).
updatedSincestring (date-time)Only records changed after this time — use for incremental sync.
ownerIdstring (uuid)Only accounts owned by this user.
teamIdstring (uuid)Only accounts of this team.
parentIdstring (uuid)Only child accounts of this account.
emailstringExact email address (lower case).
tierstringExact tier.
POST/v1/accounts— Create an account

Requires the `accounts:write` scope.

参数

Idempotency-Key (header)stringAny unique value (a UUID works). A retry with the same key and body returns the first response instead of creating a duplicate. Kept for 24 hours.
请求内容
name必填string
legalNamestring | null
registrationNostring | null
industrystring | null
websitestring | null
emailstring (email) | null | ""
phonestring | null
addressobject | null
tierstring | null
parentIdstring (uuid) | null
ownerIdstring (uuid) | null
backupOwnerIdstring (uuid) | null
teamIdstring (uuid) | null
tagsstring[]
customobject
GET/v1/accounts/{id}— Get one record

Requires the `accounts:read` scope.

参数

id必填string (uuid)Record id.
PATCH/v1/accounts/{id}— Update an account

Requires the `accounts:write` scope.

参数

id必填string (uuid)Record id.
请求内容
namestring
legalNamestring | null
registrationNostring | null
industrystring | null
websitestring | null
emailstring (email) | null | ""
phonestring | null
addressobject | null
tierstring | null
parentIdstring (uuid) | null
ownerIdstring (uuid) | null
backupOwnerIdstring (uuid) | null
teamIdstring (uuid) | null
tagsstring[]
customobject
DELETE/v1/accounts/{id}— Move an account to the recycle bin

Requires the `accounts:write` scope.

参数

id必填string (uuid)Record id.
Account 对象
id必填string (uuid)
number必填string | null
name必填string
legalName必填string | null
registrationNo必填string | null
industry必填string | null
website必填string | null
email必填string | null
phone必填string | null
address必填object | null
tier必填string | null
parentId必填string (uuid) | null
ownerId必填string (uuid) | null
teamId必填string (uuid) | null
tags必填string[]
custom必填objectCustom field values by field key.
lastActivityAt必填string (date-time) | null
createdAt必填string (date-time)
updatedAt必填string (date-time)

Contacts

People at your customers.

curl "https://api.metricrm.com/v1/contacts?limit=10" \
  -H "Authorization: Bearer $METRICRM_API_KEY"
GET/v1/contacts— List contacts

People at your customers. Requires the `contacts:read` scope.

参数

limitintegerPage size, 1–100 (default 25).
cursorstringThe nextCursor of the previous page.
sort"createdAt" | "updatedAt"Sort field (default createdAt).
order"asc" | "desc"Sort order (default desc).
createdSincestring (date-time)Only records created after this time (ISO 8601).
updatedSincestring (date-time)Only records changed after this time — use for incremental sync.
accountIdstring (uuid)Only contacts whose primary account is this.
ownerIdstring (uuid)Only contacts owned by this user.
emailstringExact email address (lower case).
mobilestringExact mobile number in E.164 (+60…).
POST/v1/contacts— Create a contact

Requires the `contacts:write` scope.

参数

Idempotency-Key (header)stringAny unique value (a UUID works). A retry with the same key and body returns the first response instead of creating a duplicate. Kept for 24 hours.
请求内容
firstNamestring | null
lastNamestring | null
fullNamestring | null
emailstring (email) | null | ""
mobilestring | null
officestring | null
homestring | null
titlestring | null
departmentstring | null
locale"en" | "ms" | "zh-CN" | null
ownerIdstring (uuid) | null
teamIdstring (uuid) | null
tagsstring[]
customobject
accountIdstring (uuid) | null
accountRolestring | null
GET/v1/contacts/{id}— Get one record

Requires the `contacts:read` scope.

参数

id必填string (uuid)Record id.
PATCH/v1/contacts/{id}— Update a contact

Requires the `contacts:write` scope.

参数

id必填string (uuid)Record id.
请求内容
firstNamestring | null
lastNamestring | null
fullNamestring | null
emailstring (email) | null | ""
mobilestring | null
officestring | null
homestring | null
titlestring | null
departmentstring | null
locale"en" | "ms" | "zh-CN" | null
ownerIdstring (uuid) | null
teamIdstring (uuid) | null
tagsstring[]
customobject
DELETE/v1/contacts/{id}— Move a contact to the recycle bin

Requires the `contacts:write` scope.

参数

id必填string (uuid)Record id.
Contact 对象
id必填string (uuid)
number必填string | null
firstName必填string | null
lastName必填string | null
fullName必填string
email必填string | null
mobile必填string | null
office必填string | null
home必填string | null
title必填string | null
department必填string | null
locale必填string | null
primaryAccountId必填string (uuid) | null
ownerId必填string (uuid) | null
teamId必填string (uuid) | null
tags必填string[]
custom必填objectCustom field values by field key.
lastActivityAt必填string (date-time) | null
createdAt必填string (date-time)
updatedAt必填string (date-time)

Cases

Customer service cases (MetriCare). New cases are routed like any other case.

curl "https://api.metricrm.com/v1/cases?limit=10" \
  -H "Authorization: Bearer $METRICRM_API_KEY"
GET/v1/cases— List cases

Customer service cases (MetriCare). New cases are routed like any other case. Requires the `cases:read` scope.

参数

limitintegerPage size, 1–100 (default 25).
cursorstringThe nextCursor of the previous page.
sort"createdAt" | "updatedAt"Sort field (default createdAt).
order"asc" | "desc"Sort order (default desc).
createdSincestring (date-time)Only records created after this time (ISO 8601).
updatedSincestring (date-time)Only records changed after this time — use for incremental sync.
statusstringExact status key.
prioritystringExact priority key.
accountIdstring (uuid)Only cases of this account.
contactIdstring (uuid)Only cases of this contact.
assigneeIdstring (uuid)Only cases assigned to this user.
teamIdstring (uuid)Only cases of this team.
POST/v1/cases— Create a case

Requires the `cases:write` scope.

参数

Idempotency-Key (header)stringAny unique value (a UUID works). A retry with the same key and body returns the first response instead of creating a duplicate. Kept for 24 hours.
请求内容
subject必填string
descriptionstring
categoryIdstring (uuid) | null
subCategoryIdstring (uuid) | null
prioritystring | null
statusstring | null
accountIdstring (uuid) | null
contactIdstring (uuid) | null
assigneeIdstring (uuid) | null
teamIdstring (uuid) | null
tagsstring[]
customobject
GET/v1/cases/{id}— Get one record

Requires the `cases:read` scope.

参数

id必填string (uuid)Record id.
PATCH/v1/cases/{id}— Update a case

Requires the `cases:write` scope.

参数

id必填string (uuid)Record id.
请求内容
subjectstring
descriptionstring
categoryIdstring (uuid) | null
subCategoryIdstring (uuid) | null
prioritystring
accountIdstring (uuid) | null
contactIdstring (uuid) | null
tagsstring[]
customobject
resolutionstring | null
DELETE/v1/cases/{id}— Delete a case

Requires the `cases:write` scope.

参数

id必填string (uuid)Record id.
Case 对象
id必填string (uuid)
number必填string
subject必填string
description必填string
channel必填string
categoryId必填string (uuid) | null
subCategoryId必填string (uuid) | null
priority必填string
status必填string
statusCategory必填string
accountId必填string (uuid) | null
contactId必填string (uuid) | null
assigneeId必填string (uuid) | null
teamId必填string (uuid) | null
tags必填string[]
custom必填objectCustom field values by field key.
resolution必填string | null
language必填string | null
firstResponseDueAt必填string (date-time) | null
resolutionDueAt必填string (date-time) | null
firstRespondedAt必填string (date-time) | null
slaState必填string
resolvedAt必填string (date-time) | null
closedAt必填string (date-time) | null
createdAt必填string (date-time)
updatedAt必填string (date-time)

Case comments

Replies and internal notes on cases. A public comment is emailed to the case contact.

curl "https://api.metricrm.com/v1/comments?limit=10" \
  -H "Authorization: Bearer $METRICRM_API_KEY"
GET/v1/comments— List case comments

Replies and internal notes on cases. A public comment is emailed to the case contact. Requires the `cases:read` scope.

参数

limitintegerPage size, 1–100 (default 25).
cursorstringThe nextCursor of the previous page.
sort"createdAt" | "updatedAt"Sort field (default createdAt).
order"asc" | "desc"Sort order (default desc).
createdSincestring (date-time)Only records created after this time (ISO 8601).
updatedSincestring (date-time)Only records changed after this time — use for incremental sync.
caseIdstring (uuid)Only comments on this case.
kind"public" | "internal"Public replies or notes.
POST/v1/comments— Add a reply or internal note to a case

Requires the `cases:write` scope.

参数

Idempotency-Key (header)stringAny unique value (a UUID works). A retry with the same key and body returns the first response instead of creating a duplicate. Kept for 24 hours.
请求内容
caseId必填string (uuid)
kind必填"public" | "internal"
html必填stringHTML body (sanitised).
GET/v1/comments/{id}— Get one record

Requires the `cases:read` scope.

参数

id必填string (uuid)Record id.
CaseComment 对象
id必填string (uuid)
caseId必填string (uuid)
kind必填"public" | "internal"
authorType必填string
authorId必填string (uuid) | null
authorName必填string | null
body必填stringSanitised HTML.
via必填string | null
createdAt必填string (date-time)

Leads

Prospects to qualify (MetriSales). New leads are routed to a sales rep.

curl "https://api.metricrm.com/v1/leads?limit=10" \
  -H "Authorization: Bearer $METRICRM_API_KEY"
GET/v1/leads— List leads

Prospects to qualify (MetriSales). New leads are routed to a sales rep. Requires the `leads:read` scope.

参数

limitintegerPage size, 1–100 (default 25).
cursorstringThe nextCursor of the previous page.
sort"createdAt" | "updatedAt"Sort field (default createdAt).
order"asc" | "desc"Sort order (default desc).
createdSincestring (date-time)Only records created after this time (ISO 8601).
updatedSincestring (date-time)Only records changed after this time — use for incremental sync.
statusstringExact status.
ownerIdstring (uuid)Only leads owned by this user.
emailstringExact email address (lower case).
POST/v1/leads— Create a lead

Requires the `leads:write` scope.

参数

Idempotency-Key (header)stringAny unique value (a UUID works). A retry with the same key and body returns the first response instead of creating a duplicate. Kept for 24 hours.
请求内容
fullName必填string
companyNamestring | null
emailstring (email) | null | ""
phonestring | null
source"web_form" | "email" | "chat" | "social" | "import" | "api" | "manual"
sourceDetailstring | null
ownerIdstring (uuid) | null
teamIdstring (uuid) | null
fieldsobject
languagestring | null
GET/v1/leads/{id}— Get one record

Requires the `leads:read` scope.

参数

id必填string (uuid)Record id.
PATCH/v1/leads/{id}— Update a lead

Requires the `leads:write` scope.

参数

id必填string (uuid)Record id.
请求内容
fullNamestring
companyNamestring | null
emailstring (email) | null | ""
phonestring | null
status"new" | "contacted" | "qualifying"
fieldsobject
DELETE/v1/leads/{id}— Delete a lead

Requires the `leads:write` scope.

参数

id必填string (uuid)Record id.
Lead 对象
id必填string (uuid)
number必填string
fullName必填string
companyName必填string | null
email必填string | null
phone必填string | null
source必填string
sourceDetail必填string | null
status必填string
ownerId必填string (uuid) | null
teamId必填string (uuid) | null
fields必填object
score必填integer | null
language必填string | null
accountId必填string (uuid) | null
contactId必填string (uuid) | null
dealId必填string (uuid) | null
convertedAt必填string (date-time) | null
disqualifiedReason必填string | null
createdAt必填string (date-time)
updatedAt必填string (date-time)

Opportunities

Deals in your sales pipelines.

curl "https://api.metricrm.com/v1/opportunities?limit=10" \
  -H "Authorization: Bearer $METRICRM_API_KEY"
GET/v1/opportunities— List opportunities

Deals in your sales pipelines. Requires the `deals:read` scope.

参数

limitintegerPage size, 1–100 (default 25).
cursorstringThe nextCursor of the previous page.
sort"createdAt" | "updatedAt"Sort field (default createdAt).
order"asc" | "desc"Sort order (default desc).
createdSincestring (date-time)Only records created after this time (ISO 8601).
updatedSincestring (date-time)Only records changed after this time — use for incremental sync.
status"open" | "won" | "lost"Open, won or lost.
pipelineIdstring (uuid)Only deals in this pipeline.
stageKeystringExact stage key.
accountIdstring (uuid)Only deals of this account.
ownerIdstring (uuid)Only deals owned by this user.
POST/v1/opportunities— Create an opportunity

Requires the `deals:write` scope.

参数

Idempotency-Key (header)stringAny unique value (a UUID works). A retry with the same key and body returns the first response instead of creating a duplicate. Kept for 24 hours.
请求内容
name必填string
accountIdstring (uuid) | null
contactIdstring (uuid) | null
pipelineIdstring (uuid) | null
stageKeystring | null
amountSeninteger
currencystring
expectedCloseDatestring (date) | null
ownerIdstring (uuid) | null
teamIdstring (uuid) | null
sourcestring | null
competitorsstring[]
nextStepstring | null
GET/v1/opportunities/{id}— Get one record

Requires the `deals:read` scope.

参数

id必填string (uuid)Record id.
PATCH/v1/opportunities/{id}— Update an opportunity

Requires the `deals:write` scope.

参数

id必填string (uuid)Record id.
请求内容
namestring
accountIdstring (uuid) | null
contactIdstring (uuid) | null
amountSeninteger
expectedCloseDatestring (date) | null
ownerIdstring (uuid) | null
teamIdstring (uuid) | null
sourcestring | null
competitorsstring[]
nextStepstring | null
DELETE/v1/opportunities/{id}— Delete an opportunity

Requires the `deals:write` scope.

参数

id必填string (uuid)Record id.
Opportunity 对象
id必填string (uuid)
number必填string
name必填string
accountId必填string (uuid) | null
contactId必填string (uuid) | null
pipelineId必填string (uuid) | null
stageKey必填string
probability必填integer
amountSen必填integerDeal value in the smallest currency unit (sen for MYR).
currency必填string
expectedCloseDate必填string (date) | null
ownerId必填string (uuid) | null
teamId必填string (uuid) | null
source必填string | null
leadId必填string (uuid) | null
competitors必填string[]
nextStep必填string | null
status必填"open" | "won" | "lost"
wonAt必填string (date-time) | null
lostAt必填string (date-time) | null
lostReason必填string | null
createdAt必填string (date-time)
updatedAt必填string (date-time)

Quotations

Quotations with line items, discounts and SST. Approval rules still apply.

curl "https://api.metricrm.com/v1/quotations?limit=10" \
  -H "Authorization: Bearer $METRICRM_API_KEY"
GET/v1/quotations— List quotations

Quotations with line items, discounts and SST. Approval rules still apply. Requires the `quotations:read` scope.

参数

limitintegerPage size, 1–100 (default 25).
cursorstringThe nextCursor of the previous page.
sort"createdAt" | "updatedAt"Sort field (default createdAt).
order"asc" | "desc"Sort order (default desc).
createdSincestring (date-time)Only records created after this time (ISO 8601).
updatedSincestring (date-time)Only records changed after this time — use for incremental sync.
statusstringExact status.
dealIdstring (uuid)Only quotations for this opportunity.
accountIdstring (uuid)Only quotations for this account.
POST/v1/quotations— Create a draft quotation

Requires the `quotations:write` scope.

参数

Idempotency-Key (header)stringAny unique value (a UUID works). A retry with the same key and body returns the first response instead of creating a duplicate. Kept for 24 hours.
请求内容
title必填string
dealIdstring (uuid) | null
accountIdstring (uuid) | null
contactIdstring (uuid) | null
priceListIdstring (uuid) | null
tierstring | null
language"en" | "ms" | "zh-CN"
validUntilstring | null
paymentTermsDaysinteger | null
termsstring | null
notesstring | null
itemsobject[]
GET/v1/quotations/{id}— Get one record

Requires the `quotations:read` scope.

参数

id必填string (uuid)Record id.
PATCH/v1/quotations/{id}— Replace a draft quotation (send every field and all line items)

Requires the `quotations:write` scope.

参数

id必填string (uuid)Record id.
请求内容
title必填string
dealIdstring (uuid) | null
accountIdstring (uuid) | null
contactIdstring (uuid) | null
priceListIdstring (uuid) | null
tierstring | null
language"en" | "ms" | "zh-CN"
validUntilstring | null
paymentTermsDaysinteger | null
termsstring | null
notesstring | null
itemsobject[]
DELETE/v1/quotations/{id}— Delete a draft quotation

Requires the `quotations:write` scope.

参数

id必填string (uuid)Record id.
Quotation 对象
id必填string (uuid)
number必填string
version必填integer
title必填string
dealId必填string (uuid) | null
accountId必填string (uuid) | null
contactId必填string (uuid) | null
ownerId必填string (uuid) | null
status必填string
currency必填string
language必填string
validUntil必填string (date) | null
paymentTermsDays必填integer | null
terms必填string | null
grossSen必填integerBefore discount and tax in the smallest currency unit (sen for MYR).
discountSen必填integerDiscount in the smallest currency unit (sen for MYR).
taxSen必填integerTax in the smallest currency unit (sen for MYR).
totalSen必填integerTotal in the smallest currency unit (sen for MYR).
sentAt必填string (date-time) | null
decidedAt必填string (date-time) | null
createdAt必填string (date-time)
updatedAt必填string (date-time)

Orders

Sales orders, created from accepted quotations.

curl "https://api.metricrm.com/v1/orders?limit=10" \
  -H "Authorization: Bearer $METRICRM_API_KEY"
GET/v1/orders— List orders

Sales orders, created from accepted quotations. Requires the `orders:read` scope.

参数

limitintegerPage size, 1–100 (default 25).
cursorstringThe nextCursor of the previous page.
sort"createdAt" | "updatedAt"Sort field (default createdAt).
order"asc" | "desc"Sort order (default desc).
createdSincestring (date-time)Only records created after this time (ISO 8601).
updatedSincestring (date-time)Only records changed after this time — use for incremental sync.
statusstringExact status.
accountIdstring (uuid)Only orders of this account.
quoteIdstring (uuid)Only the order for this quotation.
POST/v1/orders— Create the sales order for an accepted quotation

Requires the `orders:write` scope.

参数

Idempotency-Key (header)stringAny unique value (a UUID works). A retry with the same key and body returns the first response instead of creating a duplicate. Kept for 24 hours.
请求内容
quoteId必填string (uuid)
GET/v1/orders/{id}— Get one record

Requires the `orders:read` scope.

参数

id必填string (uuid)Record id.
Order 对象
id必填string (uuid)
number必填string
quoteId必填string (uuid) | null
dealId必填string (uuid) | null
accountId必填string (uuid) | null
contactId必填string (uuid) | null
ownerId必填string (uuid) | null
title必填string
status必填string
currency必填string
totalSen必填integerTotal in the smallest currency unit (sen for MYR).
taxSen必填integerTax in the smallest currency unit (sen for MYR).
fulfilledAt必填string (date-time) | null
cancelledAt必填string (date-time) | null
createdAt必填string (date-time)
updatedAt必填string (date-time)

Invoices

Invoices with SST and payment status.

curl "https://api.metricrm.com/v1/invoices?limit=10" \
  -H "Authorization: Bearer $METRICRM_API_KEY"
GET/v1/invoices— List invoices

Invoices with SST and payment status. Requires the `invoices:read` scope.

参数

limitintegerPage size, 1–100 (default 25).
cursorstringThe nextCursor of the previous page.
sort"createdAt" | "updatedAt"Sort field (default createdAt).
order"asc" | "desc"Sort order (default desc).
createdSincestring (date-time)Only records created after this time (ISO 8601).
updatedSincestring (date-time)Only records changed after this time — use for incremental sync.
statusstringExact status.
accountIdstring (uuid)Only invoices of this account.
orderIdstring (uuid)Only invoices for this order.
POST/v1/invoices— Create a draft invoice

Requires the `invoices:write` scope.

参数

Idempotency-Key (header)stringAny unique value (a UUID works). A retry with the same key and body returns the first response instead of creating a duplicate. Kept for 24 hours.
请求内容
title必填string
accountIdstring (uuid) | null
contactIdstring (uuid) | null
language"en" | "ms" | "zh-CN"
issueDatestring | null
paymentTermsDaysinteger | null
termsstring | null
notesstring | null
itemsobject[]
GET/v1/invoices/{id}— Get one record

Requires the `invoices:read` scope.

参数

id必填string (uuid)Record id.
PATCH/v1/invoices/{id}— Replace a draft invoice (send every field and all line items)

Requires the `invoices:write` scope.

参数

id必填string (uuid)Record id.
请求内容
title必填string
accountIdstring (uuid) | null
contactIdstring (uuid) | null
language"en" | "ms" | "zh-CN"
issueDatestring | null
paymentTermsDaysinteger | null
termsstring | null
notesstring | null
itemsobject[]
Invoice 对象
id必填string (uuid)
number必填string
orderId必填string (uuid) | null
dealId必填string (uuid) | null
accountId必填string (uuid) | null
contactId必填string (uuid) | null
ownerId必填string (uuid) | null
title必填string
status必填string
currency必填string
language必填string
issueDate必填string (date)
dueDate必填string (date)
paymentTermsDays必填integer
totalSen必填integerTotal in the smallest currency unit (sen for MYR).
taxSen必填integerTax in the smallest currency unit (sen for MYR).
paidSen必填integerPaid so far in the smallest currency unit (sen for MYR).
sentAt必填string (date-time) | null
paidAt必填string (date-time) | null
voidedAt必填string (date-time) | null
createdAt必填string (date-time)
updatedAt必填string (date-time)

Payments

Payments recorded against invoices (bank transfer, cash, cheque, card).

curl "https://api.metricrm.com/v1/payments?limit=10" \
  -H "Authorization: Bearer $METRICRM_API_KEY"
GET/v1/payments— List payments

Payments recorded against invoices (bank transfer, cash, cheque, card). Requires the `invoices:read` scope.

参数

limitintegerPage size, 1–100 (default 25).
cursorstringThe nextCursor of the previous page.
sort"createdAt" | "updatedAt"Sort field (default createdAt).
order"asc" | "desc"Sort order (default desc).
createdSincestring (date-time)Only records created after this time (ISO 8601).
updatedSincestring (date-time)Only records changed after this time — use for incremental sync.
invoiceIdstring (uuid)Only payments for this invoice.
POST/v1/payments— Record a payment against an invoice

Requires the `invoices:write` scope.

参数

Idempotency-Key (header)stringAny unique value (a UUID works). A retry with the same key and body returns the first response instead of creating a duplicate. Kept for 24 hours.
请求内容
amountSen必填integer
method必填"bank_transfer" | "cash" | "cheque" | "card" | "online" | "other"
referencestring | null
paidOn必填string
notestring | null
invoiceId必填string (uuid)
GET/v1/payments/{id}— Get one record

Requires the `invoices:read` scope.

参数

id必填string (uuid)Record id.
Payment 对象
id必填string (uuid)
invoiceId必填string (uuid)
number必填string
amountSen必填integerAmount in the smallest currency unit (sen for MYR).
method必填string
reference必填string | null
paidOn必填string (date)
note必填string | null
source必填string
voidedAt必填string (date-time) | null
createdAt必填string (date-time)

Products

Your product and service catalogue.

curl "https://api.metricrm.com/v1/products?limit=10" \
  -H "Authorization: Bearer $METRICRM_API_KEY"
GET/v1/products— List products

Your product and service catalogue. Requires the `products:read` scope.

参数

limitintegerPage size, 1–100 (default 25).
cursorstringThe nextCursor of the previous page.
sort"createdAt" | "updatedAt"Sort field (default createdAt).
order"asc" | "desc"Sort order (default desc).
createdSincestring (date-time)Only records created after this time (ISO 8601).
updatedSincestring (date-time)Only records changed after this time — use for incremental sync.
status"active" | "archived"Active or archived.
skustringExact SKU (upper case).
POST/v1/products— Create a product

Requires the `products:write` scope.

参数

Idempotency-Key (header)stringAny unique value (a UUID works). A retry with the same key and body returns the first response instead of creating a duplicate. Kept for 24 hours.
请求内容
sku必填string
name必填string
descriptionstring | null
unitstring
priceSen必填integer
costSeninteger | null
currencystring
taxCategoryIdstring (uuid) | null
parentIdstring (uuid) | null
optionsobject
status"active" | "archived"
GET/v1/products/{id}— Get one record

Requires the `products:read` scope.

参数

id必填string (uuid)Record id.
PATCH/v1/products/{id}— Replace a product (send every field)

Requires the `products:write` scope.

参数

id必填string (uuid)Record id.
请求内容
sku必填string
name必填string
descriptionstring | null
unitstring
priceSen必填integer
costSeninteger | null
currencystring
taxCategoryIdstring (uuid) | null
parentIdstring (uuid) | null
optionsobject
status"active" | "archived"
Product 对象
id必填string (uuid)
sku必填string
name必填string
description必填string | null
unit必填string
priceSen必填integerList price in the smallest currency unit (sen for MYR).
costSen必填integer | null
currency必填string
taxCategoryId必填string (uuid) | null
parentId必填string (uuid) | null
options必填object
status必填"active" | "archived"
createdAt必填string (date-time)
updatedAt必填string (date-time)

Tasks

Follow-ups with due dates and reminders.

curl "https://api.metricrm.com/v1/tasks?limit=10" \
  -H "Authorization: Bearer $METRICRM_API_KEY"
GET/v1/tasks— List tasks

Follow-ups with due dates and reminders. Requires the `tasks:read` scope.

参数

limitintegerPage size, 1–100 (default 25).
cursorstringThe nextCursor of the previous page.
sort"createdAt" | "updatedAt"Sort field (default createdAt).
order"asc" | "desc"Sort order (default desc).
createdSincestring (date-time)Only records created after this time (ISO 8601).
updatedSincestring (date-time)Only records changed after this time — use for incremental sync.
status"open" | "done" | "cancelled"Open, done or cancelled.
assigneeIdstring (uuid)Only tasks assigned to this user.
accountIdstring (uuid)Only tasks about this account.
contactIdstring (uuid)Only tasks about this contact.
POST/v1/tasks— Create a task

Requires the `tasks:write` scope.

参数

Idempotency-Key (header)stringAny unique value (a UUID works). A retry with the same key and body returns the first response instead of creating a duplicate. Kept for 24 hours.
请求内容
title必填string
descriptionstring | null
priority"low" | "medium" | "high" | "urgent"
dueAtstring (date-time) | null
remindAtstring (date-time) | null
assigneeIdstring (uuid) | null
teamIdstring (uuid) | null
entityTypestring | null
entityIdstring (uuid) | null
recurrenceobject | null
GET/v1/tasks/{id}— Get one record

Requires the `tasks:read` scope.

参数

id必填string (uuid)Record id.
PATCH/v1/tasks/{id}— Update a task

Requires the `tasks:write` scope.

参数

id必填string (uuid)Record id.
请求内容
titlestring
descriptionstring | null
priority"low" | "medium" | "high" | "urgent"
dueAtstring (date-time) | null
remindAtstring (date-time) | null
assigneeIdstring (uuid) | null
teamIdstring (uuid) | null
entityTypestring | null
entityIdstring (uuid) | null
recurrenceobject | null
DELETE/v1/tasks/{id}— Delete a task

Requires the `tasks:write` scope.

参数

id必填string (uuid)Record id.
Task 对象
id必填string (uuid)
number必填string | null
title必填string
description必填string | null
status必填"open" | "done" | "cancelled"
priority必填string
dueAt必填string (date-time) | null
remindAt必填string (date-time) | null
assigneeId必填string (uuid) | null
teamId必填string (uuid) | null
entityType必填string | null
entityId必填string (uuid) | null
accountId必填string (uuid) | null
contactId必填string (uuid) | null
completedAt必填string (date-time) | null
createdAt必填string (date-time)
updatedAt必填string (date-time)

Activities

The timeline on accounts and contacts: calls, emails, chats, notes and more.

curl "https://api.metricrm.com/v1/activities?limit=10" \
  -H "Authorization: Bearer $METRICRM_API_KEY"
GET/v1/activities— List activities

The timeline on accounts and contacts: calls, emails, chats, notes and more. Requires the `activities:read` scope.

参数

limitintegerPage size, 1–100 (default 25).
cursorstringThe nextCursor of the previous page.
sort"createdAt" | "updatedAt"Sort field (default createdAt).
order"asc" | "desc"Sort order (default desc).
createdSincestring (date-time)Only records created after this time (ISO 8601).
updatedSincestring (date-time)Only records changed after this time — use for incremental sync.
accountIdstring (uuid)Only activities on this account.
contactIdstring (uuid)Only activities on this contact.
kindstringExact kind (call, email, note …).
POST/v1/activities— Log an activity (a call, meeting note or email from another system)

Requires the `activities:write` scope.

参数

Idempotency-Key (header)stringAny unique value (a UUID works). A retry with the same key and body returns the first response instead of creating a duplicate. Kept for 24 hours.
请求内容
kind必填"call" | "email" | "chat" | "note"
accountIdstring (uuid) | null
contactIdstring (uuid) | null
title必填string
bodystring | null
occurredAtstring (date-time) | null
GET/v1/activities/{id}— Get one record

Requires the `activities:read` scope.

参数

id必填string (uuid)Record id.
Activity 对象
id必填string (uuid)
kind必填string
subjectType必填string
subjectId必填string (uuid)
accountId必填string (uuid) | null
contactId必填string (uuid) | null
title必填string
body必填string | nullShort preview (up to 500 characters).
actorUserId必填string (uuid) | null
actorType必填string
occurredAt必填string (date-time)

Knowledge base

Knowledge base articles with their published translations.

curl "https://api.metricrm.com/v1/articles?limit=10" \
  -H "Authorization: Bearer $METRICRM_API_KEY"
GET/v1/articles— List knowledge base

Knowledge base articles with their published translations. Requires the `knowledge:read` scope.

参数

limitintegerPage size, 1–100 (default 25).
cursorstringThe nextCursor of the previous page.
sort"createdAt" | "updatedAt"Sort field (default createdAt).
order"asc" | "desc"Sort order (default desc).
createdSincestring (date-time)Only records created after this time (ISO 8601).
updatedSincestring (date-time)Only records changed after this time — use for incremental sync.
statusstringExact status (published, draft …).
visibility"internal" | "public"Internal or public.
categoryIdstring (uuid)Only articles in this category.
GET/v1/articles/{id}— Get one record

Requires the `knowledge:read` scope.

参数

id必填string (uuid)Record id.
Article 对象
id必填string (uuid)
number必填string | null
categoryId必填string (uuid) | null
slug必填string
visibility必填"internal" | "public"
status必填string
tags必填string[]
version必填integer
publishedAt必填string (date-time) | null
translations必填object[]Published content per language.
createdAt必填string (date-time)
updatedAt必填string (date-time)

Messages

Messages in MetriChat conversations (web chat, WhatsApp, SMS and more).

curl "https://api.metricrm.com/v1/messages?limit=10" \
  -H "Authorization: Bearer $METRICRM_API_KEY"
GET/v1/messages— List messages

Messages in MetriChat conversations (web chat, WhatsApp, SMS and more). Requires the `messages:read` scope.

参数

limitintegerPage size, 1–100 (default 25).
cursorstringThe nextCursor of the previous page.
sort"createdAt" | "updatedAt"Sort field (default createdAt).
order"asc" | "desc"Sort order (default desc).
createdSincestring (date-time)Only records created after this time (ISO 8601).
updatedSincestring (date-time)Only records changed after this time — use for incremental sync.
conversationIdstring (uuid)Only messages in this conversation.
direction"in" | "out" | "note" | "system"Incoming, outgoing, internal note or system.
POST/v1/messages— Reply in a conversation (through its channel)

Requires the `messages:write` scope.

参数

Idempotency-Key (header)stringAny unique value (a UUID works). A retry with the same key and body returns the first response instead of creating a duplicate. Kept for 24 hours.
请求内容
conversationId必填string (uuid)
text必填string
GET/v1/messages/{id}— Get one record

Requires the `messages:read` scope.

参数

id必填string (uuid)Record id.
Message 对象
id必填string (uuid)
conversationId必填string (uuid)
direction必填"in" | "out" | "note" | "system"
author必填"customer" | "agent" | "bot" | "system"
authorUserId必填string (uuid) | null
body必填string
status必填string | null
createdAt必填string (date-time)

Users

People in this workspace (read only).

curl "https://api.metricrm.com/v1/users?limit=10" \
  -H "Authorization: Bearer $METRICRM_API_KEY"
GET/v1/users— List users

People in this workspace (read only). Requires the `users:read` scope.

参数

limitintegerPage size, 1–100 (default 25).
cursorstringThe nextCursor of the previous page.
sort"createdAt" | "updatedAt"Sort field (default createdAt).
order"asc" | "desc"Sort order (default desc).
createdSincestring (date-time)Only records created after this time (ISO 8601).
updatedSincestring (date-time)Only records changed after this time — use for incremental sync.
statusstringExact status (active, invited …).
emailstringExact email address.
GET/v1/users/{id}— Get one record

Requires the `users:read` scope.

参数

id必填string (uuid)Record id.
User 对象
id必填string (uuid)
email必填string
displayName必填string
title必填string | null
locale必填string | null
timezone必填string | null
status必填string
availability必填string
createdAt必填string (date-time)