> For the complete documentation index, see [llms.txt](https://docs.lingoql.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.lingoql.com/sub0/apis-abi/queueing.md).

# Queueing

Queueing lets you accept work now and execute it later.

Use it when the request should return quickly but the backend still has more work to do.

### Queue a single actionable

```json
{
  "id": 1,
  "mode": "QUERY",
  "queue": {
    "delay": 180,
    "priority": 0
  },
  "sql_query": {
    "query": "UPDATE users SET status = $1 WHERE id = $2",
    "parameters": ["status", "id"]
  }
}
```

This enqueues the work and lets the client move on.

### Queue a whole resource

```json
{
  "id": "queue-resource-01",
  "resource": "queue-job",
  "queue": {
    "delay": 180,
    "priority": 0
  },
  "actionables": [
    {
      "id": 1,
      "mode": "QUERY",
      "sql_query": {
        "query": "UPDATE users SET deleted_at = NULL WHERE id = $1",
        "parameters": ["$PROTECTED.id"]
      }
    }
  ]
}
```

### Queue options

| Property   | Purpose                    |
| ---------- | -------------------------- |
| `delay`    | Wait time before execution |
| `priority` | Higher values run first    |

### Retries

Retry failed work with:

```json
"retries": 2
```

### When to use queueing

Good fits:

* emails
* webhook follow-up work
* heavy updates
* background syncs

### Queue vs cron

* Use **queueing** for delayed or async work triggered by a request
* Use **cron jobs** for work that starts on a schedule

### Why it matters

Queueing is how you keep APIs fast without dropping production workflows.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.lingoql.com/sub0/apis-abi/queueing.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
