> ## Documentation Index
> Fetch the complete documentation index at: https://docs.orbit.devotel.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Set the org's per-domain data-retention policy

> Sets the message-body redaction window, the closed-conversation hard-delete window, and/or the audit-log purge window. Owner/admin only. The body is partial — send any one or more of `messages`, `conversations` and `audit_logs`; each domain is validated and clamped to its bounds independently, so sending one domain never overwrites the others. The response reflects the merged, resolved policy. This endpoint records policy only; redaction and deletion run asynchronously in the background.



## OpenAPI

````yaml /openapi.yaml put /api/v1/compliance/data-retention
openapi: 3.1.0
info:
  title: Devotel CPaaS API
  description: Orbit by Devotel — Communications Platform as a Service API
  version: 1.0.0
  contact:
    name: Devotel
    url: https://devotel.io
    email: support@devotel.io
  license:
    name: Proprietary
servers:
  - url: https://api.orbit.devotel.io
    description: Production
security:
  - Bearer: []
  - ApiKey: []
tags:
  - name: Messages
    description: >-
      Send and manage messages across all channels (SMS, WhatsApp, RCS, Email,
      Viber, etc.)
  - name: Fax
    description: >-
      List and track fax (MMS/T.38) transmissions on Telnyx-backed fax numbers
      (sending flows through the Messaging API)
  - name: Agents
    description: AI agent creation, configuration, and execution
  - name: Voice
    description: Voice calls, IVR, conferencing, and SIP trunking
  - name: OnCall
    description: On-call rotations and escalation policy planning for incident alerting
  - name: Webhooks
    description: Webhook endpoint management and delivery logs
  - name: Numbers
    description: Phone number search, provisioning, and configuration
  - name: Brand Identity
    description: >-
      Unified cross-channel brand trust posture (10DLC, toll-free, WhatsApp,
      RCS, branded calling, number KYC)
  - name: Contacts
    description: Contact management, segmentation, and lifecycle tracking
  - name: Campaigns
    description: Marketing campaign orchestration and analytics
  - name: Flows
    description: Automation flow builder and execution engine
  - name: Templates
    description: Message template management and approval workflows
  - name: Settings
    description: Organization, channel, and user preference settings
  - name: Verify
    description: OTP generation and verification across channels
  - name: Push
    description: Push notification delivery via FCM and APNs
  - name: Integrations
    description: Third-party service connections and OAuth management
  - name: CDP
    description: >-
      Customer Data Platform — activation surface (CRM object sync, streaming
      destinations, ad-audience activation)
  - name: Files
    description: >-
      Server-to-server media upload, listing, retrieval, and deletion
      (signed-URL backed)
  - name: Commerce
    description: >-
      Omnichannel conversational-commerce — persistent cart + checkout state
      machine, channel-agnostic hosted pay-by-link, native WhatsApp checkout,
      and AP2-style agent payment mandates.
  - name: Sync
    description: >-
      Real-time shared-state primitive (Twilio Sync parity) — Documents, Maps,
      Lists, and ephemeral Streams, with change events relayed over the
      /api/v1/ws/sync WebSocket gateway
paths:
  /api/v1/compliance/data-retention:
    put:
      tags:
        - Compliance
      summary: Set the org's per-domain data-retention policy
      description: >-
        Sets the message-body redaction window, the closed-conversation
        hard-delete window, and/or the audit-log purge window. Owner/admin only.
        The body is partial — send any one or more of `messages`,
        `conversations` and `audit_logs`; each domain is validated and clamped
        to its bounds independently, so sending one domain never overwrites the
        others. The response reflects the merged, resolved policy. This endpoint
        records policy only; redaction and deletion run asynchronously in the
        background.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              minProperties: 1
              additionalProperties: false
              description: >-
                Partial policy — at least one of `messages`, `conversations` or
                `audit_logs` must be present.
              properties:
                messages:
                  type: object
                  additionalProperties: false
                  required:
                    - redact_body_after_days
                  properties:
                    redact_body_after_days:
                      type: integer
                      description: >-
                        `0` disables scheduled body redaction; any other value
                        must be in [7, 3650] days.
                conversations:
                  type: object
                  additionalProperties: false
                  required:
                    - enabled
                  properties:
                    enabled:
                      type: boolean
                      description: >-
                        Enable/disable the closed-conversation hard-delete
                        sweep.
                    delete_closed_after_days:
                      type: integer
                      minimum: 30
                      maximum: 3650
                      description: >-
                        Days a conversation must have been closed before purge.
                        Clamped to [30, 3650]; defaults to the platform window
                        (180) when enabling without a value.
                audit_logs:
                  type: object
                  additionalProperties: false
                  required:
                    - enabled
                  properties:
                    enabled:
                      type: boolean
                      description: Enable/disable the audit-log purge sweep.
                    delete_after_days:
                      type: integer
                      minimum: 365
                      maximum: 3650
                      description: >-
                        Days an audit row must exist before purge. Clamped to
                        [365, 3650] (365 is the SOC2 regulatory floor); defaults
                        to the platform window (2190, HIPAA 6yr) when enabling
                        without a value.
      responses:
        '200':
          description: The merged, persisted per-domain data-retention policy.
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    $ref: '#/components/schemas/DataRetentionPolicyView'
                  meta:
                    $ref: '#/components/schemas/ResponseMeta'
        '403':
          $ref: '#/components/responses/StandardError'
        '422':
          $ref: '#/components/responses/StandardError'
