Skip to content

Start a service, or trigger a task (hook token)

POST
/api/hooks/tasks/{taskName}/start
curl --request POST \
--url 'http://localhost:9477/api/hooks/tasks/example/start?waitTimeout=120'

Same as POST /api/tasks/{taskName}/start, but authenticated with one of the unit’s hook_tokens from runwisp.toml instead of a session: Authorization: Bearer <token>, or (less safely) ?token=. manual_trigger does not apply. Enforced even with RUNWISP_AUTH=off. An unknown unit, a unit without tokens, and a wrong token all return the same 401; a valid token whose allow list omits this action gets 403. After 20 rejected tokens in a minute, the client IP gets 429 until the window slides.

For a service: un-parks it (if operator-stopped) and fills empty instance slots; already-running instances are left alone. For a task: triggers a run, unless one is already active or queued, in which case this is a no-op. With wait=true on a task: returns 200 and the started (or already active) run once it ends.

taskName
required

Task or service name

string
>= 1 characters <= 100 characters /^[a-zA-Z0-9._:-]+$/

Task or service name

token

The hook token, for callers that can only set a URL. Less safe than the header: URLs end up in proxy and CI logs. Ignored when an Authorization header is sent.

string

The hook token, for callers that can only set a URL. Less safe than the header: URLs end up in proxy and CI logs. Ignored when an Authorization header is sent.

wait

Hold the request until the action finishes. run, and start/restart on a task: until the run ends, then return it with exitCode and endReason. stop: until every run or instance has ended. Not supported for start/restart on a service. Best for short tasks; long waits may exceed reverse-proxy timeouts.

boolean

Hold the request until the action finishes. run, and start/restart on a task: until the run ends, then return it with exitCode and endReason. stop: until every run or instance has ended. Not supported for start/restart on a service. Best for short tasks; long waits may exceed reverse-proxy timeouts.

waitTimeout

With wait=true, the maximum seconds to hold the request open. Capped below the server’s 5-minute write timeout. On timeout, run/start/restart return the run in its current (non-terminal) state and stop returns 409; the action itself keeps going.

integer format: int64
default: 120 >= 1 <= 240

With wait=true, the maximum seconds to hold the request open. Capped below the server’s 5-minute write timeout. On timeout, run/start/restart return the run in its current (non-terminal) state and stop returns 409; the action itself keeps going.

No Content

Media typeapplication/json
object
$schema

A URL to the JSON Schema for this object.

string format: uri
createdAt
required
string format: date-time
endReason

Why a run ended. Set when status=ended.

string
Allowed values: succeeded failed stopped timeout crashed skipped log_overflow queue_full dst_skipped daemon_stopped missed start_failed unhealthy
endedAt
string format: date-time
executionId
string
exitCode
required
integer format: int64
id
required
string
instanceIndex
required
integer format: int64
isFailure
required
boolean
params
object
key
additional properties
string
retryAttempt
required
integer format: int64
retryOfRunId
string
startedAt
string format: date-time
status
required

Run lifecycle phase

string
Allowed values: pending running ended
taskName
required
string
triggeredBy
required

How the run was triggered

string
Allowed values: cron api ui cli station service startup hook
Example
{
"$schema": "http://localhost:9477/schemas/Run.json",
"endReason": "succeeded",
"status": "pending",
"triggeredBy": "cron"
}

Unauthorized

Media typeapplication/problem+json
object
$schema

A URL to the JSON Schema for this object.

string format: uri
detail

A human-readable explanation specific to this occurrence of the problem.

string
errors

Optional list of individual error details

Array<object> | null
object
location

Where the error occurred, e.g. ‘body.items[3].tags’ or ‘path.thing-id’

string
message

Error message text

string
value

The value at the given location

instance

A URI reference that identifies the specific occurrence of the problem.

string format: uri
status

HTTP status code

integer format: int64
title

A short, human-readable summary of the problem type. This value should not change between occurrences of the error.

string
type

A URI reference to human-readable documentation for the error.

