API Explorer 975 endpoints

Create Retention Policy

POST /obp/v7.0.0/management/banks/BANK_ID/retention-policies

OBPv7.0.0-createRetentionPolicy Roles: CanManageRetentionPolicy(per bank) Data-RetentionAPI

Create a retention policy for a space.

Only resource_type, retain_days and action are required (and entity_name and archive_days where the type and action call for them).

A retention policy says how long one kind of resource of a space stays live, and what happens to it then. BANK_ID is the space: a bank's id, or SYS for the system space. The Role is checked at that BANK_ID. Periods are configuration, set here per space, never in code.

  • resource_type: one of dynamic_entity_record, file, chat_message, chat_room, customer, consent.
  • entity_name: the dynamic entity, for dynamic_entity_record only. It must exist in the space.
  • date_basis: what the period is counted from. created or updated for dynamic entity records, chat messages and customers; or, for dynamic entity records, field:<name>, the ISO 8601 date in that field of the record. created for files. created, updated or last_activity (the last message, or creation when there was none) for chat rooms. created, updated or expires (the expiry of the Consent's token; the default) for consents. Defaults to created otherwise.
  • condition: optional, {"field": "status", "value": "CLOSED"}. Only resources whose field has this value (compared as text) are governed. For a dynamic entity record the field is one of the record's own; for the other types it is a field of the resource's JSON copy, such as media_type, message_type, customer_type or status.
  • retain_days: how long a resource stays live after its trigger date. At least retention.minimum_retain_days (1825 days, five years, by default).
  • action: archive (move it out of the live tables into the retention archive, readable only with CanGetRetentionArchive, then delete it after archive_days), delete (final), or, for customers only, anonymise (clear the personal fields and delete the attributes, addresses, dependants, tax residences and links to Users, keeping the customer id so that references stay valid). Archiving is not an undo: nothing is ever restored from the archive.
  • archive_days: required for archive, not allowed otherwise.
  • cascade: files attached to a disposed resource go with it (a dynamic entity record's files are attached with the entity name as record type; a customer's with customer). A file still attached to another record stays. Default false: the attachments go, the files stay.
  • requires_approval: an execution waits as pending until a second, different user approves it.
  • enabled: whether the retention scheduler runs the policy. Default true. A run can always be started by hand.

Every disposal is written to the disposal register. Resources on legal hold are skipped by every run. A run that would archive is refused unless retention.archive.enabled is true, and one that would delete or anonymise unless retention.delete.enabled is true. See RETENTION_PLAN.md.

User Authentication is Required. The User must be logged in. The Application must also be authenticated.

URL Parameters:

BANK_ID: gh.29.uk

JSON request body fields (14)
action
action
field
resource_type
resource_type
retain_days
retain_days
value
5987953
archive_days
archive_days
cascade
cascade
condition
condition
date_basis
date_basis
description
Description of the object. Maximum length is 2000. It can be any characters here.
enabled
false
entity_name
EXAMPLE COMPANY LTD
name
ACCOUNT_MANAGEMENT_FEE
requires_approval
requires_approval
JSON response body fields (19)
action
action
bank_id
gh.29.uk
cascade
cascade
created_at
created_at
created_by_user_id
date_basis
date_basis
description
Description of the object. Maximum length is 2000. It can be any characters here.
enabled
false
field
name
ACCOUNT_MANAGEMENT_FEE
requires_approval
requires_approval
resource_type
resource_type
retain_days
retain_days
retention_policy_id
retention_policy_id
updated_at
updated_at
value
5987953
archive_days
archive_days
condition
condition
entity_name
EXAMPLE COMPANY LTD
Example request body
{
  "name": "Close applications after two years",
  "description": "Applications are kept for two years after they were last changed, then archived for five more.",
  "resource_type": "dynamic_entity_record",
  "entity_name": "application",
  "date_basis": "updated",
  "condition": {
    "field": "status",
    "value": "CLOSED"
  },
  "retain_days": 2555,
  "archive_days": 1825,
  "action": "archive",
  "cascade": true,
  "requires_approval": true,
  "enabled": true
}
Example success response
{
  "retention_policy_id": "6a1f0e2c-3b8d-4c5e-9f7a-1d2e3f4a5b6c",
  "bank_id": "SYS",
  "name": "Close applications after two years",
  "description": "Applications are kept for two years after they were last changed, then archived for five more.",
  "resource_type": "dynamic_entity_record",
  "entity_name": "application",
  "date_basis": "updated",
  "condition": {
    "field": "status",
    "value": "CLOSED"
  },
  "retain_days": 2555,
  "archive_days": 1825,
  "action": "archive",
  "cascade": true,
  "requires_approval": true,
  "enabled": true,
  "created_by_user_id": "9ca9a7e4-6d02-40e3-a129-0b2bf89de9b1",
  "created_at": "2026-01-01T00:00:00Z",
  "updated_at": "2026-01-01T00:00:00Z"
}
Possible errors (6)
  • OBP-30001: Bank not found. Please specify a valid value for BANK_ID.
  • OBP-20001: User not logged in. Authentication is required!
  • OBP-20006: User is missing one or more roles:
  • OBP-10001: Incorrect json format.
  • OBP-30610: Invalid retention policy.
  • OBP-50000: Unknown Error.
Implemented by OBPv7.0.0 createRetentionPolicy