Skip to content

Scheduling

Cron jobs, message queues and outbound webhooks.

Overview

Base path: https://api.infrai.cc/v1/scheduling
Auth header: Authorization: Bearer $INFRAI_API_KEY
bash
# Call any /v1/scheduling capability over raw HTTP — no SDK to install.
# curl:
curl https://api.infrai.cc/v1/scheduling/... \
  -H "Authorization: Bearer $INFRAI_API_KEY" \
  -H "Content-Type: application/json"

Methods

scheduling.cron.create

POST /v1/scheduling/cron/create

Create a scheduled cron job that POSTs to a URL on a schedule.

Parameters

NameTypeRequiredDescription
namestring
Required
Human-readable job name.
schedulestring
Required
Cron expression, e.g. 0 9 * * *.
urlstring
Required
URL that receives the scheduled POST.
payloadunknownOptionalOptional JSON payload sent with each run.
timezonestringOptionalIANA timezone for the schedule.
retriesnumberOptionalRetry attempts on failure.
idempotency_keystringOptionalOptional dedup key; identical retries return the same result.

Returns

CronRecord { cron_id, name, schedule, url, enabled, next_run_at? }

Example

一次性前置(每个范例都假定已完成):

bash
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."
bash
curl -X POST https://api.infrai.cc/v1/scheduling/cron/create \
  -H "Authorization: Bearer $INFRAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"cron_expr": "0 9 * * 1", "task_type": "http_url", "task_url": "https://api.acme.com/weekly"}'

scheduling.cron.list

GET /v1/scheduling/cron/list

List cron jobs.

Returns

{ items: CronRecord[] }

Example

一次性前置(每个范例都假定已完成):

bash
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."
bash
curl -X GET https://api.infrai.cc/v1/scheduling/cron/list \
  -H "Authorization: Bearer $INFRAI_API_KEY"

scheduling.queue.publish

POST /v1/scheduling/queue/publish

Publish a message to a queue, optionally delayed.

Parameters

NameTypeRequiredDescription
queuestring
Required
The queue name.
payloadobject
Required
Message payload.
delay_secondsnumberOptionalDelay before delivery in seconds.
idempotency_keystringOptionalOptional dedup key; identical retries return the same result.

Returns

{ message_id }

Example

一次性前置(每个范例都假定已完成):

bash
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."
bash
curl -X POST https://api.infrai.cc/v1/scheduling/queue/publish \
  -H "Authorization: Bearer $INFRAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"queue": "orders", "payload": {"order_id": "o_123"}, "priority": 5}'

scheduling.cron.get

GET /v1/scheduling/cron/get/{id}

获取单个定时任务的配置与下次运行时间

Parameters

NameTypeRequiredDescription
cron_idstring
Required
定时任务 ID

Returns

CronRecord { cron_id, name, cron_expr, task, timezone, enabled, next_run_at? }

Example

一次性前置(每个范例都假定已完成):

bash
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."
bash
curl -X GET https://api.infrai.cc/v1/scheduling/cron/get/ID \
  -H "Authorization: Bearer $INFRAI_API_KEY"

scheduling.cron.update

PATCH /v1/scheduling/cron/update/{id}

更新定时任务的表达式、目标与策略

Parameters

NameTypeRequiredDescription
cron_idstring
Required
定时任务 ID
cron_exprstringOptional标准 5/6 段 cron 表达式
taskstringOptional触发时投递的目标 URL
namestringOptional任务名称
timezonestringOptionalIANA 时区名(如 Asia/Shanghai)
retrynumberOptional失败重试次数(0-10)
timeout_secondsnumberOptional单次触发超时秒数(1-900)
overlap_policy"allow" | "skip" | "queue"Optional重叠策略:allow 允许 / skip 跳过 / queue 排队
max_runsnumberOptional最大运行次数,达到后自动停止
payloadobjectOptional随触发发送的 JSON 负载
headersobjectOptional随触发发送的自定义请求头
on_failure_webhookstringOptional失败时回调的 Webhook 地址
idempotency_keystringOptional幂等键,避免重复执行

Returns

