curl --request PUT \
--url 'https://api.entendre.finance/v1/memory/file?path=knowledge/vendors.md' \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '{
"content": "Treat approved staking rewards as revenue.",
"rationale": "Record the approved treatment of staking rewards.",
"expected_version": null
}'
const response = await fetch('https://api.entendre.finance/v1/memory/file?path=knowledge/vendors.md', {
method: 'PUT',
headers: {
'Content-Type': 'application/json',
'X-API-Key': '<api-key>',
},
body: JSON.stringify({
content: 'Treat approved staking rewards as revenue.',
rationale: 'Record the approved treatment of staking rewards.',
expected_version: null,
}),
});
if (!response.ok) throw new Error(`HTTP ${response.status}`);
console.log(await response.json());
import requests
response = requests.put(
"https://api.entendre.finance/v1/memory/file",
params={
"path": "knowledge/vendors.md"
},
headers={"X-API-Key": "<api-key>"},
json={
"content": "Treat approved staking rewards as revenue.",
"rationale": "Record the approved treatment of staking rewards.",
"expected_version": None
},
timeout=30,
)
response.raise_for_status()
print(response.json())
{
"success": true,
"path": "knowledge/vendors.md",
"layer": "org",
"rationale": "Record the approved treatment of staking rewards."
}{
"error": {
"code": "VALIDATION_ERROR",
"message": "Invalid path, query or request body.",
"request_id": "req_example"
}
}{
"error": {
"code": "UNAUTHORIZED",
"message": "Authentication is required.",
"request_id": "req_example"
}
}{
"error": {
"code": "FORBIDDEN",
"message": "Insufficient access to organization",
"request_id": "req_example"
}
}{
"error": {
"code": "CONFLICT",
"message": "The supplied version does not match the organization file. Read it again before deciding to replace it.",
"request_id": "req_example"
}
}{
"error": {
"code": "RATE_LIMITED",
"message": "Rate limit exceeded. Retry after 30s.",
"request_id": "req_example"
}
}{
"error": {
"code": "PROVIDER_ERROR",
"message": "The memory service is temporarily unavailable.",
"request_id": "req_example"
}
}Write memory
Creates or replaces a memory document or an operational rule.
curl --request PUT \
--url 'https://api.entendre.finance/v1/memory/file?path=knowledge/vendors.md' \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '{
"content": "Treat approved staking rewards as revenue.",
"rationale": "Record the approved treatment of staking rewards.",
"expected_version": null
}'
const response = await fetch('https://api.entendre.finance/v1/memory/file?path=knowledge/vendors.md', {
method: 'PUT',
headers: {
'Content-Type': 'application/json',
'X-API-Key': '<api-key>',
},
body: JSON.stringify({
content: 'Treat approved staking rewards as revenue.',
rationale: 'Record the approved treatment of staking rewards.',
expected_version: null,
}),
});
if (!response.ok) throw new Error(`HTTP ${response.status}`);
console.log(await response.json());
import requests
response = requests.put(
"https://api.entendre.finance/v1/memory/file",
params={
"path": "knowledge/vendors.md"
},
headers={"X-API-Key": "<api-key>"},
json={
"content": "Treat approved staking rewards as revenue.",
"rationale": "Record the approved treatment of staking rewards.",
"expected_version": None
},
timeout=30,
)
response.raise_for_status()
print(response.json())
{
"success": true,
"path": "knowledge/vendors.md",
"layer": "org",
"rationale": "Record the approved treatment of staking rewards."
}{
"error": {
"code": "VALIDATION_ERROR",
"message": "Invalid path, query or request body.",
"request_id": "req_example"
}
}{
"error": {
"code": "UNAUTHORIZED",
"message": "Authentication is required.",
"request_id": "req_example"
}
}{
"error": {
"code": "FORBIDDEN",
"message": "Insufficient access to organization",
"request_id": "req_example"
}
}{
"error": {
"code": "CONFLICT",
"message": "The supplied version does not match the organization file. Read it again before deciding to replace it.",
"request_id": "req_example"
}
}{
"error": {
"code": "RATE_LIMITED",
"message": "Rate limit exceeded. Retry after 30s.",
"request_id": "req_example"
}
}{
"error": {
"code": "PROVIDER_ERROR",
"message": "The memory service is temporarily unavailable.",
"request_id": "req_example"
}
}kind to document (the default) or rule. The Body section marks each field as document only or rule only.
Documents require the write:memory scope. Rules require the write:operational-rules scope and an API key with an owner.
A document write replaces the full file. To replace a document, read it first and send its organization-layer version as expected_version. Document text is reference information; it does not change accounting controls.
A saved rule applies to later classification and cash-application runs. It does not process transactions now; to classify selected transactions now, use Classify transactions. Rules apply only to your organization and do not inherit firm documents.
Returns the saved document path, or the saved rule and its outcome. The document response does not include the new version; read the document again to get it.
curl --request PUT \
--url 'https://api.entendre.finance/v1/memory/file?path=knowledge/vendors.md' \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '{
"content": "Treat approved staking rewards as revenue.",
"rationale": "Record the approved treatment of staking rewards.",
"expected_version": null
}'
const response = await fetch('https://api.entendre.finance/v1/memory/file?path=knowledge/vendors.md', {
method: 'PUT',
headers: {
'Content-Type': 'application/json',
'X-API-Key': '<api-key>',
},
body: JSON.stringify({
content: 'Treat approved staking rewards as revenue.',
rationale: 'Record the approved treatment of staking rewards.',
expected_version: null,
}),
});
if (!response.ok) throw new Error(`HTTP ${response.status}`);
console.log(await response.json());
import requests
response = requests.put(
"https://api.entendre.finance/v1/memory/file",
params={
"path": "knowledge/vendors.md"
},
headers={"X-API-Key": "<api-key>"},
json={
"content": "Treat approved staking rewards as revenue.",
"rationale": "Record the approved treatment of staking rewards.",
"expected_version": None
},
timeout=30,
)
response.raise_for_status()
print(response.json())
Authorizations
Your organization API key. Some operations also need a key that is associated with a user; their pages say so.
Query Parameters
document (the default) for a memory document, or rule for an operational rule.
document, rule Document only, and required for documents. Relative path of a Markdown or YAML file, such as knowledge/vendors.md. Use profile.md, clients.yaml, or a file in a folder. You cannot write JSON or JSONL files, or files in refs/, journal/, artifacts/, timeline/, workstreams/, knowledge/facts/, knowledge/preferences/ or knowledge/decisions/. A skill must be skills/{slug}/SKILL.md. Firm documents allow only policy/, knowledge/, skills/, profile.md and clients.yaml.
1Body
- Option 1
- Option 2
Document only, and required for documents. The full file body. A write replaces the file; it never merges.
200000Document only, and required for documents. Why you make this change. It is recorded with the document.
1 - 2000Document only, and required for documents. The version you read for this path, or null to create a new file. A mismatch returns HTTP 409.
Rule only. classification for transaction rules, or cash_application for deposit matching rules.
classification, cash_application Rule only. Classification rules: text that matches the memo or payee of a bank transaction. Saved and returned in lowercase. Matching ignores case.
Rule only. For classification rules: source-platform metadata category (Plaid personal-finance category, Ramp accounting category). Preferred for a class of transactions.
Rule only. For classification rules: merchant match for card spend (Ramp/Raincard).
Rule only. Classification rules: address that matches the from or to address. Saved and returned in lowercase. Matching ignores case.
Rule only. For classification rules: asset match for crypto transactions (USDC, ETH, …).
Rule only. For classification rules: direction constraint. Defaults to ANY.
DEPOSIT, WITHDRAWAL, ANY Rule only. Required for classification rules: the ledger account matching transactions are classified to. Get it from List ledger accounts.
Rule only. For classification rules: clean payee name for display.
Rule only. For classification rules: tag applied to matching transactions.
Rule only. Required for cash-application rules: short human-readable rule name.
Rule only. Required for cash-application rules: natural-language statement of the rule.
Rule only. For cash-application rules: defaults to route_to_account.
route_to_account, require_human_review Rule only. Required for cash-application rules: the exact phrase matched against invoice line descriptions / product names. Supply the SKU or product text verbatim.
Rule only. For cash-application rules: contains (default) fires when the line text contains the matcher anywhere; exact requires the normalized line label to equal it.
exact, contains Rule only. Required for cash-application rules with route_to_account: target ledger account id. It is not inferred from the rule text.
Rule only. Required for cash-application rules with route_to_account: name matching ledger_account_id, for display and auditing.
Response
The organization memory file was saved.