Skip to content
Connect an agent

Organisations

Choose how long an organisation keeps its library and its audit log

Sets "Delete library diagrams not updated for" and "Keep the audit log for".

PUT/orgs/{org}/retention

TL;DR

QuestionAnswer
What does it do?Choose how long an organisation keeps its library and its audit log.
What does it take?A JSON body of type SetOrganisationRetentionBody.
What does it return?Status 200 with a body of type OrganisationGovernance.
What can go wrong?400 the body is not valid; 401 not signed in; 403 only the owner may (orgs.forbidden), the plan does not include the policies (plan.governance_not_included), or the request came from an origin that may not make changes; 404 no such organisation, or the caller is not a member of it; 429 too many requests; 503 organisations are not set up on this server. Every failure uses the one error envelope.

What it does

Sets "Delete library diagrams not updated for" and "Keep the audit log for". The sweep deletes library diagrams nobody updated for that long, unless kept, with their public links; the plan's retention still applies when shorter. The audit log choice only lengthens. Enterprise; only the owner.

Path parameters

FieldTypeRequiredDescription
orgstringyesThe organisation's id or its slug.

Request body

The body has the type SetOrganisationRetentionBody.

FieldTypeRequiredDescription
libraryDays90yes"Delete library diagrams not updated for": 90, 180, 365 or 730 days, or null for never (the default).
auditDays365yes"Keep the audit log for": 365, 730 or 2555 days (one, two or seven years), or null for the plan's days (the default). It only lengthens.

Responses

StatusMeaningBody
200The policies now.OrganisationGovernance
400The body is not valid.ErrorResponse
401Not signed in.ErrorResponse
403Only the owner may (orgs.forbidden), the plan does not include the policies (plan.governance_not_included), or the request came from an origin that may not make changes.ErrorResponse
404No such organisation, or the caller is not a member of it.ErrorResponse
429Too many requests.ErrorResponse
503Organisations are not set up on this server.ErrorResponse

Response body

A 200 answer has the type OrganisationGovernance.

FieldTypeRequiredDescription
availablebooleanyesWhether the organisation's plan includes the policies (Enterprise). A choice saved before is kept, and is not applied without it.
retentionOrganisationRetentionyes
retention.libraryDays90yes"Delete library diagrams not updated for": 90, 180, 365 or 730 days, or null for never (the default).
retention.auditDays365yes"Keep the audit log for": 365, 730 or 2555 days (one, two or seven years), or null for the plan's days (the default). It only lengthens.
retention.planLibraryDaysinteger | nullyesHow long the plan keeps a diagram after its last publish, or null for until it is deleted. The plan's limit wins when it is shorter.
retention.planAuditDaysintegeryesHow many days the plan keeps an audit event.
retention.effectiveLibraryDaysinteger | nullyesWhat is applied: the shorter of planLibraryDays and libraryDays. Null when diagrams are kept until they are deleted.
retention.effectiveAuditDaysintegeryesWhat is applied: the longer of planAuditDays and auditDays, auditDays counted up to auditMaxDays.
retention.auditMaxDaysintegeryesThe longest auditDays this server takes: 730 unless its database is on D1's paid tier, then 2555. Every organisation shares one database.
legalHoldobject | nullyesThe legal hold, or null when it is off. While it is on nothing of the organisation is deleted: no sweep, no member, and not the organisation itself.
legalHold.sinceintegeryesWhen the owner turned it on, in milliseconds since the epoch.
legalHold.reasonstring | nullyesThe reason the owner typed. Shown to the owner and admins; null for anyone else.
patternsOnlybooleanyes"Agents start from approved patterns": find_pattern, called through the organisation's connections and keys, answers with its own patterns only.
styleRulesStrictbooleanyes"Style rules are errors": a publish to the library that breaks a saved style rule is refused with the findings.

See also

DocWhy
API referenceEvery endpoint, and the error envelope
SchemasEvery request and response type
Tool referenceThe operations as callable tools