# Scrap Prices

### Overview

The Scrap Prices API allows users to queue requests for scraping prices and retrieve the results of those requests. This API uses a two-step process: first queueing a request, then checking the status and retrieving results.

### Authentication

All requests to the API require authentication using a license key and UID.

```json
{
  "LicenseKey": "your-license-key",
  "UID": "your-uid"
}
```

### Endpoints

#### 1. Queue a Scrap Prices Request

**Endpoint:** `POST /api/scrap_prices/queue`

**Request Body:**

```json
{
  "Authorization": {
    "LicenseKey": "your-license-key",
    "UID": "your-uid"
  },
  "Data": {
    "Sku": "product-sku",
    "SellingSites": [
      {
        // Selling site details
      }
    ]
  }
}
```

**Response:**

```json
{
  "RequestId": "unique-request-id",
  "RequestStatus": 0  // 0 represents Pending status
}
```

**Description:** This endpoint queues a new request for scraping prices. The server generates a unique `RequestId` which can be used to check the status of the request later.

#### 2. Check Request Status

**Endpoint:** `GET /api/scrap_prices/{requestId}`

**Parameters:**

* `requestId`: The unique identifier returned when queueing the request

**Response:**

For a pending request:

```json
{
  "RequestId": "unique-request-id",
  "RequestStatus": 0  // 0 represents Pending status
}
```

For a completed request:

```json
{
  "RequestId": "unique-request-id",
  "RequestStatus": 2,  // 2 represents Completed status
  "Data": {
    // Scraped price data
  }
}
```

**Description:** This endpoint allows you to check the status of a previously queued request. If the request is completed, it will also return the scraped price data.

### Request Lifecycle

1. Requests are initially queued with a "Pending" status.
2. Requests timeout after 5 minutes if not processed, changing to "Failed" status.
3. Completed or failed requests are removed from the system after 5 minutes.

### Status Codes

* 0: Pending
* 1: Failed
* 2: Completed

### Error Handling

* If authentication fails, the API will return a 401 Unauthorized status.
* The API will return a 400 Bad Request status if the request payload is invalid.
* The API will return a 404 Not Found status if a request is not found.


---

# 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.restock.gg/api/endpoints/scrap-prices.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.
