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

# Ejecutar ahora (cron)

> Encola de inmediato una ejecución de una automatización con trigger cron.

Prueba una automatización programada sin esperar el horario del cron.

Solo aplica a triggers `cron`. La automatización debe estar **publicada** y **activada**.

## Endpoint

```text theme={null}
POST /workflows/{workflowId}/trigger-now
```

## Ejemplo de solicitud

```bash theme={null}
curl -X POST "https://api.insuranceboosters.com/api/v1/workflows/<workflow-id>/trigger-now" \
  -H "x-ib-api-key: TU_API_KEY"
```

## Respuesta exitosa (`202`)

```json theme={null}
{
  "runId": "<run-id>",
  "status": "queued"
}
```

## Errores frecuentes

| HTTP  | Qué significa                       | Qué hacer                                                                                                                                          |
| ----- | ----------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- |
| `400` | El trigger no es `cron`.            | Usa [Disparar webhook](/automatizaciones/disparar-webhook) para webhooks; los triggers de registros se disparan al crear o actualizar el registro. |
| `401` | API key inválida o faltante.        | Verifica `x-ib-api-key`.                                                                                                                           |
| `404` | La automatización no existe.        | Confirma `workflowId`.                                                                                                                             |
| `409` | Está desactivada o no publicada.    | Publica y activa antes de probar.                                                                                                                  |
| `429` | Hay demasiadas ejecuciones activas. | Espera a que terminen y reintenta.                                                                                                                 |


## OpenAPI

````yaml openapi/automatizaciones-v1.yaml POST /workflows/{workflowId}/trigger-now
openapi: 3.1.0
info:
  title: Insurance Boosters API — Automatizaciones
  version: 1.0.0
  description: >
    API pública para crear, publicar y ejecutar automatizaciones por webhook,
    cron o eventos de registros, y consultar sus versiones y ejecuciones.
  license:
    name: Propietaria
    url: https://insuranceboosters.com
servers:
  - url: https://api.insuranceboosters.com/api/v1
    description: Producción
security:
  - IbApiKey: []
tags:
  - name: Automatizaciones
    description: Definición, publicación y control de automatizaciones.
  - name: Versiones
    description: Instantáneas publicadas de una automatización.
  - name: Ejecuciones
    description: Historial y detalle de corridas.
  - name: Webhooks
    description: Disparo público de automatizaciones con trigger webhook.
paths:
  /workflows/{workflowId}/trigger-now:
    post:
      tags:
        - Automatizaciones
      summary: Ejecutar ahora (cron)
      operationId: triggerWorkflowNow
      parameters:
        - $ref: '#/components/parameters/WorkflowId'
      responses:
        '202':
          description: Ejecución encolada.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/QueuedRunResponse'
              example:
                runId: <run-id>
                status: queued
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          description: La automatización no está lista para ejecutarse.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                disabled:
                  value:
                    error: Workflow is disabled.
                notPublished:
                  value:
                    error: Workflow is not published.
        '429':
          description: Límite de ejecuciones activas alcanzado.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '500':
          $ref: '#/components/responses/InternalError'
components:
  parameters:
    WorkflowId:
      name: workflowId
      in: path
      required: true
      description: Identificador de la automatización.
      schema:
        type: string
  schemas:
    QueuedRunResponse:
      type: object
      required:
        - runId
        - status
      properties:
        runId:
          type: string
        status:
          type: string
          enum:
            - queued
    Error:
      type: object
      properties:
        error:
          type: string
      required:
        - error
    AuthError:
      type: object
      properties:
        message:
          type: string
      required:
        - message
  responses:
    BadRequest:
      description: Solicitud inválida.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Unauthorized:
      description: API key inválida o faltante.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/AuthError'
          example:
            message: Invalid API key.
    NotFound:
      description: Recurso no encontrado.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error: Workflow not found.
    InternalError:
      description: Error inesperado.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    IbApiKey:
      type: apiKey
      in: header
      name: x-ib-api-key
      description: API key emitida por Insurance Boosters.

````