---
title: "Get head and lock"
method: POST
path: "/v2/request-queues/{queueId}/head/lock"
tags: ["Storage/Request queues/Requests locks"]
---

# Get head and lock

`POST /v2/request-queues/{queueId}/head/lock`

Returns the given number of first requests from the queue and locks them for
the given time.

If this endpoint locks the request, no other client or run will be able to get and
lock these requests.

The response contains the `hadMultipleClients` boolean field which indicates
that the queue was accessed by more than one client (with unique or empty
`clientKey`).

## Path parameters

- `queueId` string, required

## Query parameters

- `lockSecs` number, double, required
- `limit` number, double
- `clientKey` string

## Response `201`

- HeadAndLockResponse — Response containing locked requests from the request queue head.
  - `data` LockedRequestQueueHead, required — A batch of locked requests from the request queue head.
    - `limit` integer, required — The maximum number of requests returned.
    - `queueModifiedAt` string, date-time, required — The timestamp when the request queue was last modified. Modifications include adding, updating, or removing requests, as well as locking or unlocking requests in the request queue.
    - `queueHasLockedRequests` boolean — Whether the request queue contains requests locked by any client (either the one calling the endpoint or a different one).
    - `clientKey` string — The client key used for locking the requests.
    - `hadMultipleClients` boolean, required — Whether the request queue has been accessed by multiple different clients.
    - `lockSecs` integer, required — The number of seconds the locks will be held.
    - `items` LockedHeadRequest[], required — The array of locked requests from the request queue head.
      - `id` string, required — A unique identifier assigned to the request.
      - `uniqueKey` string, required — A unique key used for request de-duplication. Requests with the same unique key are considered identical.
      - `url` string, required — The URL of the request.
      - `method` 'GET' | 'HEAD' | 'POST' | 'PUT' | 'DELETE' | 'CONNECT' | 'OPTIONS' | 'TRACE' | 'PATCH'
      - `retryCount` integer — The number of times this request has been retried.
      - `lockExpiresAt` string, date-time, required — The timestamp when the lock on this request expires.

## Other responses

- `400` — Bad request - invalid input parameters or request body.
- `401` — Unauthorized - authentication required or invalid token.
- `403` — Forbidden - insufficient permissions to perform this action.
- `404` — Not found - the requested resource does not exist.
- `405` — Method not allowed.
- `429` — Too many requests - rate limit exceeded.

---

[API](https://skmtc.net/apify/apis/apify-api.md) · [All operations](https://skmtc.net/apify/apis/apify-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/apify/apify-api/versions/01a71794279b/schema)