CronRecord { cron_id, name, cron_expr, task, timezone, enabled, next_run_at? }

Example

一次性前置(每个范例都假定已完成):

bash
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."
bash
curl -X PATCH https://api.infrai.cc/v1/scheduling/cron/update/ID \
  -H "Authorization: Bearer $INFRAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{}'

scheduling.cron.delete

DELETE /v1/scheduling/cron/delete/{id}

删除一个定时任务

Parameters

NameTypeRequiredDescription
cron_idstring
Required
定时任务 ID
idempotency_keystringOptional幂等键,避免重复执行

Returns

{ cron_id, deleted }

Example

一次性前置(每个范例都假定已完成):

bash
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."
bash
curl -X DELETE https://api.infrai.cc/v1/scheduling/cron/delete/ID \
  -H "Authorization: Bearer $INFRAI_API_KEY"

scheduling.cron.pause

POST /v1/scheduling/cron/pause/{id}

暂停定时任务

Parameters

NameTypeRequiredDescription
cron_idstring
Required
定时任务 ID
idempotency_keystringOptional幂等键,避免重复执行

Returns

CronRecord { cron_id, enabled }

Example

一次性前置(每个范例都假定已完成):

bash
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."
bash
curl -X POST https://api.infrai.cc/v1/scheduling/cron/pause/ID \
  -H "Authorization: Bearer $INFRAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"cron_id": "..."}'

scheduling.cron.resume

POST /v1/scheduling/cron/resume/{id}

恢复已暂停的定时任务

Parameters

NameTypeRequiredDescription
cron_idstring
Required
定时任务 ID
idempotency_keystringOptional幂等键,避免重复执行

Returns

CronRecord { cron_id, enabled, next_run_at? }

Example

一次性前置(每个范例都假定已完成):

bash
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."
bash
curl -X POST https://api.infrai.cc/v1/scheduling/cron/resume/ID \
  -H "Authorization: Bearer $INFRAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"cron_id": "..."}'

scheduling.cron.trigger

POST /v1/scheduling/cron/trigger/{id}

立即手动触发一次定时任务运行

Parameters

NameTypeRequiredDescription
cron_idstring
Required
定时任务 ID
idempotency_keystringOptional幂等键,避免重复执行

Returns

CronRun { run_id, cron_id, state, started_at }

Example

一次性前置(每个范例都假定已完成):

bash
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."
bash
curl -X POST https://api.infrai.cc/v1/scheduling/cron/trigger/ID \
  -H "Authorization: Bearer $INFRAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"job_id": "cron_01HX..."}'

scheduling.cron.runs.get

GET /v1/scheduling/cron/runs/get/{id}/{run_id}

获取定时任务某次运行的详情

Parameters

NameTypeRequiredDescription
cron_idstring
Required
定时任务 ID
run_idstring
Required
运行(CronRun)ID

Returns

CronRun { run_id, cron_id, state, started_at, finished_at?, response_status?, error? }

Example

一次性前置(每个范例都假定已完成):

bash
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."
bash
curl -X GET https://api.infrai.cc/v1/scheduling/cron/runs/get/ID/RUN_ID \
  -H "Authorization: Bearer $INFRAI_API_KEY"

scheduling.cron.retention.get

GET /v1/scheduling/cron/retention/get/{id}

查询定时任务运行历史保留天数

Parameters

NameTypeRequiredDescription
cron_idstring
Required
定时任务 ID

Returns

{ cron_id, retention_days }

Example

一次性前置(每个范例都假定已完成):

bash
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."
bash
curl -X GET https://api.infrai.cc/v1/scheduling/cron/retention/get/ID \
  -H "Authorization: Bearer $INFRAI_API_KEY"

scheduling.cron.retention.set

PUT /v1/scheduling/cron/retention/set/{id}

设置定时任务运行历史保留天数

Parameters

NameTypeRequiredDescription
cron_idstring
Required
定时任务 ID
retention_daysnumber
Required
保留的运行历史天数
idempotency_keystringOptional幂等键,避免重复执行

Returns

{ cron_id, retention_days }

Example

一次性前置(每个范例都假定已完成):

