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

# Rotar secreto

> Sustituye el secreto de firma de un webhook; el anterior sigue firmando durante 24 horas.

**Cuándo usarla:** Si el secreto puede haberse filtrado, o como cambio periódico.



## OpenAPI

````yaml /api-reference/openapi.es.json post /webhooks/{id}/rotate-secret
openapi: 3.1.0
info:
  title: API de Brelio
  version: '1'
  description: >-
    Todo lo que una persona hace en Brelio lo puede hacer un programa, con los
    mismos permisos, auditoría y límites. Cada endpoint se deriva del catálogo
    de operaciones.
servers:
  - url: https://api.brelio.app/v1
security: []
paths:
  /webhooks/{id}/rotate-secret:
    post:
      tags:
        - webhooks
      summary: Rotar secreto
      description: >-
        Sustituye el secreto de firma de un webhook; el anterior sigue firmando
        durante 24 horas.


        **Cuándo usarla:** Si el secreto puede haberse filtrado, o como cambio
        periódico.
      operationId: webhooks.rotateSecret
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
            format: uuid
            pattern: >-
              ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
            description: Id del endpoint del webhook.
        - name: Idempotency-Key
          in: header
          required: true
          schema:
            type: string
            minLength: 8
            maxLength: 255
          description: >-
            Único por comando; reutilízala solo para reintentar la misma
            llamada.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                expectedVersion:
                  type: integer
                  minimum: 1
                  maximum: 9007199254740991
                  description: >-
                    La `version` que leíste. La llamada falla con 409 si el
                    endpoint cambió desde entonces, y nunca sobrescribe.
              required:
                - expectedVersion
            examples:
              example1:
                summary: Rotate
                value:
                  id: 0b9a4a1e-6a4c-4d43-9a39-4c1f3a0d2b11
                  expectedVersion: 1
      responses:
        '200':
          description: Correcto
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                    format: uuid
                    pattern: >-
                      ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
                  secret:
                    description: >-
                      El nuevo secreto de firma, solo en esta respuesta.
                      Guárdalo ahora: Brelio no puede volver a mostrarlo.
                    type: string
                  secretCreatedAt:
                    type: string
                    format: date-time
                    pattern: >-
                      ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z))$
                    description: ISO 8601, en UTC.
                  previousSecretExpiresAt:
                    type: string
                    format: date-time
                    pattern: >-
                      ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z))$
                    description: >-
                      Hasta entonces, las entregas se firman con los dos
                      secretos.
                  version:
                    type: integer
                    minimum: -9007199254740991
                    maximum: 9007199254740991
                required:
                  - id
                  - secretCreatedAt
                  - previousSecretExpiresAt
                  - version
                additionalProperties: false
        '401':
          description: Problem Details (RFC 9457) con un `code` estable
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Problem'
        '402':
          description: Problem Details (RFC 9457) con un `code` estable
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Problem'
        '403':
          description: Problem Details (RFC 9457) con un `code` estable
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Problem'
        '422':
          description: Problem Details (RFC 9457) con un `code` estable
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Problem'
        '429':
          description: Problem Details (RFC 9457) con un `code` estable
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Problem'
        '503':
          description: Problem Details (RFC 9457) con un `code` estable
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Problem'
      security:
        - bearer: []
components:
  schemas:
    Problem:
      type: object
      required:
        - type
        - title
        - status
        - code
        - detail
        - request_id
        - params
      properties:
        type:
          type: string
        title:
          type: string
        status:
          type: integer
        code:
          type: string
        detail:
          type: string
        request_id:
          type: string
        hint:
          type: string
        retryAfterSeconds:
          type: integer
        params:
          type: object
  securitySchemes:
    bearer:
      type: http
      scheme: bearer
      description: >-
        Clave de API de Brelio (de organización o personal) o un token de acceso
        de WorkOS.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.