components:
  schemas:
    DataRetentionPolicyView:
      type: object
      description: >-
        The org's resolved per-domain data-retention policy (GDPR Art. 5(1)(e)
        storage-limitation) plus the allowed min/max windows. All three domains
        are disabled by default. This endpoint records policy only; redaction
        and deletion are carried out asynchronously by scheduled background
        sweeps, not at the moment you read or write this policy.
      required:
        - messages
        - conversations
        - audit_logs
        - bounds
      additionalProperties: false
      properties:
        messages:
          type: object
          description: >-
            Message-body redaction policy. When enabled, the message body and
            recipient/sender identifiers are redacted after N days while
            billing-grade metadata (status, segments, price, carrier error) and
            the DLR/audit trail survive intact.
          required:
            - redact_body_after_days
          additionalProperties: false
          properties:
            redact_body_after_days:
              type: integer
              description: >-
                Days after which a message body is redacted. `0` means the
                scheduled sweep is disabled; any other value is within
                [bounds.messages.redact_body_min_days,
                bounds.messages.redact_body_max_days].
        conversations:
          type: object
          description: >-
            Closed-conversation hard-delete policy. When enabled, a conversation
            row is hard-deleted once it has been CLOSED longer than the window;
            attached message rows are not cascaded, so billing/audit metadata
            survives.
          required:
            - enabled
            - delete_closed_after_days
          additionalProperties: false
          properties:
            enabled:
              type: boolean
              description: Whether the closed-conversation purge runs for this org.
            delete_closed_after_days:
              type: integer
              description: >-
                Days a conversation must have been closed before it is purged,
                within [bounds.conversations.delete_closed_min_days,
                bounds.conversations.delete_closed_max_days].
        audit_logs:
          type: object
          description: >-
            Audit-log purge policy. When enabled, `audit_logs` rows older than
            the window are hard-deleted. The minimum window is a regulatory
            FLOOR protecting the SOC2 examination window.
          required:
            - enabled
            - delete_after_days
          additionalProperties: false
          properties:
            enabled:
              type: boolean
              description: Whether the audit-log purge runs for this org.
            delete_after_days:
              type: integer
              description: >-
                Days an audit row must exist before it is purged, within
                [bounds.audit_logs.delete_min_days,
                bounds.audit_logs.delete_max_days].
        bounds:
          type: object
          description: The allowed min/max windows the UI uses to clamp inputs.
          required:
            - messages
            - conversations
            - audit_logs
          additionalProperties: false
          properties:
            messages:
              type: object
              required:
                - redact_body_min_days
                - redact_body_max_days
              additionalProperties: false
              properties:
                redact_body_min_days:
                  type: integer
                redact_body_max_days:
                  type: integer
            conversations:
              type: object
              required:
                - delete_closed_min_days
                - delete_closed_max_days
              additionalProperties: false
              properties:
                delete_closed_min_days:
                  type: integer
                delete_closed_max_days:
                  type: integer
            audit_logs:
              type: object
              required:
                - delete_min_days
                - delete_max_days
              additionalProperties: false
              properties:
                delete_min_days:
                  type: integer
                delete_max_days:
                  type: integer
    ResponseMeta:
      type: object
      required:
        - request_id
        - timestamp
      additionalProperties: false
      properties:
        request_id:
          type: string
          description: Unique request identifier (also returned as X-Request-Id header)
        timestamp:
          type: string
          format: date-time
        docs_url:
          type: string
          format: uri
          nullable: true
  responses:
    StandardError:
      description: >-
        Standard error envelope. `error.code` is machine-readable; see the
        [error reference](https://docs.orbit.devotel.io/reference/error-codes)
        for the catalogue.
      content:
        application/json:
          schema:
            type: object
            properties:
              error:
                type: object
                required:
                  - code
                  - message
                  - status
                properties:
                  code:
                    type: string
                    description: Machine-readable error code (e.g. INVALID_PHONE_NUMBER)
                  message:
                    type: string
                    description: Human-readable error description
                  status:
                    type: integer
                    description: HTTP status code
                  details:
                    type: object
                    additionalProperties: true
                    description: Additional context about the error
              meta:
                type: object
                properties:
                  request_id:
                    type: string
                  timestamp:
                    type: string
                    format: date-time
                  docs_url:
                    type: string
                    format: uri
                    description: Link to relevant error documentation
  securitySchemes:
    Bearer:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: Dashboard JWT token from Clerk
    ApiKey:
      type: apiKey
      name: X-API-Key
      in: header
      description: Server-to-server API key (dv_live_sk_*)

````