---
title: "Submit your first job"
description: "Register an HTTPS task and follow its status using a run ID."
---

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

# Submit your first job

```text
Register task -> Submit payload -> Receive run ID
                                      |
                                      +-> Read run, attempts and logs
```

In the Simplcron console, create an API key for the project and environment you want. Load the key from your server's secret store into `SIMPLCRON_API_KEY`. Set `SIMPLCRON_BASE_URL` to the origin that serves your console. When running locally, use the URL printed by the development server.

To try a sample job before connecting your application, use [Starter task use cases](https://simplcron.dev/docs/use-cases/).

## Register a task

Deploy an HTTPS handler you own and allowlist its host in the local release configuration. Replace the example URL with the real endpoint.

```bash
curl --fail-with-body "$SIMPLCRON_BASE_URL/v1/tasks" \
  -H "Authorization: Bearer $SIMPLCRON_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "name": "Generate invoice",
    "slug": "generate-invoice",
    "url": "https://your-app.example/jobs/invoice",
    "maxAttempts": 3
  }'
```

Store the one-time `secret` from the response in your application's secret store. See [handler signature verification](https://simplcron.dev/docs/webhooks/#verify-a-signature) before accepting tasks. The handler receives a POST body with `runId`, `task`, `attempt`, and `payload`.

## Submit a job

```bash
curl --fail-with-body "$SIMPLCRON_BASE_URL/v1/jobs" \
  -H "Authorization: Bearer $SIMPLCRON_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: invoice-inv_123" \
  --data '{"task":"generate-invoice","payload":{"invoiceId":"inv_123"}}'
```

A successful submission returns a `runId` and an initial run state. Reuse the same idempotency key and input when retrying the submission. A scheduled run uses an optional `runAt` with an RFC 3339 timestamp including its offset.

To try pausing a run before its handler attempt, use the [Wait Until starter](https://simplcron.dev/docs/use-cases/#try-wait-until). It records the pause and resume in the same run's activity and takes an explicit `waitUntil` timestamp.

Use [Wait for Reply](https://simplcron.dev/docs/use-cases/#wait-for-reply) to pause a run until an inbound webhook arrives or a timeout expires. Both outcomes continue under the same run ID.

Keep the API key on your application server. Use a different scoped key for each environment.

From a Node.js server, submit the same job with `fetch`.

```js
export async function queueInvoice(invoiceId) {
  const response = await fetch(new URL("/v1/jobs", process.env.SIMPLCRON_BASE_URL), {
    method: "POST",
    headers: {
      Authorization: "Bearer " + process.env.SIMPLCRON_API_KEY,
      "Content-Type": "application/json",
      "Idempotency-Key": "invoice-" + invoiceId,
    },
    body: JSON.stringify({ task: "generate-invoice", payload: { invoiceId } }),
  });
  if (!response.ok) throw new Error("Simplcron returned HTTP " + response.status);
  const { runId } = await response.json();
  return runId;
}
```

## Inspect the result

In **Runs**, paste the ID to open its timeline. Your application can read the same recorded events.

```bash
curl --fail-with-body "$SIMPLCRON_BASE_URL/v1/runs/$RUN_ID/logs" \
  -H "Authorization: Bearer $SIMPLCRON_API_KEY"
```

`GET /v1/runs/{runId}` includes the run payload, output when available, attempts, and recorded activity. The logs cover orchestration events Simplcron observes when calling the handler. Your application can use the run ID to correlate its own logs.

Source: https://simplcron.dev/docs/quickstart/index.mdx