string format: uri
default: about:blank
Example
{
"$schema": "http://localhost:9477/schemas/ErrorModel.json",
"detail": "Property foo is required but is missing.",
"instance": "https://example.com/error-log/abc123",
"status": 400,
"title": "Bad Request",
"type": "about:blank"
}

Forbidden

Media typeapplication/problem+json
object
$schema

A URL to the JSON Schema for this object.

string format: uri
detail

A human-readable explanation specific to this occurrence of the problem.

string
errors

Optional list of individual error details

Array<object> | null
object
location

Where the error occurred, e.g. ‘body.items[3].tags’ or ‘path.thing-id’

string
message

Error message text

string
value

The value at the given location

instance

A URI reference that identifies the specific occurrence of the problem.

string format: uri
status

HTTP status code

integer format: int64
title

A short, human-readable summary of the problem type. This value should not change between occurrences of the error.

string
type

A URI reference to human-readable documentation for the error.

string format: uri
default: about:blank
Example
{
"$schema": "http://localhost:9477/schemas/ErrorModel.json",
"detail": "Property foo is required but is missing.",
"instance": "https://example.com/error-log/abc123",
"status": 400,
"title": "Bad Request",
"type": "about:blank"
}

Unprocessable Entity

Media typeapplication/problem+json
object
$schema

A URL to the JSON Schema for this object.

string format: uri
detail

A human-readable explanation specific to this occurrence of the problem.

string
errors

Optional list of individual error details

Array<object> | null
object
location

Where the error occurred, e.g. ‘body.items[3].tags’ or ‘path.thing-id’

string
message

Error message text

string
value

The value at the given location

instance

A URI reference that identifies the specific occurrence of the problem.

string format: uri
status

HTTP status code

integer format: int64
title

A short, human-readable summary of the problem type. This value should not change between occurrences of the error.

string
type

A URI reference to human-readable documentation for the error.

string format: uri
default: about:blank
Example
{
"$schema": "http://localhost:9477/schemas/ErrorModel.json",
"detail": "Property foo is required but is missing.",
"instance": "https://example.com/error-log/abc123",
"status": 400,
"title": "Bad Request",
"type": "about:blank"
}

Too Many Requests

Media typeapplication/problem+json
object
$schema

A URL to the JSON Schema for this object.

string format: uri
detail

A human-readable explanation specific to this occurrence of the problem.

string
errors

Optional list of individual error details

Array<object> | null
object
location

Where the error occurred, e.g. ‘body.items[3].tags’ or ‘path.thing-id’

string
message

Error message text

string
value

The value at the given location

instance

A URI reference that identifies the specific occurrence of the problem.

string format: uri
status

HTTP status code

integer format: int64
title

A short, human-readable summary of the problem type. This value should not change between occurrences of the error.

string
type

A URI reference to human-readable documentation for the error.

string format: uri
default: about:blank
Example
{
"$schema": "http://localhost:9477/schemas/ErrorModel.json",
"detail": "Property foo is required but is missing.",
"instance": "https://example.com/error-log/abc123",
"status": 400,
"title": "Bad Request",
"type": "about:blank"
}

Internal Server Error

Media typeapplication/problem+json
object
$schema

A URL to the JSON Schema for this object.

string format: uri
detail

A human-readable explanation specific to this occurrence of the problem.

string
errors

Optional list of individual error details

Array<object> | null
object
location

Where the error occurred, e.g. ‘body.items[3].tags’ or ‘path.thing-id’

string
message

Error message text

string
value

The value at the given location

instance

A URI reference that identifies the specific occurrence of the problem.

string format: uri
status

HTTP status code

integer format: int64
title

A short, human-readable summary of the problem type. This value should not change between occurrences of the error.

string
type

A URI reference to human-readable documentation for the error.

string format: uri
default: about:blank
Example
{
"$schema": "http://localhost:9477/schemas/ErrorModel.json",
"detail": "Property foo is required but is missing.",
"instance": "https://example.com/error-log/abc123",
"status": 400,
"title": "Bad Request",
"type": "about:blank"
}