> For the complete documentation index, see [llms.txt](https://docs.laminar.run/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.laminar.run/advanced/batching-http-requests.md).

# Batching HTTP Requests

When you need to make multiple HTTP requests concurrently within a single step, `lam.httpRequests` is your go-to. This is more efficient than creating multiple sequential `lam.httpRequest` steps if the requests don't depend on each other's immediate output.

The value associated with `lam.httpRequests` is an array of objects, where each object has the same structure as a single `lam.httpRequest` definition.

The output of a `lam.httpRequests` step will be an array of response objects, corresponding to the order of requests defined.

**Example:** Suppose we want to handle incoming orders and we want to send them to different fulfillment centres.

{% stepper %}
{% step %}

### Send Orders to Warehouse

```javascript
(data) => {
  const { input } = data;
  
  return {
    "lam.httpRequests": [
      {
        "method": "POST",
        "url": "{{config.baseUrl}}/send-to-warehouse/premium",
        "body": input.premiumOrder
      },
      {
        "method": "POST",
        "url": "{{config.baseUrl}}/send-to-warehouse/regular",
        "pathParams": {
          "itemId": input.regularOrder
        }
      }
    ]
  };
}
```

{% endstep %}

{% step %}

### Update Status Orders

```javascript
(data) => {
  const { input } = data;
  const { response } = data;
  
  return {
    "lam.httpRequests": [
      {
        "method": "PUT",
        "url": `{{config.baseUrl}}/order/${input.premiumOrder.id}`,
        "body": {
          "status": "Processing",
          "tracking_url": response[0].tracking_url,
          "shipment_reference_id": response[0].tracking_number,
        }
      },
      {
        "method": "PUT",
        "url": `{{config.baseUrl}}/order/${input.regularOrder.id}`,
        "body": {
          "status": "Processing",
          "tracking_url": response[1].tracking_url,
          "shipment_reference_id": response[1].tracking_number,
        }
      }
    ]
  };
}
```

{% endstep %}
{% endstepper %}
