Bsale MCP by usefulapi
Read Bsale products, documents and stock; manage customers, prices, receipts and payments.
我該用這個嗎
品質與安全性
根據工具定義與協定合規性的自動化分析。
上下文成本
這是每次將伺服器的工具載入模型上下文時所消耗的約略 token 數量。數量越高,可用於其他工作的注意力就越少。
安裝
一鍵安裝
將以下內容加入你的 `claude_desktop_config.json` 檔案:
{
"mcpServers": {
"bsale": {
"url": "https://bsale.usefulapi.io/mcp"
}
}
}遠端端點
https://bsale.usefulapi.io/mcpstreamable-http它能做什麼
工具清單
工具(25)
🟢bsale_list_documents(emitted_from, emitted_to, document_type_id, code_sii, client_id, ...)
List issued documents (boletas, facturas, notas de credito, guias...) newest-first as Bsale returns them, with number, dates, net/tax/total amounts, state, SII status and public PDF link. Filter by emission date range, document type, client, office, folio number or SII code. Use expand (details, payments, client, office, document_type) to embed related data. GET /v1/documents.json.
輸入結構描述
{
"type": "object",
"properties": {
"emitted_from": {
"type": "string",
"pattern": "^(\\d{4})-(\\d{2})-(\\d{2})$",
"description": "A date, yyyy-mm-dd."
},
"emitted_to": {
"type": "string",
"pattern": "^(\\d{4})-(\\d{2})-(\\d{2})$",
"description": "A date, yyyy-mm-dd."
},
"document_type_id": {
"description": "Document type id (see bsale_list_document_types).",
"type": "integer",
"exclusiveMinimum": 0,
"maximum": 9007199254740991
},
"code_sii": {
"description": "Tax code of the document type, e.g. 33 factura, 39 boleta, 61 nota de credito (Chile) or \"01\" (Peru). Not available for Mexico: use document_type_id.",
"anyOf": [
{
"type": "integer",
"exclusiveMinimum": 0,
"maximum": 9999
},
{
"type": "string",
"pattern": "^[A-Za-z0-9]{1,6}$"
}
]
},
"client_id": {
"type": "integer",
"exclusiveMinimum": 0,
"maximum": 9007199254740991
},
"client_code": {
"description": "Client tax id (RUT/RUC/RFC) as stored in Bsale.",
"type": "string",
"minLength": 1,
"maxLength": 40
},
"office_id": {
"description": "Branch (sucursal) id.",
"type": "integer",
"exclusiveMinimum": 0,
"maximum": 9007199254740991
},
"number": {
"description": "Document folio number.",
"type": "integer",
"exclusiveMinimum": 0,
"maximum": 9007199254740991
},
"informed_sii": {
"description": "Tax authority declaration status (SII, SUNAT or SAT): 0 accepted, 1 sent, 2 rejected.",
"type": "integer",
"minimum": 0,
"maximum": 2
},
"state": {
"description": "0 = active records (Bsale default), 1 = inactive.",
"anyOf": [
{
"type": "number",
"const": 0
},
{
"type": "number",
"const": 1
}
]
},
"expand": {
"maxItems": 8,
"type": "array",
"items": {
"type": "string",
"pattern": "^[a-z_]{1,40}$"
}
},
"limit": {
"description": "Results per page, 1-50 (default 25).",
"type": "integer",
"exclusiveMinimum": 0,
"maximum": 50
},
"offset": {
"description": "Items to skip (default 0). Pass the previous reply's next_offset.",
"type": "integer",
"minimum": 0,
"maximum": 10000000
}
},
"$schema": "https://json-schema.org/draft/2020-12/schema"
}🟢bsale_get_document(document_id, expand)
One document by id with its amounts, dates, state and links. Use expand=[details,payments,client,office,document_type,references,sellers] to include line items, payments and related records. GET /v1/documents/{id}.json.
輸入結構描述
{
"type": "object",
"properties": {
"document_id": {
"type": "integer",
"exclusiveMinimum": 0,
"maximum": 9007199254740991,
"description": "Bsale document id."
},
"expand": {
"maxItems": 8,
"type": "array",
"items": {
"type": "string",
"pattern": "^[a-z_]{1,40}$"
}
}
},
"required": [
"document_id"
],
"$schema": "https://json-schema.org/draft/2020-12/schema"
}🟢bsale_sales_summary(emitted_from, emitted_to, code_sii, per_document, limit, ...)
Totals of sales documents (net, tax, total, count) by month, document type and office for a date range; set per_document to list each document instead. Good for 'how much did we sell in September?'. GET /v1/documents/summary.json.
輸入結構描述
{
"type": "object",
"properties": {
"emitted_from": {
"type": "string",
"pattern": "^(\\d{4})-(\\d{2})-(\\d{2})$",
"description": "A date, yyyy-mm-dd."
},
"emitted_to": {
"type": "string",
"pattern": "^(\\d{4})-(\\d{2})-(\\d{2})$",
"description": "A date, yyyy-mm-dd."
},
"code_sii": {
"description": "Only these document type tax codes, e.g. [33, 39] (Chile) or [\"01\", \"03\"] (Peru).",
"maxItems": 10,
"type": "array",
"items": {
"anyOf": [
{
"type": "integer",
"exclusiveMinimum": 0,
"maximum": 9999
},
{
"type": "string",
"pattern": "^[A-Za-z0-9]{1,6}$"
}
]
}
},
"per_document": {
"description": "true = one row per document instead of grouped totals.",
"type": "boolean"
},
"limit": {
"description": "Results per page, 1-50 (default 25).",
"type": "integer",
"exclusiveMinimum": 0,
"maximum": 50
},
"offset": {
"description": "Items to skip (default 0). Pass the previous reply's next_offset.",
"type": "integer",
"minimum": 0,
"maximum": 10000000
}
},
"$schema": "https://json-schema.org/draft/2020-12/schema"
}🟢bsale_list_returns(expand, limit, offset)
List returns (devoluciones) with date, motive, amounts and the credit note issued. Use expand=[reference_document,credit_note,details] for more. GET /v1/returns.json.
輸入結構描述
{
"type": "object",
"properties": {
"expand": {
"maxItems": 8,
"type": "array",
"items": {
"type": "string",
"pattern": "^[a-z_]{1,40}$"
}
},
"limit": {
"description": "Results per page, 1-50 (default 25).",
"type": "integer",
"exclusiveMinimum": 0,
"maximum": 50
},
"offset": {
"description": "Items to skip (default 0). Pass the previous reply's next_offset.",
"type": "integer",
"minimum": 0,
"maximum": 10000000
}
},
"$schema": "https://json-schema.org/draft/2020-12/schema"
}🟢bsale_list_document_types(code_sii, state, limit, offset)
List document types (boleta, factura, nota de credito, guia de despacho...) with their id and tax (SII) code. Use the id when filtering documents. GET /v1/document_types.json.
輸入結構描述
{
"type": "object",
"properties": {
"code_sii": {
"anyOf": [
{
"type": "integer",
"exclusiveMinimum": 0,
"maximum": 9999
},
{
"type": "string",
"pattern": "^[A-Za-z0-9]{1,6}$"
}
]
},
"state": {
"description": "0 = active records (Bsale default), 1 = inactive.",
"anyOf": [
{
"type": "number",
"const": 0
},
{
"type": "number",
"const": 1
}
]
},
"limit": {
"description": "Results per page, 1-50 (default 25).",
"type": "integer",
"exclusiveMinimum": 0,
"maximum": 50
},
"offset": {
"description": "Items to skip (default 0). Pass the previous reply's next_offset.",
"type": "integer",
"minimum": 0,
"maximum": 10000000
}
},
"$schema": "https://json-schema.org/draft/2020-12/schema"
}🟢bsale_list_clients(code, first_name, last_name, email, state, ...)
List customers with name, tax id (code), email, phone, address, credit limit and loyalty points. Filter by tax id, name, last name or email. GET /v1/clients.json.
輸入結構描述
{
"type": "object",
"properties": {
"code": {
"description": "Client tax id (RUT/RUC/RFC) exactly as stored.",
"type": "string",
"minLength": 1,
"maxLength": 40
},
"first_name": {
"type": "string",
"minLength": 1,
"maxLength": 100
},
"last_name": {
"type": "string",
"minLength": 1,
"maxLength": 100
},
"email": {
"type": "string",
"minLength": 1,
"maxLength": 200
},
"state": {
"description": "0 = active records (Bsale default), 1 = inactive.",
"anyOf": [
{
"type": "number",
"const": 0
},
{
"type": "number",
"const": 1
}
]
},
"expand": {
"maxItems": 8,
"type": "array",
"items": {
"type": "string",
"pattern": "^[a-z_]{1,40}$"
}
},
"limit": {
"description": "Results per page, 1-50 (default 25).",
"type": "integer",
"exclusiveMinimum": 0,
"maximum": 50
},
"offset": {
"description": "Items to skip (default 0). Pass the previous reply's next_offset.",
"type": "integer",
"minimum": 0,
"maximum": 10000000
}
},
"$schema": "https://json-schema.org/draft/2020-12/schema"
}🟢bsale_get_client(client_id, expand)
One customer by id. Use expand=[contacts,attributes,addresses] to include contacts and extra attributes. GET /v1/clients/{id}.json.
輸入結構描述
{
"type": "object",
"properties": {
"client_id": {
"type": "integer",
"exclusiveMinimum": 0,
"maximum": 9007199254740991
},
"expand": {
"maxItems": 8,
"type": "array",
"items": {
"type": "string",
"pattern": "^[a-z_]{1,40}$"
}
}
},
"required": [
"client_id"
],
"$schema": "https://json-schema.org/draft/2020-12/schema"
}🟢bsale_client_unpaid_documents(client_id, client_code, as_of)
A client's receivables: overdue and upcoming debt, total owed, and the unpaid documents with amounts. Give client_id or client_code. GET /v1/clients/unpaid_documents.json.
輸入結構描述
{
"type": "object",
"properties": {
"client_id": {
"type": "integer",
"exclusiveMinimum": 0,
"maximum": 9007199254740991
},
"client_code": {
"description": "Client tax id (RUT/RUC/RFC).",
"type": "string",
"minLength": 1,
"maxLength": 40
},
"as_of": {
"description": "Date that splits overdue from upcoming (default: today).",
"type": "string",
"pattern": "^(\\d{4})-(\\d{2})-(\\d{2})$"
}
},
"$schema": "https://json-schema.org/draft/2020-12/schema"
}🟢bsale_list_products(product_type_id, classification, state, expand, limit, ...)
List products and services (name, description, class, stock control, state). SKUs live on variants: see bsale_list_variants. GET /v1/products.json.
輸入結構描述
{
"type": "object",
"properties": {
"product_type_id": {
"type": "integer",
"exclusiveMinimum": 0,
"maximum": 9007199254740991
},
"classification": {
"description": "0 product, 1 service, 3 pack/promotion.",
"type": "integer",
"minimum": 0,
"maximum": 3
},
"state": {
"description": "0 = active records (Bsale default), 1 = inactive.",
"anyOf": [
{
"type": "number",
"const": 0
},
{
"type": "number",
"const": 1
}
]
},
"expand": {
"maxItems": 8,
"type": "array",
"items": {
"type": "string",
"pattern": "^[a-z_]{1,40}$"
}
},
"limit": {
"description": "Results per page, 1-50 (default 25).",
"type": "integer",
"exclusiveMinimum": 0,
"maximum": 50
},
"offset": {
"description": "Items to skip (default 0). Pass the previous reply's next_offset.",
"type": "integer",
"minimum": 0,
"maximum": 10000000
}
},
"$schema": "https://json-schema.org/draft/2020-12/schema"
}🟢bsale_get_product(product_id, expand)
One product by id; expand=[product_type] adds the type. GET /v1/products/{id}.json.
輸入結構描述
{
"type": "object",
"properties": {
"product_id": {
"type": "integer",
"exclusiveMinimum": 0,
"maximum": 9007199254740991
},
"expand": {
"maxItems": 8,
"type": "array",
"items": {
"type": "string",
"pattern": "^[a-z_]{1,40}$"
}
}
},
"required": [
"product_id"
],
"$schema": "https://json-schema.org/draft/2020-12/schema"
}🟢bsale_list_variants(code, barcode, description, product_id, state, ...)
List product variants, the sellable SKUs: description, SKU code, barcode, stock settings and product link. Search by SKU code, barcode, description or product id. GET /v1/variants.json.
輸入結構描述
{
"type": "object",
"properties": {
"code": {
"description": "SKU code.",
"type": "string",
"minLength": 1,
"maxLength": 100
},
"barcode": {
"type": "string",
"minLength": 1,
"maxLength": 100
},
"description": {
"description": "Variant name.",
"type": "string",
"minLength": 1,
"maxLength": 200
},
"product_id": {
"type": "integer",
"exclusiveMinimum": 0,
"maximum": 9007199254740991
},
"state": {
"description": "0 = active records (Bsale default), 1 = inactive.",
"anyOf": [
{
"type": "number",
"const": 0
},
{
"type": "number",
"const": 1
}
]
},
"expand": {
"maxItems": 8,
"type": "array",
"items": {
"type": "string",
"pattern": "^[a-z_]{1,40}$"
}
},
"limit": {
"description": "Results per page, 1-50 (default 25).",
"type": "integer",
"exclusiveMinimum": 0,
"maximum": 50
},
"offset": {
"description": "Items to skip (default 0). Pass the previous reply's next_offset.",
"type": "integer",
"minimum": 0,
"maximum": 10000000
}
},
"$schema": "https://json-schema.org/draft/2020-12/schema"
}🟢bsale_get_variant(variant_id, expand)
One variant (SKU) by id; expand=[product] embeds the product. GET /v1/variants/{id}.json.
輸入結構描述
{
"type": "object",
"properties": {
"variant_id": {
"type": "integer",
"exclusiveMinimum": 0,
"maximum": 9007199254740991
},
"expand": {
"maxItems": 8,
"type": "array",
"items": {
"type": "string",
"pattern": "^[a-z_]{1,40}$"
}
}
},
"required": [
"variant_id"
],
"$schema": "https://json-schema.org/draft/2020-12/schema"
}🟢bsale_list_stocks(office_id, variant_id, code, barcode, expand, ...)
Stock per variant and office: quantity, reserved and available. Filter by office, variant id, SKU code or barcode (for a pack give a variant filter plus office_id). expand=[variant,office] adds names. GET /v1/stocks.json.
輸入結構描述
{
"type": "object",
"properties": {
"office_id": {
"type": "integer",
"exclusiveMinimum": 0,
"maximum": 9007199254740991
},
"variant_id": {
"type": "integer",
"exclusiveMinimum": 0,
"maximum": 9007199254740991
},
"code": {
"description": "SKU code.",
"type": "string",
"minLength": 1,
"maxLength": 100
},
"barcode": {
"type": "string",
"minLength": 1,
"maxLength": 100
},
"expand": {
"maxItems": 8,
"type": "array",
"items": {
"type": "string",
"pattern": "^[a-z_]{1,40}$"
}
},
"limit": {
"description": "Results per page, 1-50 (default 25).",
"type": "integer",
"exclusiveMinimum": 0,
"maximum": 50
},
"offset": {
"description": "Items to skip (default 0). Pass the previous reply's next_offset.",
"type": "integer",
"minimum": 0,
"maximum": 10000000
}
},
"$schema": "https://json-schema.org/draft/2020-12/schema"
}🟢bsale_list_price_lists(coin_id, expand, limit, offset)
List price lists with name, currency and state. Use the id with bsale_list_price_list_details. GET /v1/price_lists.json.
輸入結構描述
{
"type": "object",
"properties": {
"coin_id": {
"type": "integer",
"exclusiveMinimum": 0,
"maximum": 9007199254740991
},
"expand": {
"maxItems": 8,
"type": "array",
"items": {
"type": "string",
"pattern": "^[a-z_]{1,40}$"
}
},
"limit": {
"description": "Results per page, 1-50 (default 25).",
"type": "integer",
"exclusiveMinimum": 0,
"maximum": 50
},
"offset": {
"description": "Items to skip (default 0). Pass the previous reply's next_offset.",
"type": "integer",
"minimum": 0,
"maximum": 10000000
}
},
"$schema": "https://json-schema.org/draft/2020-12/schema"
}🟢bsale_list_price_list_details(price_list_id, variant_id, code, barcode, expand, ...)
Prices in one price list: the net price (variantValue) and price with taxes per variant, plus the detail id needed to change a price. Filter by variant id, SKU code or barcode. GET /v1/price_lists/{id}/details.json.
輸入結構描述
{
"type": "object",
"properties": {
"price_list_id": {
"type": "integer",
"exclusiveMinimum": 0,
"maximum": 9007199254740991
},
"variant_id": {
"type": "integer",
"exclusiveMinimum": 0,
"maximum": 9007199254740991
},
"code": {
"description": "SKU code.",
"type": "string",
"minLength": 1,
"maxLength": 100
},
"barcode": {
"type": "string",
"minLength": 1,
"maxLength": 100
},
"expand": {
"maxItems": 8,
"type": "array",
"items": {
"type": "string",
"pattern": "^[a-z_]{1,40}$"
}
},
"limit": {
"description": "Results per page, 1-50 (default 25).",
"type": "integer",
"exclusiveMinimum": 0,
"maximum": 50
},
"offset": {
"description": "Items to skip (default 0). Pass the previous reply's next_offset.",
"type": "integer",
"minimum": 0,
"maximum": 10000000
}
},
"required": [
"price_list_id"
],
"$schema": "https://json-schema.org/draft/2020-12/schema"
}🟢bsale_list_payments(paid_on, document_id, code_sii, number, expand, ...)
List payments received (amount, date, payment type, document, office, user). Filter by payment date, document id, or document tax code plus folio number. GET /v1/payments.json.
輸入結構描述
{
"type": "object",
"properties": {
"paid_on": {
"description": "Only payments recorded on this date.",
"type": "string",
"pattern": "^(\\d{4})-(\\d{2})-(\\d{2})$"
},
"document_id": {
"type": "integer",
"exclusiveMinimum": 0,
"maximum": 9007199254740991
},
"code_sii": {
"description": "Document tax code; combine with number.",
"anyOf": [
{
"type": "integer",
"exclusiveMinimum": 0,
"maximum": 9999
},
{
"type": "string",
"pattern": "^[A-Za-z0-9]{1,6}$"
}
]
},
"number": {
"description": "Document folio number; combine with code_sii.",
"type": "integer",
"exclusiveMinimum": 0,
"maximum": 9007199254740991
},
"expand": {
"maxItems": 8,
"type": "array",
"items": {
"type": "string",
"pattern": "^[a-z_]{1,40}$"
}
},
"limit": {
"description": "Results per page, 1-50 (default 25).",
"type": "integer",
"exclusiveMinimum": 0,
"maximum": 50
},
"offset": {
"description": "Items to skip (default 0). Pass the previous reply's next_offset.",
"type": "integer",
"minimum": 0,
"maximum": 10000000
}
},
"$schema": "https://json-schema.org/draft/2020-12/schema"
}🟢bsale_list_payment_types(state, limit, offset)
List payment methods (cash, card, transfer, credit...) with their id. The id is needed to record a payment. GET /v1/payment_types.json.
輸入結構描述
{
"type": "object",
"properties": {
"state": {
"description": "0 = active records (Bsale default), 1 = inactive.",
"anyOf": [
{
"type": "number",
"const": 0
},
{
"type": "number",
"const": 1
}
]
},
"limit": {
"description": "Results per page, 1-50 (default 25).",
"type": "integer",
"exclusiveMinimum": 0,
"maximum": 50
},
"offset": {
"description": "Items to skip (default 0). Pass the previous reply's next_offset.",
"type": "integer",
"minimum": 0,
"maximum": 10000000
}
},
"$schema": "https://json-schema.org/draft/2020-12/schema"
}🟢bsale_list_offices(state, limit, offset)
List branches (sucursales) with name, address and cost center. Use the id for stock and document filters. GET /v1/offices.json.
輸入結構描述
{
"type": "object",
"properties": {
"state": {
"description": "0 = active records (Bsale default), 1 = inactive.",
"anyOf": [
{
"type": "number",
"const": 0
},
{
"type": "number",
"const": 1
}
]
},
"limit": {
"description": "Results per page, 1-50 (default 25).",
"type": "integer",
"exclusiveMinimum": 0,
"maximum": 50
},
"offset": {
"description": "Items to skip (default 0). Pass the previous reply's next_offset.",
"type": "integer",
"minimum": 0,
"maximum": 10000000
}
},
"$schema": "https://json-schema.org/draft/2020-12/schema"
}🟢bsale_list_users(office_id, state, expand, limit, offset)
List Bsale users (sellers/cashiers) with name and office. GET /v1/users.json.
輸入結構描述
{
"type": "object",
"properties": {
"office_id": {
"type": "integer",
"exclusiveMinimum": 0,
"maximum": 9007199254740991
},
"state": {
"description": "0 = active records (Bsale default), 1 = inactive.",
"anyOf": [
{
"type": "number",
"const": 0
},
{
"type": "number",
"const": 1
}
]
},
"expand": {
"maxItems": 8,
"type": "array",
"items": {
"type": "string",
"pattern": "^[a-z_]{1,40}$"
}
},
"limit": {
"description": "Results per page, 1-50 (default 25).",
"type": "integer",
"exclusiveMinimum": 0,
"maximum": 50
},
"offset": {
"description": "Items to skip (default 0). Pass the previous reply's next_offset.",
"type": "integer",
"minimum": 0,
"maximum": 10000000
}
},
"$schema": "https://json-schema.org/draft/2020-12/schema"
}🟢bsale_user_sales_summary(from, to, user_id)
Sales and tax subtotal per seller for a date range (default: today, UTC), or for one user. GET /v1/users/sales_summary.json.
輸入結構描述
{
"type": "object",
"properties": {
"from": {
"type": "string",
"pattern": "^(\\d{4})-(\\d{2})-(\\d{2})$",
"description": "A date, yyyy-mm-dd."
},
"to": {
"type": "string",
"pattern": "^(\\d{4})-(\\d{2})-(\\d{2})$",
"description": "A date, yyyy-mm-dd."
},
"user_id": {
"type": "integer",
"exclusiveMinimum": 0,
"maximum": 9007199254740991
}
},
"$schema": "https://json-schema.org/draft/2020-12/schema"
}🟡bsale_create_client(first_name, last_name, company, code, email, ...)
WRITE: create a new customer in Bsale (it is visible to every user of the instance). Give at least a first name or a company. Bsale rejects a second client with the same tax id. POST /v1/clients.json.
輸入結構描述
{
"type": "object",
"properties": {
"first_name": {
"type": "string",
"minLength": 1,
"maxLength": 100
},
"last_name": {
"type": "string",
"minLength": 1,
"maxLength": 100
},
"company": {
"type": "string",
"minLength": 1,
"maxLength": 200
},
"code": {
"description": "Tax id (RUT in Chile, RUC in Peru, RFC in Mexico). Validate it first.",
"type": "string",
"minLength": 1,
"maxLength": 40
},
"email": {
"type": "string",
"maxLength": 200,
"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,}$"
},
"phone": {
"type": "string",
"minLength": 1,
"maxLength": 40
},
"address": {
"type": "string",
"minLength": 1,
"maxLength": 300
},
"city": {
"type": "string",
"minLength": 1,
"maxLength": 100
},
"municipality": {
"description": "Comuna (Chile) or municipality (Peru). Mexican accounts: use district.",
"type": "string",
"minLength": 1,
"maxLength": 100
},
"district": {
"description": "Colonia / district (Mexico). Chile and Peru: use municipality.",
"type": "string",
"minLength": 1,
"maxLength": 100
},
"activity": {
"description": "Giro / business activity.",
"type": "string",
"minLength": 1,
"maxLength": 200
},
"note": {
"type": "string",
"minLength": 1,
"maxLength": 1000
},
"is_foreigner": {
"description": "true for a foreign client (Bsale assigns tax id 55555555-5 unless you also pass code).",
"type": "boolean"
}
},
"$schema": "https://json-schema.org/draft/2020-12/schema"
}🔴bsale_update_client(client_id, first_name, last_name, company, code, ...)
WRITE: change fields of an existing customer; only the fields you pass are sent. This overwrites the stored values. PUT /v1/clients/{id}.json.
輸入結構描述
{
"type": "object",
"properties": {
"client_id": {
"type": "integer",
"exclusiveMinimum": 0,
"maximum": 9007199254740991
},
"first_name": {
"type": "string",
"minLength": 1,
"maxLength": 100
},
"last_name": {
"type": "string",
"minLength": 1,
"maxLength": 100
},
"company": {
"type": "string",
"minLength": 1,
"maxLength": 200
},
"code": {
"description": "Tax id (RUT in Chile, RUC in Peru, RFC in Mexico). Validate it first.",
"type": "string",
"minLength": 1,
"maxLength": 40
},
"email": {
"type": "string",
"maxLength": 200,
"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,}$"
},
"phone": {
"type": "string",
"minLength": 1,
"maxLength": 40
},
"address": {
"type": "string",
"minLength": 1,
"maxLength": 300
},
"city": {
"type": "string",
"minLength": 1,
"maxLength": 100
},
"municipality": {
"description": "Comuna (Chile) or municipality (Peru). Mexican accounts: use district.",
"type": "string",
"minLength": 1,
"maxLength": 100
},
"district": {
"description": "Colonia / district (Mexico). Chile and Peru: use municipality.",
"type": "string",
"minLength": 1,
"maxLength": 100
},
"activity": {
"description": "Giro / business activity.",
"type": "string",
"minLength": 1,
"maxLength": 200
},
"note": {
"type": "string",
"minLength": 1,
"maxLength": 1000
}
},
"required": [
"client_id"
],
"$schema": "https://json-schema.org/draft/2020-12/schema"
}🔴bsale_update_price(price_list_id, detail_id, net_price)
WRITE: set the net price (variantValue, without taxes) of one variant in a price list. This changes what Bsale charges on new sales using that list. Get detail_id from bsale_list_price_list_details. PUT /v1/price_lists/{id}/details/{detail_id}.json.
輸入結構描述
{
"type": "object",
"properties": {
"price_list_id": {
"type": "integer",
"exclusiveMinimum": 0,
"maximum": 9007199254740991
},
"detail_id": {
"type": "integer",
"exclusiveMinimum": 0,
"maximum": 9007199254740991,
"description": "Price list detail id (the id of the row in bsale_list_price_list_details)."
},
"net_price": {
"type": "number",
"minimum": 0,
"maximum": 1000000000,
"description": "New net price (before taxes) in the price list's currency."
}
},
"required": [
"price_list_id",
"detail_id",
"net_price"
],
"$schema": "https://json-schema.org/draft/2020-12/schema"
}🟡bsale_create_stock_reception(office_id, document, document_number, note, details)
WRITE: record a stock reception (ingreso de stock) that ADDS quantities to an office's inventory. Each line names the variant by id, SKU code or barcode, with quantity and unit cost. It changes stock levels and cost; Bsale has no undo through this API, so confirm the numbers first. POST /v1/stocks/receptions.json.
輸入結構描述
{
"type": "object",
"properties": {
"office_id": {
"type": "integer",
"exclusiveMinimum": 0,
"maximum": 9007199254740991,
"description": "Office (sucursal) receiving the stock."
},
"document": {
"description": "Kind of incoming document, e.g. \"Guia\", \"Factura\", \"Otro\" (default \"Otro\").",
"type": "string",
"minLength": 1,
"maxLength": 50
},
"document_number": {
"description": "Number of the incoming document.",
"type": "integer",
"minimum": 0,
"maximum": 9007199254740991
},
"note": {
"type": "string",
"minLength": 1,
"maxLength": 500
},
"details": {
"minItems": 1,
"maxItems": 100,
"type": "array",
"items": {
"type": "object",
"properties": {
"variant_id": {
"type": "integer",
"exclusiveMinimum": 0,
"maximum": 9007199254740991
},
"code": {
"description": "SKU code.",
"type": "string",
"minLength": 1,
"maxLength": 100
},
"barcode": {
"type": "string",
"minLength": 1,
"maxLength": 100
},
"quantity": {
"type": "number",
"exclusiveMinimum": 0,
"maximum": 1000000000
},
"cost": {
"description": "Unit cost.",
"type": "number",
"minimum": 0,
"maximum": 1000000000
},
"serial_number": {
"description": "Only for serial-tracked variants.",
"type": "string",
"minLength": 1,
"maxLength": 100
}
},
"required": [
"quantity"
]
}
}
},
"required": [
"office_id",
"details"
],
"$schema": "https://json-schema.org/draft/2020-12/schema"
}🟡bsale_create_payment(document_id, payment_type_id, amount, paid_on)
WRITE: record a payment against an issued document (normally a credit sale that is still unpaid). It changes the document's receivable balance in the books and cannot be removed through this API. Check the amount with bsale_client_unpaid_documents first and get payment_type_id from bsale_list_payment_types. POST /v1/payments.json.
輸入結構描述
{
"type": "object",
"properties": {
"document_id": {
"type": "integer",
"exclusiveMinimum": 0,
"maximum": 9007199254740991
},
"payment_type_id": {
"type": "integer",
"exclusiveMinimum": 0,
"maximum": 9007199254740991
},
"amount": {
"type": "number",
"exclusiveMinimum": 0,
"maximum": 1000000000000
},
"paid_on": {
"description": "Payment date (default: today, UTC).",
"type": "string",
"pattern": "^(\\d{4})-(\\d{2})-(\\d{2})$"
}
},
"required": [
"document_id",
"payment_type_id",
"amount"
],
"$schema": "https://json-schema.org/draft/2020-12/schema"
}社群
證據