> For the complete documentation index, see [llms.txt](https://docs.bullmq.net/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.bullmq.net/http-api/queues/reference.md).

# Reference

```typescript
interface Job {
  name: string;
  data: any;
  opts?: JobOpts;
}
```

```typescript
interface JobOpts {
  attempts?: number;
  backoff?: {
    type: "exponential" | "linear",
    delay: number // Time in milliseconds
  };
  delay?: number; // Milliseconds
  priority?: number; // Value between 1 and 2_097_152
  lifo?: boolean;
  jobId?: string;
}
```

```typescript
interface JobJson {
    id: string;
    data: any;
    opts: JobOpts;
    progress?: number | object;
    returnvalue?: string;
    failedReason?: string;
    stacktrace?: string[];
    attemptsMade: number;
    delay: number;
    timestamp: number;
    processedOn?: number;
    finishedOn?: number;
    queueQualifiedName: string;
}
```

## Add jobs

<mark style="color:green;">`POST`</mark> `/queues/:queue-name/jobs`

Adds one or more jobs to a given queue.

**Headers**

| Name          | Value              |
| ------------- | ------------------ |
| Content-Type  | `application/json` |
| Authorization | `Bearer <token>`   |

**Body**

**The body must include an array of jobs with the following structure:**

| Name   | Type    | Description                                  |
| ------ | ------- | -------------------------------------------- |
| `name` | string  | Name of the job                              |
| data   | any     | Arbitrary data to pass to the job processor. |
| opts   | JobOpts | Job options                                  |

**Response**

{% tabs %}
{% tab title="200" %}

```json
[{
  "id": string,
  "name": string,
  "data": {},
  "opts": JobOpts,
  ...
}]
```

{% endtab %}

{% tab title="400" %}

```json
Error message depending on the cause of the error.
```

{% endtab %}
{% endtabs %}

## Get Jobs

<mark style="color:green;">`GET`</mark> `/queues/:queue-name/jobs`

Get jobs in a queue in pages and filtered according to their statuses.

**Query Params**

| Name     | Default | Description                                                                                           |
| -------- | ------- | ----------------------------------------------------------------------------------------------------- |
| statuses | `all`   | comma separated lists of valid statuses ("waiting", "delayed", "prioritized", "completed" or "failed" |
| start    | `0`     | offset on where the returned page should start                                                        |
| length   | 10      | Maximum number of  job to return in the page                                                          |

**Headers**

| Name          | Value              |
| ------------- | ------------------ |
| Content-Type  | `application/json` |
| Authorization | `Bearer <token>`   |

**Response**

{% tabs %}
{% tab title="200" %}

```json
{
  "counts"; { [status: string]: number },
  "jobs": JobJson[],
  "start": number,
  "length": number
}
```

{% endtab %}

{% tab title="400" %}

```json
Error message depending on the cause of the error.
```

{% endtab %}
{% endtabs %}

## Get Job

<mark style="color:green;">`GET`</mark> `/queues/:queue-name/jobs/job-id`

\<Description of the endpoint>

**Headers**

| Name          | Value              |
| ------------- | ------------------ |
| Content-Type  | `application/json` |
| Authorization | `Bearer <token>`   |

**Response**

{% tabs %}
{% tab title="200" %}

```json
JobJson
```

{% endtab %}

{% tab title="400" %}

```json
{
  "error": "Invalid request"
}
```

{% endtab %}
{% endtabs %}


---

# 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, and the optional `goal` query parameter:

```
GET https://docs.bullmq.net/http-api/queues/reference.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
