# 3. Check Allocation Request Status – Track Reservation Progress

After submitting an allocation request, you can monitor its status using the unique `requestId` provided in the previous step. This allows you to determine whether:

* The device has been successfully allocated, or
* Your request is still in the queue waiting for availability.

DevicePark now uses a device-specific queueing system, meaning that each physical device has its own queue. This ensures fair and consistent test execution, especially in environments with high concurrency.

### Purpose

This API lets you track whether your requested device has been allocated or not. If the device is busy, you'll also see your current queue position.

### Endpoint

Send a GET request to:

```
https://devicepark.testinium.io/allocation/api/device-allocations-requests/{requestId}
```

Replace `{requestId}` with the actual ID you received in the previous step.

### Required Headers

* **Authorization**: `Bearer <ACCESS_TOKEN>`
* **Content-Type**: `application/json`

### Example cURL Command

```bash
curl --location --request GET 'https://devicepark.testinium.io/allocation/api/device-allocations-requests/{requestId}' \
--header 'Authorization: Bearer <ACCESS_TOKEN>' \
--header 'Content-Type: application/json'
```

### Possible Responses

#### ✅ Case 1: Device Successfully Allocated

If a matching device is available, the response will return allocation details:

```json
{
  "allocationId": "f230263f-707b-4505-a841-4dd483e46388",
  "deviceSerial": "R5CT31AB4FV",
  "requestId": "9961dd90-c95b-4667-9597-a27d9244876d",
  "position": null,
  "expiresAt": "2025-10-13T09:44:38.922966Z"
}
```

Explanation of fields:

* **allocationId**: Unique ID representing the reserved device session
* **deviceSerial**: UDID / serial number of the allocated device
* **position**: Will be `null` because the device was allocated immediately
* **expiresAt**: Time limit before the allocation expires if no session is started

#### ⏳ Case 2: Request in Queue (Device is Busy)

If no devices are currently available, your request will be placed in the queue and the response will look like:

```json
{
  "allocationId": null,
  "deviceSerial": "R5CT31AB4FV",
  "requestId": "237ac11b-ec0b-4e1c-8189-082d296fc03a",
  "position": 1,
  "expiresAt": null
}
```

Explanation of fields:

* **allocationId**: Will be `null` since device is not yet allocated
* **position**: Your current position in the device's queue (e.g., `1` = next in line)
* **expiresAt**: Will also be `null` until a device is assigned

### Polling Strategy

To build a robust test execution system, it's recommended to:

1. Submit your allocation request (Step 2).
2. Use this endpoint to check status periodically (every few seconds).
3. Once you receive a valid `allocationId`, proceed to create a session.
