Daftra MCP by usefulapi
Read clients, invoices, expenses and suppliers; create clients, invoices and expenses in Daftra.
我该使用它吗
质量与安全性
基于对工具定义和协议合规性的自动分析。
上下文开销
这是每次将服务器的工具加载到模型上下文窗口时所消耗的大致 token 数。数值越高,可用于其他任务的注意力就越少。
安装
一键安装
将以下内容添加到你的 `claude_desktop_config.json` 文件中:
{
"mcpServers": {
"daftra": {
"url": "https://daftra.usefulapi.io/mcp"
}
}
}远程端点
https://daftra.usefulapi.io/mcpstreamable-http它能做什么
工具清单
工具(30)
🟢daftra_get_site_info
The Daftra account this API key belongs to: id, business name, subdomain, country, timezone, date format, default currency and subscription expiry. Check the date format and currency here before creating records. GET /site_info.
输入模式
{
"type": "object",
"properties": {},
"$schema": "https://json-schema.org/draft/2020-12/schema"
}🟢daftra_list_clients(keywords, assign_staff_id, page, limit)
List clients (customers), 20 per page by default. Search by name, number, email or phone with `keywords`. Each item is wrapped in a `Client` object. GET /clients.
输入模式
{
"type": "object",
"properties": {
"keywords": {
"description": "Search by id, client number, business name, first/last name, email or phone.",
"type": "string",
"minLength": 1,
"maxLength": 200
},
"assign_staff_id": {
"description": "Only clients assigned to this staff member.",
"type": "integer",
"exclusiveMinimum": 0,
"maximum": 9007199254740991
},
"page": {
"description": "Page number, from 1 (default 1). Pass the previous reply's next_page.",
"type": "integer",
"exclusiveMinimum": 0,
"maximum": 100000
},
"limit": {
"description": "Results per page, 1-100 (default 20).",
"type": "integer",
"exclusiveMinimum": 0,
"maximum": 100
}
},
"$schema": "https://json-schema.org/draft/2020-12/schema"
}🟢daftra_get_client(client_id)
One client by id (contact details, balance settings, currency, address). GET /clients/{id}.
输入模式
{
"type": "object",
"properties": {
"client_id": {
"type": "integer",
"exclusiveMinimum": 0,
"maximum": 9007199254740991,
"description": "Daftra client id."
}
},
"required": [
"client_id"
],
"$schema": "https://json-schema.org/draft/2020-12/schema"
}🟢daftra_list_invoices(keywords, client_id, payment_status, date_from, date_to, ...)
List sales invoices (and debit notes), most recent first. Filter by client, payment status, dates or free text. By default each item has the header and client; set recursive=1 for line items, payments and taxes. GET /invoices.
输入模式
{
"type": "object",
"properties": {
"keywords": {
"description": "Search client name, client number, email, invoice number and order number.",
"type": "string",
"minLength": 1,
"maxLength": 200
},
"client_id": {
"description": "Only invoices of this client.",
"type": "integer",
"exclusiveMinimum": 0,
"maximum": 9007199254740991
},
"payment_status": {
"description": "0 unpaid, 1 partially paid, 2 paid, 4 overpaid, -1 draft, -2 due, -3 overdue, 3 subscriptions.",
"type": "integer",
"minimum": -3,
"maximum": 4
},
"date_from": {
"description": "Invoice date from, yyyy-mm-dd.",
"type": "string",
"pattern": "^(\\d{4})-(\\d{2})-(\\d{2})$"
},
"date_to": {
"description": "Invoice date to, yyyy-mm-dd.",
"type": "string",
"pattern": "^(\\d{4})-(\\d{2})-(\\d{2})$"
},
"due_date_from": {
"description": "Due date from, yyyy-mm-dd.",
"type": "string",
"pattern": "^(\\d{4})-(\\d{2})-(\\d{2})$"
},
"due_date_to": {
"description": "Due date to, yyyy-mm-dd.",
"type": "string",
"pattern": "^(\\d{4})-(\\d{2})-(\\d{2})$"
},
"summary_total_from": {
"description": "Minimum invoice total.",
"type": "number"
},
"summary_total_to": {
"description": "Maximum invoice total.",
"type": "number"
},
"currency_code": {
"description": "Only invoices in this currency, e.g. USD.",
"type": "string",
"minLength": 3,
"maxLength": 3
},
"recursive": {
"description": "-1 header only, 0 header + client (default), 1 also line items, payments, taxes.",
"type": "integer",
"minimum": -1,
"maximum": 1
},
"sort": {
"description": "Field to sort by (default invoice date).",
"type": "string",
"pattern": "^[a-z_]{1,40}$"
},
"direction": {
"description": "Sort direction (default DESC).",
"type": "string",
"enum": [
"ASC",
"DESC"
]
},
"page": {
"description": "Page number, from 1 (default 1). Pass the previous reply's next_page.",
"type": "integer",
"exclusiveMinimum": 0,
"maximum": 100000
},
"limit": {
"description": "Results per page, 1-100 (default 20).",
"type": "integer",
"exclusiveMinimum": 0,
"maximum": 100
}
},
"$schema": "https://json-schema.org/draft/2020-12/schema"
}🟢daftra_get_invoice(invoice_id)
One standard invoice by id with line items, payments, taxes, custom fields and client. Other document types (estimate, credit note) answer 404. GET /invoices/{id}.
输入模式
{
"type": "object",
"properties": {
"invoice_id": {
"type": "integer",
"exclusiveMinimum": 0,
"maximum": 9007199254740991,
"description": "Daftra invoice id."
}
},
"required": [
"invoice_id"
],
"$schema": "https://json-schema.org/draft/2020-12/schema"
}🟢daftra_list_estimates(name, client_id, payment_status, date_from, date_to, ...)
List estimates (quotes), most recent first. Filter by client, status, dates or free text. GET /estimates.
输入模式
{
"type": "object",
"properties": {
"name": {
"description": "Search client name, number, email and estimate number.",
"type": "string",
"minLength": 1,
"maxLength": 200
},
"client_id": {
"description": "Only estimates of this client.",
"type": "integer",
"exclusiveMinimum": 0,
"maximum": 9007199254740991
},
"payment_status": {
"description": "Estimate status id; -1 returns only drafts.",
"type": "integer",
"minimum": -1,
"maximum": 20
},
"date_from": {
"description": "Estimate date from, yyyy-mm-dd.",
"type": "string",
"pattern": "^(\\d{4})-(\\d{2})-(\\d{2})$"
},
"date_to": {
"description": "Estimate date to, yyyy-mm-dd.",
"type": "string",
"pattern": "^(\\d{4})-(\\d{2})-(\\d{2})$"
},
"currency_code": {
"description": "Only estimates in this currency.",
"type": "string",
"minLength": 3,
"maxLength": 3
},
"page": {
"description": "Page number, from 1 (default 1). Pass the previous reply's next_page.",
"type": "integer",
"exclusiveMinimum": 0,
"maximum": 100000
},
"limit": {
"description": "Results per page, 1-100 (default 20).",
"type": "integer",
"exclusiveMinimum": 0,
"maximum": 100
}
},
"$schema": "https://json-schema.org/draft/2020-12/schema"
}🟢daftra_get_estimate(estimate_id)
One estimate (quote) by id with line items, taxes and client. GET /estimates/{id}.
输入模式
{
"type": "object",
"properties": {
"estimate_id": {
"type": "integer",
"exclusiveMinimum": 0,
"maximum": 9007199254740991,
"description": "Daftra estimate id."
}
},
"required": [
"estimate_id"
],
"$schema": "https://json-schema.org/draft/2020-12/schema"
}🟢daftra_list_invoice_payments(client_id, no, payment_method, date_from, date_to, ...)
List payments recorded against invoices, most recent first. Opening-balance and client-credit payments are excluded. GET /invoice_payments.
输入模式
{
"type": "object",
"properties": {
"client_id": {
"description": "Only payments of this client.",
"type": "integer",
"exclusiveMinimum": 0,
"maximum": 9007199254740991
},
"no": {
"description": "Only payments of the invoice with this number.",
"type": "string",
"minLength": 1,
"maxLength": 100
},
"payment_method": {
"description": "Payment method, e.g. cash, bank, cheque, client_credit.",
"type": "string",
"minLength": 1,
"maxLength": 60
},
"date_from": {
"description": "Payment date from (account date format).",
"type": "string",
"minLength": 6,
"maxLength": 30
},
"date_to": {
"description": "Payment date to (account date format).",
"type": "string",
"minLength": 6,
"maxLength": 30
},
"amount_from": {
"description": "Minimum amount.",
"type": "number"
},
"amount_to": {
"description": "Maximum amount.",
"type": "number"
},
"status": {
"description": "0 not completed, 1 completed (see Daftra for other values).",
"type": "integer",
"minimum": 0,
"maximum": 10
},
"sort": {
"description": "Field to sort by, e.g. date, amount, id (default id).",
"type": "string",
"pattern": "^[a-z_]{1,40}$"
},
"direction": {
"description": "Sort direction (default desc).",
"type": "string",
"enum": [
"asc",
"desc"
]
},
"page": {
"description": "Page number, from 1 (default 1). Pass the previous reply's next_page.",
"type": "integer",
"exclusiveMinimum": 0,
"maximum": 100000
},
"limit": {
"description": "Results per page, 1-100 (default 20).",
"type": "integer",
"exclusiveMinimum": 0,
"maximum": 100
}
},
"$schema": "https://json-schema.org/draft/2020-12/schema"
}🟢daftra_list_client_payments(client_id, no, payment_method, date_from, date_to, ...)
List payments received from clients, most recent first. Opening-balance and client-credit payments are excluded. GET /client_payments.
输入模式
{
"type": "object",
"properties": {
"client_id": {
"description": "Only payments of this client.",
"type": "integer",
"exclusiveMinimum": 0,
"maximum": 9007199254740991
},
"no": {
"description": "Only payments of the invoice with this number.",
"type": "string",
"minLength": 1,
"maxLength": 100
},
"payment_method": {
"description": "Payment method, e.g. cash, bank, cheque, client_credit.",
"type": "string",
"minLength": 1,
"maxLength": 60
},
"date_from": {
"description": "Payment date from (account date format).",
"type": "string",
"minLength": 6,
"maxLength": 30
},
"date_to": {
"description": "Payment date to (account date format).",
"type": "string",
"minLength": 6,
"maxLength": 30
},
"amount_from": {
"description": "Minimum amount.",
"type": "number"
},
"amount_to": {
"description": "Maximum amount.",
"type": "number"
},
"status": {
"description": "0 not completed, 1 completed (see Daftra for other values).",
"type": "integer",
"minimum": 0,
"maximum": 10
},
"sort": {
"description": "Field to sort by, e.g. date, amount, id (default id).",
"type": "string",
"pattern": "^[a-z_]{1,40}$"
},
"direction": {
"description": "Sort direction (default desc).",
"type": "string",
"enum": [
"asc",
"desc"
]
},
"page": {
"description": "Page number, from 1 (default 1). Pass the previous reply's next_page.",
"type": "integer",
"exclusiveMinimum": 0,
"maximum": 100000
},
"limit": {
"description": "Results per page, 1-100 (default 20).",
"type": "integer",
"exclusiveMinimum": 0,
"maximum": 100
}
},
"$schema": "https://json-schema.org/draft/2020-12/schema"
}🟢daftra_list_products(keywords, category, supplier_id, product_code, status, ...)
List products and services (name, code, price, stock) ordered by name. Search by name, code, barcode or tag with `keywords`. Each item is a `Product` object. GET /products.
输入模式
{
"type": "object",
"properties": {
"keywords": {
"description": "Search product name, code, barcode and tags.",
"type": "string",
"minLength": 1,
"maxLength": 200
},
"category": {
"description": "Only products in this category id.",
"type": "integer",
"exclusiveMinimum": 0,
"maximum": 9007199254740991
},
"supplier_id": {
"description": "Only products of this supplier.",
"type": "integer",
"exclusiveMinimum": 0,
"maximum": 9007199254740991
},
"product_code": {
"description": "Exact product code.",
"type": "string",
"minLength": 1,
"maxLength": 100
},
"status": {
"description": "1 available, 2 low stock, 3 out of stock, 4 inactive, 5 suspended.",
"type": "integer",
"minimum": 1,
"maximum": 5
},
"page": {
"description": "Page number, from 1 (default 1). Pass the previous reply's next_page.",
"type": "integer",
"exclusiveMinimum": 0,
"maximum": 100000
},
"limit": {
"description": "Results per page, 1-100 (default 20).",
"type": "integer",
"exclusiveMinimum": 0,
"maximum": 100
}
},
"$schema": "https://json-schema.org/draft/2020-12/schema"
}🟢daftra_get_product(product_id)
One product by id with images and categories. GET /products/{id}.
输入模式
{
"type": "object",
"properties": {
"product_id": {
"type": "integer",
"exclusiveMinimum": 0,
"maximum": 9007199254740991,
"description": "Daftra product id."
}
},
"required": [
"product_id"
],
"$schema": "https://json-schema.org/draft/2020-12/schema"
}🟢daftra_list_product_categories(parent_id, page, limit)
List product categories with their parent category. GET /product_categories.
输入模式
{
"type": "object",
"properties": {
"parent_id": {
"description": "Only subcategories of this category id.",
"type": "integer",
"exclusiveMinimum": 0,
"maximum": 9007199254740991
},
"page": {
"description": "Page number, from 1 (default 1). Pass the previous reply's next_page.",
"type": "integer",
"exclusiveMinimum": 0,
"maximum": 100000
},
"limit": {
"description": "Results per page, 1-100 (default 20).",
"type": "integer",
"exclusiveMinimum": 0,
"maximum": 100
}
},
"$schema": "https://json-schema.org/draft/2020-12/schema"
}🟢daftra_list_stores(page, limit)
List stores (warehouses) the key's user may view. Use the ids to filter stock transactions. GET /stores.
输入模式
{
"type": "object",
"properties": {
"page": {
"description": "Page number, from 1 (default 1). Pass the previous reply's next_page.",
"type": "integer",
"exclusiveMinimum": 0,
"maximum": 100000
},
"limit": {
"description": "Results per page, 1-100 (default 20).",
"type": "integer",
"exclusiveMinimum": 0,
"maximum": 100
}
},
"$schema": "https://json-schema.org/draft/2020-12/schema"
}🟢daftra_list_stock_transactions(product_id, store_id, date_from, date_to, page, ...)
List processed stock movements (in, out, transfers), most recent first. Filter by product, store or date range. GET /stock_transactions.
输入模式
{
"type": "object",
"properties": {
"product_id": {
"description": "Only movements of this product.",
"type": "integer",
"exclusiveMinimum": 0,
"maximum": 9007199254740991
},
"store_id": {
"description": "Only movements in this store (warehouse).",
"type": "integer",
"exclusiveMinimum": 0,
"maximum": 9007199254740991
},
"date_from": {
"description": "Received date from (account date format).",
"type": "string",
"minLength": 6,
"maxLength": 30
},
"date_to": {
"description": "Received date to (account date format).",
"type": "string",
"minLength": 6,
"maxLength": 30
},
"page": {
"description": "Page number, from 1 (default 1). Pass the previous reply's next_page.",
"type": "integer",
"exclusiveMinimum": 0,
"maximum": 100000
},
"limit": {
"description": "Results per page, 1-100 (default 20).",
"type": "integer",
"exclusiveMinimum": 0,
"maximum": 100
}
},
"$schema": "https://json-schema.org/draft/2020-12/schema"
}🟢daftra_list_treasuries(page, limit)
List treasuries and bank accounts the key's user may view, with balances. Use the ids when recording expenses. GET /treasuries.
输入模式
{
"type": "object",
"properties": {
"page": {
"description": "Page number, from 1 (default 1). Pass the previous reply's next_page.",
"type": "integer",
"exclusiveMinimum": 0,
"maximum": 100000
},
"limit": {
"description": "Results per page, 1-100 (default 20).",
"type": "integer",
"exclusiveMinimum": 0,
"maximum": 100
}
},
"$schema": "https://json-schema.org/draft/2020-12/schema"
}🟢daftra_list_expenses(date_from, date_to, amount_from, amount_to, note, ...)
List expenses (money out), most recent first, with amount, vendor, category and treasury. Filter by dates, amount, category, vendor or status. GET /expenses.
输入模式
{
"type": "object",
"properties": {
"date_from": {
"description": "Date from (account date format).",
"type": "string",
"minLength": 6,
"maxLength": 30
},
"date_to": {
"description": "Date to (account date format).",
"type": "string",
"minLength": 6,
"maxLength": 30
},
"amount_from": {
"description": "Minimum amount.",
"type": "number"
},
"amount_to": {
"description": "Maximum amount.",
"type": "number"
},
"note": {
"description": "Words in the description (all must match).",
"type": "string",
"minLength": 1,
"maxLength": 200
},
"expense_category_id": {
"description": "Only this category id.",
"type": "integer",
"exclusiveMinimum": 0,
"maximum": 9007199254740991
},
"vendor": {
"description": "Exact vendor name.",
"type": "string",
"minLength": 1,
"maxLength": 200
},
"status": {
"description": "issued (posted) or draft.",
"type": "string",
"enum": [
"issued",
"draft"
]
},
"sort": {
"description": "Field to sort by, e.g. date, amount, id.",
"type": "string",
"pattern": "^[a-z_]{1,40}$"
},
"direction": {
"description": "Sort direction (default desc).",
"type": "string",
"enum": [
"asc",
"desc"
]
},
"page": {
"description": "Page number, from 1 (default 1). Pass the previous reply's next_page.",
"type": "integer",
"exclusiveMinimum": 0,
"maximum": 100000
},
"limit": {
"description": "Results per page, 1-100 (default 20).",
"type": "integer",
"exclusiveMinimum": 0,
"maximum": 100
}
},
"$schema": "https://json-schema.org/draft/2020-12/schema"
}🟢daftra_get_expense(expense_id)
One expense by id. GET /expenses/{id}.
输入模式
{
"type": "object",
"properties": {
"expense_id": {
"type": "integer",
"exclusiveMinimum": 0,
"maximum": 9007199254740991,
"description": "Daftra expense id."
}
},
"required": [
"expense_id"
],
"$schema": "https://json-schema.org/draft/2020-12/schema"
}🟢daftra_list_incomes(date_from, date_to, amount_from, amount_to, note, ...)
List incomes (money in that is not an invoice payment), most recent first. Same filters as expenses. GET /incomes.
输入模式
{
"type": "object",
"properties": {
"date_from": {
"description": "Date from (account date format).",
"type": "string",
"minLength": 6,
"maxLength": 30
},
"date_to": {
"description": "Date to (account date format).",
"type": "string",
"minLength": 6,
"maxLength": 30
},
"amount_from": {
"description": "Minimum amount.",
"type": "number"
},
"amount_to": {
"description": "Maximum amount.",
"type": "number"
},
"note": {
"description": "Words in the description (all must match).",
"type": "string",
"minLength": 1,
"maxLength": 200
},
"expense_category_id": {
"description": "Only this category id.",
"type": "integer",
"exclusiveMinimum": 0,
"maximum": 9007199254740991
},
"vendor": {
"description": "Exact vendor name.",
"type": "string",
"minLength": 1,
"maxLength": 200
},
"status": {
"description": "issued (posted) or draft.",
"type": "string",
"enum": [
"issued",
"draft"
]
},
"sort": {
"description": "Field to sort by, e.g. date, amount, id.",
"type": "string",
"pattern": "^[a-z_]{1,40}$"
},
"direction": {
"description": "Sort direction (default desc).",
"type": "string",
"enum": [
"asc",
"desc"
]
},
"page": {
"description": "Page number, from 1 (default 1). Pass the previous reply's next_page.",
"type": "integer",
"exclusiveMinimum": 0,
"maximum": 100000
},
"limit": {
"description": "Results per page, 1-100 (default 20).",
"type": "integer",
"exclusiveMinimum": 0,
"maximum": 100
}
},
"$schema": "https://json-schema.org/draft/2020-12/schema"
}🟢daftra_list_taxes(is_active)
List the taxes configured for the account (name, rate, active). Use the ids as tax1/tax2 on invoice lines. All taxes come in one reply. GET /taxes.
输入模式
{
"type": "object",
"properties": {
"is_active": {
"description": "true only active taxes, false only inactive; omit for all.",
"type": "boolean"
}
},
"$schema": "https://json-schema.org/draft/2020-12/schema"
}🟢daftra_list_purchase_invoices(keywords, payment_status, page, limit)
List purchase invoices (bills from suppliers), most recent first. Search by supplier or filter by payment status. GET /purchase_invoices.
输入模式
{
"type": "object",
"properties": {
"keywords": {
"description": "Search supplier name, email and number.",
"type": "string",
"minLength": 1,
"maxLength": 200
},
"payment_status": {
"description": "-1 drafts only, 0 unpaid, 1 partially paid, 2 paid, 4 overpaid; omit for all non-drafts.",
"type": "integer",
"minimum": -1,
"maximum": 4
},
"page": {
"description": "Page number, from 1 (default 1). Pass the previous reply's next_page.",
"type": "integer",
"exclusiveMinimum": 0,
"maximum": 100000
},
"limit": {
"description": "Results per page, 1-100 (default 20).",
"type": "integer",
"exclusiveMinimum": 0,
"maximum": 100
}
},
"$schema": "https://json-schema.org/draft/2020-12/schema"
}🟢daftra_get_purchase_invoice(purchase_invoice_id)
One purchase invoice by id with line items, supplier, taxes and payments. GET /purchase_invoices/{id}.
输入模式
{
"type": "object",
"properties": {
"purchase_invoice_id": {
"type": "integer",
"exclusiveMinimum": 0,
"maximum": 9007199254740991,
"description": "Daftra purchase invoice id."
}
},
"required": [
"purchase_invoice_id"
],
"$schema": "https://json-schema.org/draft/2020-12/schema"
}🟢daftra_list_suppliers(name, address, postal_code, country_code, status, ...)
List suppliers. Filter by name, address, postal code, country or status. GET /suppliers.
输入模式
{
"type": "object",
"properties": {
"name": {
"description": "Keyword in first name, last name, business name or email.",
"type": "string",
"minLength": 1,
"maxLength": 200
},
"address": {
"description": "Keyword in the address fields.",
"type": "string",
"minLength": 1,
"maxLength": 200
},
"postal_code": {
"description": "Postal code.",
"type": "string",
"minLength": 1,
"maxLength": 20
},
"country_code": {
"description": "ISO alpha-2 country code.",
"type": "string",
"minLength": 2,
"maxLength": 2
},
"status": {
"description": "0 active, 1 suspended.",
"type": "integer",
"minimum": 0,
"maximum": 1
},
"page": {
"description": "Page number, from 1 (default 1). Pass the previous reply's next_page.",
"type": "integer",
"exclusiveMinimum": 0,
"maximum": 100000
},
"limit": {
"description": "Results per page, 1-100 (default 20).",
"type": "integer",
"exclusiveMinimum": 0,
"maximum": 100
}
},
"$schema": "https://json-schema.org/draft/2020-12/schema"
}🟢daftra_get_supplier(supplier_id)
One supplier by id. GET /suppliers/{id}.
输入模式
{
"type": "object",
"properties": {
"supplier_id": {
"type": "integer",
"exclusiveMinimum": 0,
"maximum": 9007199254740991,
"description": "Daftra supplier id."
}
},
"required": [
"supplier_id"
],
"$schema": "https://json-schema.org/draft/2020-12/schema"
}🟢daftra_list_notes(from, to, page, limit)
List notes recorded against clients, invoices, estimates, purchase invoices, staff, suppliers, products and work orders: text, the record it belongs to (item_type + item_id), author, follow-up status. GET /notes.
输入模式
{
"type": "object",
"properties": {
"from": {
"description": "Only notes dated on or after this date (yyyy-mm-dd or date-time).",
"type": "string",
"minLength": 1,
"maxLength": 40
},
"to": {
"description": "Only notes dated on or before this date (yyyy-mm-dd or date-time).",
"type": "string",
"minLength": 1,
"maxLength": 40
},
"page": {
"description": "Page number, from 1 (default 1). Pass the previous reply's next_page.",
"type": "integer",
"exclusiveMinimum": 0,
"maximum": 100000
},
"limit": {
"description": "Results per page, 1-100 (default 20).",
"type": "integer",
"exclusiveMinimum": 0,
"maximum": 100
}
},
"$schema": "https://json-schema.org/draft/2020-12/schema"
}🟡daftra_create_client(business_name, type, first_name, last_name, email, ...)
WRITE: create a client (customer). Only business_name is required. Without an email the client is created as offline (no email sending). Returns the new client's id and client_number. POST /clients.
输入模式
{
"type": "object",
"properties": {
"business_name": {
"type": "string",
"minLength": 1,
"maxLength": 200,
"description": "The client's business or full name (required)."
},
"type": {
"description": "2 individual, 3 business.",
"anyOf": [
{
"type": "number",
"const": 2
},
{
"type": "number",
"const": 3
}
]
},
"first_name": {
"description": "First name.",
"type": "string",
"minLength": 1,
"maxLength": 100
},
"last_name": {
"description": "Last name.",
"type": "string",
"minLength": 1,
"maxLength": 100
},
"email": {
"description": "Email address.",
"type": "string",
"maxLength": 254,
"format": "email",
"pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
},
"phone1": {
"description": "Primary phone number.",
"type": "string",
"minLength": 1,
"maxLength": 40
},
"phone2": {
"description": "Secondary / mobile phone number.",
"type": "string",
"minLength": 1,
"maxLength": 40
},
"address1": {
"description": "Address line 1.",
"type": "string",
"minLength": 1,
"maxLength": 200
},
"address2": {
"description": "Address line 2.",
"type": "string",
"minLength": 1,
"maxLength": 200
},
"city": {
"description": "City.",
"type": "string",
"minLength": 1,
"maxLength": 100
},
"state": {
"description": "State / province.",
"type": "string",
"minLength": 1,
"maxLength": 100
},
"postal_code": {
"description": "Postal code.",
"type": "string",
"minLength": 1,
"maxLength": 20
},
"country_code": {
"description": "ISO 3166-1 alpha-2 country code, e.g. EG.",
"type": "string",
"minLength": 2,
"maxLength": 2
},
"default_currency_code": {
"description": "Default currency, ISO 4217, e.g. USD.",
"type": "string",
"minLength": 3,
"maxLength": 3
},
"notes": {
"description": "Free-text notes.",
"type": "string",
"minLength": 1,
"maxLength": 5000
},
"client_number": {
"description": "Own client code; generated when omitted.",
"type": "string",
"minLength": 1,
"maxLength": 40
}
},
"required": [
"business_name"
],
"$schema": "https://json-schema.org/draft/2020-12/schema"
}🔴daftra_update_client(client_id, business_name, type, first_name, last_name, ...)
WRITE: change fields of an existing client. Partial update: only the fields you pass change; business_name cannot be emptied. PUT /clients/{id}.
输入模式
{
"type": "object",
"properties": {
"client_id": {
"type": "integer",
"exclusiveMinimum": 0,
"maximum": 9007199254740991,
"description": "Daftra client id."
},
"business_name": {
"description": "New business or full name.",
"type": "string",
"minLength": 1,
"maxLength": 200
},
"type": {
"description": "2 individual, 3 business.",
"anyOf": [
{
"type": "number",
"const": 2
},
{
"type": "number",
"const": 3
}
]
},
"first_name": {
"description": "First name.",
"type": "string",
"minLength": 1,
"maxLength": 100
},
"last_name": {
"description": "Last name.",
"type": "string",
"minLength": 1,
"maxLength": 100
},
"email": {
"description": "Email address.",
"type": "string",
"maxLength": 254,
"format": "email",
"pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
},
"phone1": {
"description": "Primary phone number.",
"type": "string",
"minLength": 1,
"maxLength": 40
},
"phone2": {
"description": "Secondary / mobile phone number.",
"type": "string",
"minLength": 1,
"maxLength": 40
},
"address1": {
"description": "Address line 1.",
"type": "string",
"minLength": 1,
"maxLength": 200
},
"address2": {
"description": "Address line 2.",
"type": "string",
"minLength": 1,
"maxLength": 200
},
"city": {
"description": "City.",
"type": "string",
"minLength": 1,
"maxLength": 100
},
"state": {
"description": "State / province.",
"type": "string",
"minLength": 1,
"maxLength": 100
},
"postal_code": {
"description": "Postal code.",
"type": "string",
"minLength": 1,
"maxLength": 20
},
"country_code": {
"description": "ISO 3166-1 alpha-2 country code, e.g. EG.",
"type": "string",
"minLength": 2,
"maxLength": 2
},
"default_currency_code": {
"description": "Default currency, ISO 4217, e.g. USD.",
"type": "string",
"minLength": 3,
"maxLength": 3
},
"notes": {
"description": "Free-text notes.",
"type": "string",
"minLength": 1,
"maxLength": 5000
}
},
"required": [
"client_id"
],
"$schema": "https://json-schema.org/draft/2020-12/schema"
}🟡daftra_create_supplier(business_name, is_offline, first_name, last_name, email, ...)
WRITE: create a supplier. business_name is required; email is required unless is_offline is true. Returns the new supplier's id. POST /suppliers.
输入模式
{
"type": "object",
"properties": {
"business_name": {
"type": "string",
"minLength": 1,
"maxLength": 200,
"description": "The supplier's business name (required)."
},
"is_offline": {
"description": "true for a supplier without an email address.",
"type": "boolean"
},
"first_name": {
"description": "First name.",
"type": "string",
"minLength": 1,
"maxLength": 100
},
"last_name": {
"description": "Last name.",
"type": "string",
"minLength": 1,
"maxLength": 100
},
"email": {
"description": "Email address.",
"type": "string",
"maxLength": 254,
"format": "email",
"pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
},
"phone1": {
"description": "Primary phone number.",
"type": "string",
"minLength": 1,
"maxLength": 40
},
"phone2": {
"description": "Secondary / mobile phone number.",
"type": "string",
"minLength": 1,
"maxLength": 40
},
"address1": {
"description": "Address line 1.",
"type": "string",
"minLength": 1,
"maxLength": 200
},
"address2": {
"description": "Address line 2.",
"type": "string",
"minLength": 1,
"maxLength": 200
},
"city": {
"description": "City.",
"type": "string",
"minLength": 1,
"maxLength": 100
},
"state": {
"description": "State / province.",
"type": "string",
"minLength": 1,
"maxLength": 100
},
"postal_code": {
"description": "Postal code.",
"type": "string",
"minLength": 1,
"maxLength": 20
},
"country_code": {
"description": "ISO 3166-1 alpha-2 country code, e.g. EG.",
"type": "string",
"minLength": 2,
"maxLength": 2
},
"default_currency_code": {
"description": "Default currency, ISO 4217, e.g. USD.",
"type": "string",
"minLength": 3,
"maxLength": 3
},
"notes": {
"description": "Free-text notes.",
"type": "string",
"minLength": 1,
"maxLength": 5000
}
},
"required": [
"business_name"
],
"$schema": "https://json-schema.org/draft/2020-12/schema"
}🟡daftra_create_expense(amount, date, currency_code, vendor, category, ...)
WRITE: record an expense (money out of a treasury). amount and date are required; the treasury defaults to the primary one and the currency to the account currency. Pass unique_id so a retry cannot create it twice. Returns the new expense id and number. POST /expenses.
输入模式
{
"type": "object",
"properties": {
"amount": {
"type": "number",
"exclusiveMinimum": 0,
"maximum": 1000000000000,
"description": "Gross amount, positive."
},
"date": {
"type": "string",
"minLength": 6,
"maxLength": 30,
"description": "Expense date (account date format, usually yyyy-mm-dd); it must fall in an open financial period."
},
"currency_code": {
"description": "ISO 4217 code; defaults to the account currency.",
"type": "string",
"minLength": 3,
"maxLength": 3
},
"vendor": {
"description": "Vendor name.",
"type": "string",
"minLength": 1,
"maxLength": 200
},
"category": {
"description": "Category name; created if it does not exist.",
"type": "string",
"minLength": 1,
"maxLength": 200
},
"expense_category_id": {
"description": "Existing category id (instead of category).",
"type": "integer",
"exclusiveMinimum": 0,
"maximum": 9007199254740991
},
"note": {
"description": "Description.",
"type": "string",
"minLength": 1,
"maxLength": 5000
},
"supplier_id": {
"description": "Linked supplier id.",
"type": "integer",
"exclusiveMinimum": 0,
"maximum": 9007199254740991
},
"client_id": {
"description": "Linked client id.",
"type": "integer",
"exclusiveMinimum": 0,
"maximum": 9007199254740991
},
"treasury_id": {
"description": "Treasury to withdraw from (see daftra_list_treasuries).",
"type": "integer",
"exclusiveMinimum": 0,
"maximum": 9007199254740991
},
"expense_number": {
"description": "Own reference number; generated when omitted.",
"type": "string",
"minLength": 1,
"maxLength": 60
},
"unique_id": {
"description": "Idempotency key: reusing it returns the original expense instead of creating another.",
"type": "string",
"minLength": 1,
"maxLength": 100
}
},
"required": [
"amount",
"date"
],
"$schema": "https://json-schema.org/draft/2020-12/schema"
}🟡daftra_create_invoice(client_id, items, date, draft, currency_code, ...)
WRITE: create a sales invoice for a client with line items. It is saved as a DRAFT unless you pass draft=false; a final invoice posts to the books and stock. Returns the new invoice id. POST /invoices.
输入模式
{
"type": "object",
"properties": {
"client_id": {
"type": "integer",
"exclusiveMinimum": 0,
"maximum": 9007199254740991,
"description": "Client id (daftra_list_clients)."
},
"items": {
"minItems": 1,
"maxItems": 200,
"type": "array",
"items": {
"type": "object",
"properties": {
"item": {
"description": "Line name.",
"type": "string",
"minLength": 1,
"maxLength": 200
},
"description": {
"description": "Line description.",
"type": "string",
"minLength": 1,
"maxLength": 2000
},
"unit_price": {
"type": "number",
"maximum": 1000000000000,
"description": "Unit price, number only."
},
"quantity": {
"type": "number",
"exclusiveMinimum": 0,
"maximum": 1000000000,
"description": "Quantity (decimals allowed)."
},
"product_id": {
"description": "Product id from daftra_list_products.",
"type": "integer",
"exclusiveMinimum": 0,
"maximum": 9007199254740991
},
"tax1": {
"description": "First tax id from daftra_list_taxes; 0 or null = no tax; omit to inherit the product's tax.",
"anyOf": [
{
"type": "integer",
"minimum": 0,
"maximum": 9007199254740991
},
{
"type": "null"
}
]
},
"tax2": {
"description": "Second tax id; 0 or null = no tax; omit to inherit the product's tax.",
"anyOf": [
{
"type": "integer",
"minimum": 0,
"maximum": 9007199254740991
},
{
"type": "null"
}
]
},
"discount": {
"description": "Line discount (a percentage unless discount_type is 2).",
"type": "number",
"minimum": 0,
"maximum": 1000000000000
},
"discount_type": {
"description": "1 percentage, 2 fixed value.",
"anyOf": [
{
"type": "number",
"const": 1
},
{
"type": "number",
"const": 2
}
]
}
},
"required": [
"unit_price",
"quantity"
]
},
"description": "Invoice lines."
},
"date": {
"description": "Invoice date, yyyy-mm-dd; must fall in an open financial period (default today).",
"type": "string",
"pattern": "^(\\d{4})-(\\d{2})-(\\d{2})$"
},
"draft": {
"description": "true (default) saves a draft; false creates the final invoice.",
"type": "boolean"
},
"currency_code": {
"description": "ISO 4217 code; defaults to the account currency.",
"type": "string",
"minLength": 3,
"maxLength": 3
},
"no": {
"description": "Invoice number; generated when omitted.",
"type": "string",
"minLength": 1,
"maxLength": 60
},
"po_number": {
"description": "Purchase order number.",
"type": "string",
"minLength": 1,
"maxLength": 60
},
"notes": {
"description": "Notes shown to the client.",
"type": "string",
"minLength": 1,
"maxLength": 5000
},
"discount": {
"description": "Percentage discount on the whole invoice.",
"type": "number",
"minimum": 0,
"maximum": 100
}
},
"required": [
"client_id",
"items"
],
"$schema": "https://json-schema.org/draft/2020-12/schema"
}🟡daftra_add_note(type, id, body, date, share_with_partner)
WRITE: add a note to a client, invoice, estimate, purchase invoice, supplier, product, staff member or work order. The note is private unless share_with_partner is true. POST /notes/{type}/{id}.
输入模式
{
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": [
"client",
"invoice",
"estimate",
"purchase_order",
"staff",
"supplier",
"product",
"work_order"
],
"description": "Kind of record (purchase_order = purchase invoice)."
},
"id": {
"type": "integer",
"exclusiveMinimum": 0,
"maximum": 9007199254740991,
"description": "Id of that record."
},
"body": {
"type": "string",
"minLength": 1,
"maxLength": 10000,
"description": "Note text."
},
"date": {
"description": "Note date, yyyy-mm-dd (default today, UTC).",
"type": "string",
"pattern": "^(\\d{4})-(\\d{2})-(\\d{2})$"
},
"share_with_partner": {
"description": "true shares the note with the client or supplier (default private).",
"type": "boolean"
}
},
"required": [
"type",
"id",
"body"
],
"$schema": "https://json-schema.org/draft/2020-12/schema"
}社区
证据