bash
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."
bash
curl -X PUT https://api.infrai.cc/v1/scheduling/cron/retention/set/ID \
  -H "Authorization: Bearer $INFRAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"retention_days": 0}'

scheduling.task.schedule

POST /v1/scheduling/task/schedule

调度一次性的定时触发任务

Parameters

NameTypeRequiredDescription
taskstring
Required
触发一次的目标 URL
run_atstring
Required
绝对触发时刻(UTC 时间)
namestringOptional任务名称
payloadobjectOptional随触发发送的 JSON 负载
headersobjectOptional随触发发送的自定义请求头
retrynumberOptional失败重试次数
timeout_secondsnumberOptional单次触发超时秒数
secretstringOptional对触发请求做 HMAC 签名的密钥
idempotency_keystringOptional幂等键,避免重复执行

Returns

TaskRecord { task_id, task, run_at, state }

Example

一次性前置(每个范例都假定已完成):

bash
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."
bash
curl -X POST https://api.infrai.cc/v1/scheduling/task/schedule \
  -H "Authorization: Bearer $INFRAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"task": "...", "run_at": "..."}'

scheduling.run.list

GET /v1/scheduling/run/list

分页列出调度运行记录

Parameters

NameTypeRequiredDescription
cursorstringOptional分页游标,来自上一页 next_cursor
limitnumberOptional每页返回数量

Returns

{ items: Run[], next_cursor? }

Example

一次性前置(每个范例都假定已完成):

bash
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."
bash
curl -X GET https://api.infrai.cc/v1/scheduling/run/list \
  -H "Authorization: Bearer $INFRAI_API_KEY"

scheduling.queue.create

POST /v1/scheduling/queue/create

创建一个消息队列

Parameters

NameTypeRequiredDescription
namestring
Required
队列名称
type"standard" | "fifo"Optional队列类型:standard 标准 / fifo 先进先出
dead_letter_queuestringOptional接收失败消息的死信队列名(须已存在)
max_retriesnumberOptional转入 DLQ 前允许的 nack 次数
message_retention_daysnumberOptional消息保留天数
visibility_timeout_defaultnumberOptional默认可见性超时(租约)秒数
enable_prioritybooleanOptional是否启用优先级
idempotency_keystringOptional幂等键,避免重复创建

Returns

QueueRecord { queue, type, dead_letter_queue?, max_retries, visibility_timeout_default }

Example

一次性前置(每个范例都假定已完成):

bash
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."
bash
curl -X POST https://api.infrai.cc/v1/scheduling/queue/create \
  -H "Authorization: Bearer $INFRAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name": "..."}'

scheduling.queue.get

GET /v1/scheduling/queue/get/{queue}

获取队列配置详情

Parameters

NameTypeRequiredDescription
queuestring
Required
队列名称

Returns

QueueRecord { queue, type, dead_letter_queue?, max_retries, visibility_timeout_default }

Example

一次性前置(每个范例都假定已完成):

bash
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."
bash
curl -X GET https://api.infrai.cc/v1/scheduling/queue/get/QUEUE \
  -H "Authorization: Bearer $INFRAI_API_KEY"

scheduling.queue.list

GET /v1/scheduling/queue/list

分页列出所有队列

Parameters

NameTypeRequiredDescription
cursorstringOptional分页游标,来自上一页 next_cursor
limitnumberOptional每页返回数量

Returns

{ items: QueueRecord[], next_cursor? }

Example

一次性前置(每个范例都假定已完成):

bash
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."
bash
curl -X GET https://api.infrai.cc/v1/scheduling/queue/list \
  -H "Authorization: Bearer $INFRAI_API_KEY"

scheduling.queue.update

PATCH /v1/scheduling/queue/update/{queue}

更新队列配置

Parameters

NameTypeRequiredDescription
queuestring
Required
队列名称
dead_letter_queuestringOptional死信队列名
max_retriesnumberOptional转入 DLQ 前允许的 nack 次数
message_retention_daysnumberOptional消息保留天数
visibility_timeout_defaultnumberOptional默认可见性超时秒数
enable_prioritybooleanOptional是否启用优先级
idempotency_keystringOptional幂等键,避免重复执行

