Skip to main content
  • Snap

snap_scheduleBackgroundEvent

Description

Schedule a background event for a Snap. The background event will trigger a JSON-RPC request to the Snap at the scheduled time, handled by the onCronjob entry point in the Snap.

The schedule can be defined using either an ISO 8601 date or duration string. For example:

  • Using a date: 2026-12-31T23:59:59Z
  • Using a duration: P1DT2H (which represents a duration of 1 day and 2 hours)

Parameters

union

The request parameters for the snap_scheduleBackgroundEvent method.

Note: The date generated from a duration will be represented in UTC.

Options

object

date

string
required

or

object

duration

string
required

Common properties

request

object
required

method

string
required

params

JsonRpcParams

Returns

string

The ID of the scheduled background event.

Example

const id = await wallet.request({
method: "snap_scheduleBackgroundEvent",
params: {
date: "2026-12-31T23:59:59Z",
request: {
method: "mySnapMethod",
params: { foo: "bar" },
},
},
});