> 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/workers/reference.md).

# Reference

```typescript
interface WorkerMetadata {
  queue: string;
  endpoint: EndpointOptions;
  opts?: WorkerOptions;
}
```

```typescript
interface EndpointOptions {
    url: string;
    method: "post" | "get" | "put" | "delete" | "patch";
    headers?: Record<string, string>;
    timeout?: number; // max allowed duration in milliseconds
}
```

```typescript
interface WorkerOptions {
  concurrency?: number;
  limiter?: {
    max: number; // integer representing max number of jobs to process on "duration"
    duration: number: // number of millisecons
  };
  removeOnComplete?: {
    count?: number;
    age?: number;
  };
  removeOnFail?: {
    count?: number;
    age?: number;
  };
  maxStalledCount?: number;
}
```

## Workers API

## Add / Update a worker

<mark style="color:green;">`POST`</mark> `/workers`

Adds a new worker or updates an existing one.

**Headers**

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

**Body**

| Name       | Type          | Description            |
| ---------- | ------------- | ---------------------- |
| `queue`    | string        | Name of the queue      |
| `endpoint` | Endpoint      | Endpoint options       |
| `opts`     | WorkerOptions | Options for the worker |

**Response**

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

```
"OK"
```

{% endtab %}

{% tab title="400" %}

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

{% endtab %}
{% endtabs %}

## Remove worker

<mark style="color:green;">`DELETE`</mark> `/workers/:queue-name`

Removes an existing worker for a given queue.

**Headers**

| Name          | Value            |
| ------------- | ---------------- |
| Authorization | `Bearer <token>` |

**Response**

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

```json
"OK"
```

{% endtab %}

{% tab title="404" %}

```
"Worker not found"
```

{% endtab %}
{% endtabs %}

## Get workers

<mark style="color:green;">`GET`</mark> `/workers`

Gets all the workers registered in the proxy.

**Headers**

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

**Response**

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

```json
{
  "queue-name": "url"
}
```

{% 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/workers/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.