Returns

QueueRecord { queue, max_retries, visibility_timeout_default }

Example

一次性前置(每个范例都假定已完成):

bash
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."
bash
curl -X PATCH https://api.infrai.cc/v1/scheduling/queue/update/QUEUE \
  -H "Authorization: Bearer $INFRAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{}'

scheduling.queue.delete

DELETE /v1/scheduling/queue/delete/{queue}

删除一个队列

Parameters

NameTypeRequiredDescription
queuestring
Required
队列名称
idempotency_keystringOptional幂等键,避免重复执行

Returns

{ queue, deleted }

Example

一次性前置(每个范例都假定已完成):

bash
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."
bash
curl -X DELETE https://api.infrai.cc/v1/scheduling/queue/delete/QUEUE \
  -H "Authorization: Bearer $INFRAI_API_KEY"

scheduling.queue.purge

POST /v1/scheduling/queue/purge/{queue}

清空队列中所有消息

Parameters

NameTypeRequiredDescription
queuestring
Required
队列名称
idempotency_keystringOptional幂等键,避免重复执行

Returns

{ queue, purged }

Example

一次性前置(每个范例都假定已完成):

bash
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."
bash
curl -X POST https://api.infrai.cc/v1/scheduling/queue/purge/QUEUE \
  -H "Authorization: Bearer $INFRAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"queue": "..."}'

scheduling.queue.stats

GET /v1/scheduling/queue/stats/{queue}

获取队列统计指标

Parameters

NameTypeRequiredDescription
queuestring
Required
队列名称

Returns

QueueStats { queue, available, in_flight, dlq, oldest_age_seconds? }

Example

一次性前置(每个范例都假定已完成):

bash
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."
bash
curl -X GET https://api.infrai.cc/v1/scheduling/queue/stats/QUEUE \
  -H "Authorization: Bearer $INFRAI_API_KEY"

scheduling.queue.publish_batch

POST /v1/scheduling/queue/publish_batch

批量发布多条消息到队列

Parameters

NameTypeRequiredDescription
queuestring
Required
队列名称
messagesQueueMessage[]
Required
待发布的消息数组
idempotency_keystringOptional幂等键,避免重复发布

Returns

{ message_ids }

Example

一次性前置(每个范例都假定已完成):

bash
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."
bash
curl -X POST https://api.infrai.cc/v1/scheduling/queue/publish_batch \
  -H "Authorization: Bearer $INFRAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"queue": "...", "messages": []}'

scheduling.queue.consume

POST /v1/scheduling/queue/consume

从队列拉取一批消息消费

Parameters

NameTypeRequiredDescription
queuestring
Required
队列名称
max_messagesnumberOptional单次最多拉取的消息数
visibility_timeoutnumberOptional本批消息的租约秒数;默认取队列配置

Returns

{ messages: QueueMessage[] }

Example

一次性前置(每个范例都假定已完成):

bash
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."
bash
curl -X POST https://api.infrai.cc/v1/scheduling/queue/consume \
  -H "Authorization: Bearer $INFRAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"queue": "..."}'

scheduling.queue.ack

POST /v1/scheduling/queue/ack

确认一条已消费的消息

Parameters

NameTypeRequiredDescription
queuestring
Required
队列名称
message_idstring
Required
消息 ID
idempotency_keystringOptional幂等键,避免重复执行

Returns

{ message_id, acked }

Example

一次性前置(每个范例都假定已完成):

bash
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."
bash
curl -X POST https://api.infrai.cc/v1/scheduling/queue/ack \
  -H "Authorization: Bearer $INFRAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"queue": "...", "message_id": "..."}'

scheduling.queue.nack

POST /v1/scheduling/queue/nack

否认一条消息,可重新入队或转入死信

Parameters

NameTypeRequiredDescription
queuestring
Required
队列名称
message_idstring
Required
消息 ID
requeuebooleanOptionaltrue 重新入队;false 直接转入死信
idempotency_keystringOptional幂等键,避免重复执行

Returns

{ message_id, nacked, requeued }

Example

一次性前置(每个范例都假定已完成):

