# 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: 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.bullmq.net/http-api/workers/reference.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.
