Skip to main content

Overview

Update an existing event. Only pending events can be updated.
import { cuey } from "cuey";

const updatedEvent = await cuey.events.update("event-id", {
  webhook_url: "https://api.example.com/webhook",
  scheduled_at: "2025-01-01T00:00:00Z",
  payload: {
    message: "Updated message",
  },
});

Parameters

id
string
required
The UUID of the event to update.
webhook_url
string
required
The full URL of the webhook endpoint to call. Must be a valid HTTP/HTTPS URL.
method
string
HTTP method to use for the webhook request. Options: GET, POST, PUT, PATCH, DELETE, HEAD, OPTIONS. Defaults to POST.
scheduled_at
string
required
ISO 8601 timestamp when the event should execute. Must be in the future.
headers
object | null
Custom headers to include in the webhook request. Object with string keys and values.
payload
object | null
Payload to send with the webhook request. Can be any JSON-serializable object.
retry_config
object | null
Retry configuration for failed webhook attempts.

Response

event
Event
required
The updated event object.
{
  "id": "event-uuid-here",
  "cron_id": null,
  "retry_of": null,
  "scheduled_at": "2025-01-01T00:00:00Z",
  "executed_at": null,
  "status": "pending",
  "webhook_url": "https://api.example.com/webhook",
  "method": "POST",
  "headers": null,
  "payload": {
    "message": "Updated message"
  },
  "retry_config": null,
  "response_status": null,
  "response_headers": null,
  "response_body": null,
  "response_duration": null,
  "response_error": null,
  "created_at": "2024-01-15T10:30:00Z",
  "updated_at": "2024-01-16T12:00:00Z",
  "team_id": "team-uuid-here"
}

Errors

Only pending events can be updated. Events that are processing, successful, or failed cannot be updated.
  • NotFoundError: If the event doesn’t exist
  • BadRequestError: If the event is not in pending status
  • ValidationError: If the update data is invalid (e.g., scheduled_at is in the past)
  • UnauthorizedError: If API key is invalid or missing

Examples

Update Event Schedule

import { cuey } from "cuey";

const event = await cuey.events.get("event-id");

if (event.status === "pending") {
  const updated = await cuey.events.update(event.id, {
    webhook_url: event.webhook_url,
    method: event.method,
    scheduled_at: new Date(Date.now() + 120000).toISOString(), // 2 minutes from now
    payload: {
      message: "Updated!",
    },
  });

  console.log("Event updated:", updated.id);
}