bash
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."
bash
curl -X POST https://api.infrai.cc/v1/scheduling/queue/nack \
  -H "Authorization: Bearer $INFRAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"queue": "...", "message_id": "..."}'

scheduling.queue.dlq.list

GET /v1/scheduling/queue/dlq/list/{queue}

分页列出死信队列中的消息

Parameters

NameTypeRequiredDescription
queuestring
Required
队列名称
cursorstringOptional分页游标,来自上一页 next_cursor
limitnumberOptional每页返回数量

Returns

{ items: QueueMessage[], next_cursor? }

Example

一次性前置(每个范例都假定已完成):

bash
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."
bash
curl -X GET https://api.infrai.cc/v1/scheduling/queue/dlq/list/QUEUE \
  -H "Authorization: Bearer $INFRAI_API_KEY"

scheduling.queue.dlq.redrive

POST /v1/scheduling/queue/dlq/redrive/{queue}

将死信消息重投回原队列

Parameters

NameTypeRequiredDescription
queuestring
Required
队列名称
message_idstringOptional重投单条消息的 ID;省略则批量重投
sincestringOptional批量重投:该时刻及之后进入死信的全部消息
idempotency_keystringOptional幂等键,避免重复重投

Returns

{ queue, redriven }

Example

一次性前置(每个范例都假定已完成):

bash
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."
bash
curl -X POST https://api.infrai.cc/v1/scheduling/queue/dlq/redrive/QUEUE \
  -H "Authorization: Bearer $INFRAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"queue": "orders", "max_messages": 100}'

scheduling.queue.push_subscribe

POST /v1/scheduling/queue/push_subscribe/{queue}

为队列配置推送订阅

Parameters

NameTypeRequiredDescription
queuestring
Required
队列名称
urlstring
Required
https 推送目标地址(经 SSRF 校验)
secretstringOptional对推送请求做 HMAC 签名的密钥
max_retriesnumberOptional推送失败重试次数
visibility_timeoutnumberOptional可见性超时秒数
dead_letter_queuestringOptional死信队列名
idempotency_keystringOptional幂等键,避免重复订阅

Returns

PushSubscription { subscription_id, queue, url }

Example

一次性前置(每个范例都假定已完成):

bash
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."
bash
curl -X POST https://api.infrai.cc/v1/scheduling/queue/push_subscribe/QUEUE \
  -H "Authorization: Bearer $INFRAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"queue": "orders", "forward_to": "https://api.acme.com/order-handler"}'

All capabilities

Every routed capability in this module — the complete public REST contract. The methods above are the guided walkthrough; this index is the full reference.

