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

# Definir retenção e repasse

> Substitui as regras do override do evento



## OpenAPI

````yaml /openapi.json put /events/{event}/retention
openapi: 3.1.0
info:
  title: Eventor Management API v1
  version: 1.0.0
  description: >-
    Management API do Eventor (Fase 9) — configuração de evento ponta a ponta
    por agente/CLI. Autenticação: `Authorization: Bearer <api_key>` com escopo
    `manage`.


    Envelope de sucesso: `{data}` (item) e `{data,meta,links}` (coleção
    paginada).

    Envelope de erro: `{error,message,details}`.
servers:
  - url: http://localhost/api/v1
security:
  - bearerAuth: []
paths:
  /events/{event}/retention:
    put:
      tags:
        - Retention
      summary: Definir retenção e repasse
      description: Substitui as regras do override do evento
      operationId: retention.update
      parameters:
        - name: event
          in: path
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateRetentionRequest'
      responses:
        '200':
          description: '`JsonResource`'
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    $ref: '#/components/schemas/RetentionPolicyResource'
                required:
                  - data
        '401':
          description: API key ausente ou inválida.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
        '403':
          description: A API key não tem o escopo `manage`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
        '404':
          description: Recurso não encontrado neste hub.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
        '409':
          description: 'Conflito (ex.: dependência que impede a operação).'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
        '422':
          description: Falha de validação dos dados enviados.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
components:
  schemas:
    UpdateRetentionRequest:
      type: object
      description: >-
        PUT /api/v1/events/{event}/retention — substitui as regras do override
        do evento.

        As regras precisam somar 100% (validado no controller via
        RetentionPolicyWriter,

        que também aplica o piso de offset_days). Aqui só a estrutura de cada
        regra.
      properties:
        rules:
          type: array
          items:
            type: object
            properties:
              percent:
                type: integer
                minimum: 0
                maximum: 100
              anchor:
                $ref: '#/components/schemas/ReleaseAnchor'
              offset_days:
                type: integer
                minimum: 0
                maximum: 3650
            required:
              - percent
              - anchor
              - offset_days
          minItems: 1
      required:
        - rules
      title: UpdateRetentionRequest
    RetentionPolicyResource:
      type: object
      properties:
        id:
          type: integer
        hub_id:
          type: integer
        event_id:
          type:
            - integer
            - 'null'
        scope:
          type: string
          description: >-
            event_id null = padrão herdado do hub; preenchido = override do
            evento.
          enum:
            - event
            - hub_default
        status:
          type: string
        rules:
          type: array
          items:
            type: object
            properties:
              id:
                type: integer
              percent:
                type: integer
              anchor:
                type: string
              offset_days:
                type: integer
            required:
              - id
              - percent
              - anchor
              - offset_days
        created_at:
          type: string
        updated_at:
          type: string
      required:
        - id
        - hub_id
        - event_id
        - scope
        - status
        - created_at
        - updated_at
      title: RetentionPolicyResource
    ApiError:
      type: object
      properties:
        error:
          type: string
          description: >-
            Código machine-parseable (ex.: validation_failed, forbidden_scope,
            not_found).
        message:
          type: string
          description: Mensagem legível (português).
        details:
          type:
            - object
            - 'null'
          description: 'Detalhes opcionais (ex.: erros de validação por campo).'
          additionalProperties: {}
      required:
        - error
        - message
      title: ApiError
    ReleaseAnchor:
      type: string
      description: >
        Âncora de uma regra de retenção (Fase 02 / F2). - Payment → conta a
        partir de payments.paid_at  - Event   → conta a partir de events.date
        (dia da prova)
      enum:
        - payment
        - event
      title: ReleaseAnchor
  securitySchemes:
    bearerAuth:
      type: http
      description: >-
        API key do hub com escopo `manage`. Header: `Authorization: Bearer
        <api_key>`.
      scheme: bearer

````