Skip to content
Hayonix

API reference · Serverless

Cancel every queued job of the endpoint (running jobs continue)

POST/v1/serverless/endpoints/{endpoint_id}/purge-queue
API keyserverless_job:deleteProject
TypeScript
client.serverless.purgeQueue()
Python
client.serverless.purge_queue()
CLI
hayonix serverless purge-queue

Every job still queued ends as canceled with code purged; jobs with a webhook URL get their completion webhook. Safe to repeat: purging an empty queue cancels 0.

Project API key (Authorization: Bearer sk_…), or a console session. Requires the serverless_job:delete permission (a key's scope, or a role that includes it).

Examples

The samples read API_KEY and API_BASE_URL from the environment (see Setup). Values are examples.

curl -sS -X POST "$API_BASE_URL/serverless/endpoints/sep_01jc5zq4m8k3v6x9t2w7r0b1e4/purge-queue" \
  -H "Authorization: Bearer $API_KEY"

Request

Headers
HeaderRequiredDescription
AuthorizationyesBearer and your API key. The key implies its project.
X-Project-Idsession onlyThe project to act in, for console sessions. Requests with an API key leave it out.

Path parameters

  • endpoint_idstringrequired

    ID of the endpoint

    ID with prefix sep_

Response

200 ServerlessQueuePurge — How many jobs were removed

  • objectstringrequired

    Always `serverless_queue_purge`: the type of this object

    One ofserverless_queue_purge

  • endpoint_idstringrequired

    ID of the endpoint

  • canceledintegerrequired

    Queued jobs canceled by this purge (0 when the queue was empty)

Example response
Example response
{
  "object": "serverless_queue_purge",
  "endpoint_id": "string",
  "canceled": 1
}

Errors

Errors use the standard envelope. What this operation can answer:

Errors
StatusTypeWhen
400invalid_request_errorA parameter or body field is missing or not allowed; param names it.
401authentication_errorThe key or session is missing, revoked or expired.
403permission_errorThe credential lacks the permission this needs, or the organization is suspended.
404not_found_errorNo such resource in this project (an ID from another project is answered the same way).
409conflict_errorThe resource's current state does not allow this.
429rate_limit_error rate_limitedToo many requests; retry after retry-after seconds.