> ## 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.

# Atualizar cupom



## OpenAPI

````yaml /openapi.json patch /events/{event}/coupons/{coupon}
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}/coupons/{coupon}:
    patch:
      tags:
        - Coupons
      summary: Atualizar cupom
      operationId: coupons.update
      parameters:
        - name: event
          in: path
          required: true
          schema:
            type: string
        - name: coupon
          in: path
          required: true
          schema:
            anyOf:
              - type: string
              - type: integer
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateCouponRequest'
      responses:
        '200':
          description: '`JsonResource`'
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    $ref: '#/components/schemas/CouponResource'
                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:
    UpdateCouponRequest:
      type: object
      description: >-
        PATCH /api/v1/events/{event}/coupons/{coupon} — atualização parcial do
        cupom.
      properties:
        code:
          type: string
          maxLength: 50
        type:
          $ref: '#/components/schemas/CouponType'
        value:
          type: integer
          description: >-
            value não conhece o type final aqui; valida só faixa segura. O
            controller

            reaplica o type efetivo. Mantemos 1-100 quando vier type=percent.
          minimum: 0
          maximum: 100000000
        min_order_cents:
          type:
            - integer
            - 'null'
          minimum: 0
        max_uses:
          type:
            - integer
            - 'null'
          minimum: 1
        max_uses_per_person:
          type: integer
          minimum: 1
        starts_at:
          type:
            - string
            - 'null'
          format: date-time
        expires_at:
          type:
            - string
            - 'null'
          format: date-time
        is_active:
          type: boolean
        description:
          type:
            - string
            - 'null'
          maxLength: 255
      title: UpdateCouponRequest
    CouponResource:
      type: object
      properties:
        id:
          type: integer
        event_id:
          type: integer
        code:
          type: string
        type:
          type: string
        value:
          type: integer
          description: >-
            value: percent (1-100) quando type=percent; centavos quando
            type=fixed.
        min_order_cents:
          type: integer
        max_uses:
          type:
            - integer
            - 'null'
        max_uses_per_person:
          type: integer
        starts_at:
          type: string
        expires_at:
          type: string
        is_active:
          type: boolean
        description:
          type:
            - string
            - 'null'
        created_at:
          type: string
        updated_at:
          type: string
      required:
        - id
        - event_id
        - code
        - type
        - value
        - min_order_cents
        - max_uses
        - max_uses_per_person
        - starts_at
        - expires_at
        - is_active
        - description
        - created_at
        - updated_at
      title: CouponResource
    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
    CouponType:
      type: string
      enum:
        - percent
        - fixed
      title: CouponType
  securitySchemes:
    bearerAuth:
      type: http
      description: >-
        API key do hub com escopo `manage`. Header: `Authorization: Bearer
        <api_key>`.
      scheme: bearer

````