AutoCount
by @teckyuen
Create and validate AutoCount business documents through AutoCount Web API. Use when the user wants to create or test sales invoices, purchase invoices, good...
clawhub install autocountπ About This Skill
name: AutoCount description: Create and validate AutoCount business documents through AutoCount Web API. Use when the user wants to create or test sales invoices, purchase invoices, goods received notes, inspect purchase orders, map debtor/creditor/item master data into document payloads, or build AutoCount document automation against a Windows-hosted AutoCount Web API.
AutoCount
Use this skill to create or test AutoCount documents through the AutoCount Web API.
Supported document work in this skill:
Workflow
1. Confirm the base URL, API name, and API key.
2. Use the headers:
- X-API-NAME: 9999
- X-API-KEY: 9999
- Content-Type: application/json
3. Prefer SaveAsDraft: true unless the user explicitly wants final posting.
4. For transfer chains, the source document must be final (SaveAsDraft: false). Draft purchase documents cannot be used as transfer sources.
5. Prefer AutoCount defaults (<<) over guessed business values.
6. Do not hardcode tax codes. Use defaults or system-derived values only.
7. After each create call, fetch the created record and report the actual document number.
Known API pattern
Base URL example:
http://your-autocount-host:9999Headers example:
X-API-NAME:
X-API-KEY:
Content-Type: application/json
Endpoints verified
Sales
POST {{localURL}}/api/SalesOrder/CreateRecordGET {{localURL}}/api/SalesOrder/GetRecord?docKey=...POST {{localURL}}/api/DeliveryOrder/CreateRecordGET {{localURL}}/api/DeliveryOrder/GetRecord?docKey=...POST {{localURL}}/api/Invoice/CreateRecordGET {{localURL}}/api/Invoice/GetRecord?docKey=...POST {{localURL}}/api/CreditNote/CreateRecordGET {{localURL}}/api/CreditNote/GetRecord?docKey=...POST {{localURL}}/api/CreditNote/UpdateRecord?docKey=...POST {{localURL}}/api/CreditNote/CancelRecord?docKey=...POST {{localURL}}/api/CreditNote/DeleteRecord?docKey=...Purchase
POST {{localURL}}/api/PurchaseOrder/CreateRecordPOST {{localURL}}/api/PurchaseOrder/UpdateRecord?docKey=...POST {{localURL}}/api/PurchaseInvoice/CreateRecordPOST {{localURL}}/api/GoodsReceivedNote/CreateRecordGET {{localURL}}/api/PurchaseOrder/GetRecord?docKey=...POST {{localURL}}/api/PurchaseOrder/GetRecordListGET {{localURL}}/api/GoodsReceivedNote/GetRecord?docKey=...POST {{localURL}}/api/GoodsReceivedNote/GetRecordListGET {{localURL}}/api/PurchaseInvoice/GetRecord?docKey=...Master data
GET {{localURL}}/api/Debtor/GetRecordListGET {{localURL}}/api/Creditor/GetRecordListGET {{localURL}}/api/Item/GetRecordListGET {{localURL}}/api/Location/GetRecordListGET {{localURL}}/api/Currency/GetRecordListCore rules
Defaults
Use AutoCount defaults where supported:
DocNo: "<<>>" DocNoFormatName: "<<>>" DebtorName: "<<>>" when not enriching from master dataDisplayTerm: "<<>>" CurrencyCode: "<<>>" <<>> TaxCode: "<<>>" is preferred over manually forcing a tax codeDraft option
"Options": {
"DocNoFormatName": "<<>>",
"SaveAsDraft": true
}
Reporting rule
After a successful create:
1. capture the returned docKey
2. call the matching GetRecord endpoint
3. report back at least:
- DocNo
- DocKey
- party code/name
- total/final total
Sales invoice pattern
Minimal stable sales invoice template
{
"Master": {
"DocNo": "<<>>",
"DocDate": "2026-03-27",
"DebtorCode": "SS29",
"DebtorName": "<<>>",
"SalesLocation": "HQ",
"DisplayTerm": "<<>>",
"CurrencyCode": "<<>>"
},
"Details": [
{
"ItemCode": "00001",
"UOM": "METER",
"UserUOM": "<<>>",
"Location": "HQ",
"Description": "<<>>",
"Qty": 2,
"UnitPrice": 22.22,
"TaxCode": "<<>>",
"Classification": "010",
"OriginCountryCode": "MYS"
}
],
"Options": {
"DocNoFormatName": "<<>>",
"SaveAsDraft": true
}
}
Purchase-side pattern
Purchase documents use a similar body shape to sales invoices, but with purchase-side party/location fields.
Purchase invoice template
{
"Master": {
"DocNo": "<<>>",
"CreditorCode": "400-S001",
"CreditorName": "SUPPLIER",
"PurchaseLocation": "HQ",
"DocDate": "2026-03-27",
"Description": "PURCHASE INVOICE",
"DisplayTerm": "C.O.D.",
"CurrencyCode": "MYR",
"CurrencyRate": 1
},
"Details": [
{
"DeliveryDate": "2026-03-27",
"ItemCode": "00002",
"UOM": "SET",
"UserUOM": "SET",
"Location": "HQ",
"Description": "SOFA ζ²ε",
"Qty": 10,
"FOCQty": 0,
"UnitPrice": 1000,
"Discount": "",
"TaxCode": "<<>>"
}
],
"Options": {
"DocNoFormatName": "<<>>",
"SaveAsDraft": true
}
}
Goods received note template
{
"Master": {
"DocNo": "<<>>",
"SupplierDONo": "AUTO-GRN-20260327-01",
"CreditorCode": "400-S001",
"CreditorName": "SUPPLIER",
"PurchaseLocation": "HQ",
"DocDate": "2026-03-27",
"Description": "GOODS RECEIVED NOTE",
"DisplayTerm": "C.O.D.",
"CurrencyCode": "MYR",
"CurrencyRate": 1
},
"Details": [
{
"DeliveryDate": "2026-03-27",
"ItemCode": "00002",
"UOM": "SET",
"UserUOM": "SET",
"Location": "HQ",
"Description": "SOFA ζ²ε",
"Qty": 10,
"FOCQty": 0,
"UnitPrice": 1000,
"Discount": "",
"TaxCode": "<<>>"
}
],
"Options": {
"DocNoFormatName": "<<>>",
"SaveAsDraft": true
}
}
SO β DO β Invoice guidance
Use this when the user wants sales document progression.
1. Create or inspect a final Sales Order first.
2. For transfer source documents, ensure the source is final, not draft.
3. For transfer creates, use transfer-only payloads:
- set Details: []
- populate TransferDetails[]
- do not include a matching manual detail row
4. SO β DO transfer:
- POST /api/DeliveryOrder/CreateRecord
- TransferDetails[].DocType = "SO"
5. DO β Invoice transfer:
- POST /api/Invoice/CreateRecord
- TransferDetails[].DocType = "DO"
6. Use SalesLocation on invoice payloads and sales-side master payloads where appropriate.
7. Set DocNo: "<< and DocNoFormatName: "<<.
8. Use TaxCode: "<< unless the system proves a specific value.
9. Fetch created records and report the final document numbers.
Proven live sales chain
A full sales chain was live-tested successfully:
DocType: "SO"DocType: "DO"PO β GRN β PI guidance
Use this when the user wants purchase document progression.
1. List purchase orders with:
- POST /api/PurchaseOrder/GetRecordList and body {}
2. Inspect a specific PO with:
- GET /api/PurchaseOrder/GetRecord?docKey=...
3. For transfer source documents, ensure the source is final, not draft.
4. For transfer creates, use transfer-only payloads:
- set Details: []
- populate TransferDetails[]
- do not include a matching manual detail row, or AutoCount may create an extra unlinked line
5. PO β GRN transfer:
- POST /api/GoodsReceivedNote/CreateRecord
- TransferDetails[].DocType = "PO"
6. GRN β PI transfer:
- POST /api/PurchaseInvoice/CreateRecord
- TransferDetails[].DocType = "GR"
7. Direct PO β PI transfer is also supported on a fresh final PO:
- TransferDetails[].DocType = "PO"
8. Add GRN-specific SupplierDONo when creating GRNs.
9. Set DocNo: "<< and DocNoFormatName: "<<.
10. Use TaxCode: "<< unless the system proves a specific value.
11. Fetch created records and report the final document numbers.
Transfer payload rule
Use this pattern for transfer documents:
{
"Master": {
"DocNo": "<<>>",
"DocDate": "2026-04-09",
"CreditorCode": "400-S001",
"CreditorName": "<<>>",
"PurchaseLocation": "HQ",
"DisplayTerm": "<<>>",
"CurrencyCode": "<<>>",
"CurrencyRate": "<<>>"
},
"Details": [],
"TransferDetails": [
{
"DocType": "PO",
"DocNo": "PO-000038",
"ItemCode": "00002",
"UOM": "SET",
"TransferQty": 5,
"TransferFOCQty": 0
}
],
"Options": {
"DocNoFormatName": "<<>>",
"SaveAsDraft": false
}
}
Swap DocType as follows:
PO for PO β GRNPO for PO β PIGR for GRN β PISO for SO β DODO for DO β InvoiceProven live chain
A full purchase chain was live-tested successfully:
DocType: "PO"DocType: "GR"Balance and over-transfer notes
AutoCount tracks transfer quantity at table level even when the normal PO API does not expose it. Observed relevant DB fields include:
PODTL.QtyPODTL.TransferedQtyPODTL.TransferablePIDTL.FromDocTypePIDTL.FromDocNoWorking balance formula:
Qty - TransferedQtyImportant: the standard PurchaseOrder/GetRecord API response did not expose TransferedQty, so automation should not assume the API will prevent over-transfer. Validate quantities before transfer when possible.
Update / cancel / delete safety
Treat these as real mutations.
1. Prefer testing update/cancel/delete only on fresh test documents unless the user clearly requests mutation on a real document.
2. UpdateRecord expects a clean create-style payload more often than a raw GetRecord echo.
3. CancelRecord and DeleteRecord are destructive.
4. After cancel/delete, a later GetRecord may return record-not-found.
5. Always report the exact affected DocNo and DocKey back to the user.
Confirmed live mutation routes
For Credit Note, the following worked in live testing:
POST /api/CreditNote/UpdateRecord?docKey=...POST /api/CreditNote/CancelRecord?docKey=...POST /api/CreditNote/DeleteRecord?docKey=...Observed behavior:
trueGetRecord returned record-not-found for the test documentEnrichment guidance
Before document creation, optionally fetch master data and copy display fields into the payload.
Sales enrichment
DebtorNameInvAddr1..4Phone1AttentionDisplayTermCurrencyCodePurchase enrichment
CreditorNameDisplayTermCurrencyCodeItem enrichment
DescriptionUOMThis makes the final document more complete in the AutoCount UI.
Known findings from testing
9999 over HTTP in the tested environment.404, which is normal for the service.X-API-NAME
- X-API-KEY
UpdateRecord?docKey=....POST {} instead of GET.SaveAsDraft: false did not reliably convert it into a final transferable PO in UI testing; creating a fresh final PO was reliable.Details: [] plus TransferDetails[] worked; mixing Details[] with TransferDetails[] created an extra unlinked manual line.TransferDetails[].DocType values confirmed in live testing:PO for PO β GRN
- PO for PO β PI
- GR for GRN β PI
GRN as a purchase invoice transfer doc type failed with Invalid transfer document.00001 worked repeatedly in sales invoices with:FABRIC
- UOM: METER
- origin country: MYS
TaxCode: "<<>>" worked and is preferred.DocNo was missing; adding DocNo: "<<>>" fixed it./api/Invoice/CreateRecord, not /api/SalesInvoice/CreateRecord.SO for SO β DO
- DO for DO β InvoiceReferences
Read references/test-notes.md for the observed behavior and payload patterns discovered during live testing.