# Run Later

> Run a custom block at a later time, like in 10 minutes or 3 days. Its inputs are saved when it's scheduled.

- ID: `run_later`
- Type: Block
- Category: [Logic](https://inventor.bot/docs/reference/blocks/logic.md)

> When is a duration from now (30s, 10m, 3d, 2w) or a Unix timestamp. Scheduling a key that's already scheduled replaces that run, or keeps it with "Keep Existing". The custom block runs on its own when it's due, without this flow's trigger, so pass in anything it needs (like a user or channel ID).

- Also takes the custom block's inputs as `Args` keys. See custom blocks.

**Inputs**

| Name | Required | Description | Value |
| --- | --- | --- | --- |
| `target_component_id` | yes | The custom block to run. |  |
| `schedule_when` | yes | A duration from now (30s, 10m, 3d) or a Unix timestamp. | e.g. `"1d"` |
| `schedule_key` |  | Names the run so it can be replaced, checked or cancelled later. Leave empty to generate one. | e.g. `"giveaway-123"` |
| `schedule_if_exists` |  | What to do when this key is already scheduled. | `"Replace"`, `"Keep Existing"` |

**Outputs**

| Name | Description | Value |
| --- | --- | --- |
| `key` | The run's key, generated when none was given. | e.g. `"giveaway-123"` |
| `run_at` | When the custom block will run. | e.g. `"1700003600"` |
| `scheduled` | False when the key was already scheduled and kept as it was. | e.g. `"true"` |

**Example**

```go
runLater := run_later(Args{target_component_id: "...", schedule_when: "1d"})
send_text_message(Args{channel_id: trigger.channel_id, message_content: "Key: " + runLater.key})
```