CapabilityEndpointDescription
scheduling.cron.createPOST /v1/scheduling/cron/createCreate a scheduled cron job; idempotent write.
scheduling.cron.deleteDELETE /v1/scheduling/cron/delete/{id}Delete a cron job.
scheduling.cron.getGET /v1/scheduling/cron/get/{id}Get a single cron job's configuration and next run time.
scheduling.cron.listGET /v1/scheduling/cron/listList the account's cron jobs with pagination.
scheduling.cron.pausePOST /v1/scheduling/cron/pause/{id}Pause a cron job, halting subsequent triggers.
scheduling.cron.resumePOST /v1/scheduling/cron/resume/{id}Resume a paused cron job.
scheduling.cron.retention.getGET /v1/scheduling/cron/retention/get/{id}Get the retention days for cron job run history.
scheduling.cron.retention.setPUT /v1/scheduling/cron/retention/set/{id}Set the retention days for cron job run history.
scheduling.cron.runs.getGET /v1/scheduling/cron/runs/get/{id}/{run_id}Retrieve details of a single cron job execution (CronRun).
scheduling.cron.triggerPOST /v1/scheduling/cron/trigger/{id}Manually trigger an immediate run of a scheduled cron job.
scheduling.cron.updatePATCH /v1/scheduling/cron/update/{id}Update a cron job's schedule expression, target, overlap policy, and other fields.
scheduling.queue.ackPOST /v1/scheduling/queue/ackAcknowledge (ack) a consumed message to remove it from the queue.
scheduling.queue.consumePOST /v1/scheduling/queue/consumePull a batch of messages from a queue for processing.
scheduling.queue.createPOST /v1/scheduling/queue/createCreate a message queue (standard or FIFO, with optional dead-letter queue).
scheduling.queue.deleteDELETE /v1/scheduling/queue/delete/{queue}Delete a message queue.
scheduling.queue.dlq.listGET /v1/scheduling/queue/dlq/list/{queue}List messages in a queue's dead-letter queue (DLQ) with pagination.
scheduling.queue.dlq.redrivePOST /v1/scheduling/queue/dlq/redrive/{queue}Redrive dead-letter messages back to the source queue, individually or in bulk.
scheduling.queue.getGET /v1/scheduling/queue/get/{queue}Retrieve a queue's configuration details.
scheduling.queue.listGET /v1/scheduling/queue/listList all message queues with pagination.
scheduling.queue.nackPOST /v1/scheduling/queue/nackNegatively acknowledge (nack) a message to requeue it or route it to the DLQ.
scheduling.queue.publishPOST /v1/scheduling/queue/publishPublish a single message to a queue (idempotent).
scheduling.queue.publish_batchPOST /v1/scheduling/queue/publish_batchPublish multiple messages to a queue in a single batch.
scheduling.queue.purgePOST /v1/scheduling/queue/purge/{queue}Purge all messages from a queue.
scheduling.queue.push_subscribePOST /v1/scheduling/queue/push_subscribe/{queue}Configure a push subscription to deliver queue messages to a callback URL.
scheduling.queue.statsGET /v1/scheduling/queue/stats/{queue}Retrieve queue metrics: available, in-flight, and dead-lettered message counts.
scheduling.queue.updatePATCH /v1/scheduling/queue/update/{queue}Update a queue's DLQ, retry, and retention settings.
scheduling.run.listGET /v1/scheduling/run/listList scheduled run records with pagination.
scheduling.task.schedulePOST /v1/scheduling/task/scheduleSchedule a one-time task to fire once at a specified time.

End-to-end example

A production-style walkthrough of this module: configure once, then run the flow. It exercises most of the module's APIs.

一次性前置(每个范例都假定已完成):

bash
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."
bash
# 1) Auth: every call is a raw HTTPS request to the Infrai gateway carrying
#    only your project key. No SDK, no install.
#    Get your key: sign in with Google/GitHub at the console for a project key
#    + $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
#    POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."   # from the console


# 2) scheduling.cron.create
curl -X POST https://api.infrai.cc/v1/scheduling/cron/create \
  -H "Authorization: Bearer $INFRAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"cron_expr": "0 9 * * 1", "task_type": "http_url", "task_url": "https://api.acme.com/weekly"}'

# 3) scheduling.cron.list
curl -X GET https://api.infrai.cc/v1/scheduling/cron/list \
  -H "Authorization: Bearer $INFRAI_API_KEY"

# 4) scheduling.queue.publish
curl -X POST https://api.infrai.cc/v1/scheduling/queue/publish \
  -H "Authorization: Bearer $INFRAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"queue": "orders", "payload": {"order_id": "o_123"}, "priority": 5}'

# 5) scheduling.cron.get
curl -X GET https://api.infrai.cc/v1/scheduling/cron/get/ID \
  -H "Authorization: Bearer $INFRAI_API_KEY"

# 6) scheduling.cron.update
curl -X PATCH https://api.infrai.cc/v1/scheduling/cron/update/ID \
  -H "Authorization: Bearer $INFRAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{}'

# 7) scheduling.cron.delete
curl -X DELETE https://api.infrai.cc/v1/scheduling/cron/delete/ID \
  -H "Authorization: Bearer $INFRAI_API_KEY"

# 8) scheduling.cron.pause
curl -X POST https://api.infrai.cc/v1/scheduling/cron/pause/ID \
  -H "Authorization: Bearer $INFRAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"cron_id": "..."}'

# 9) scheduling.cron.resume
curl -X POST https://api.infrai.cc/v1/scheduling/cron/resume/ID \
  -H "Authorization: Bearer $INFRAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"cron_id": "..."}'