> ## Documentation Index
> Fetch the complete documentation index at: https://docs.retailed.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Products

> Get products from our database

Retailed provides an extremely granular querying language through all APIs. Each API takes the same syntax and fully supports all options.

<Tip>If you have any questions or need help with the API, please reach out our support team on Slack, Discord or Email.</Tip>

### Header

<ParamField header="x-api-key" type="string" required={true}>
  Parameter defines the Retailed private key to use.
</ParamField>

### Operators

| Operator             | Description                                                                                           |
| -------------------- | ----------------------------------------------------------------------------------------------------- |
| equals               | The value must be exactly equal.                                                                      |
| not\_equals          | The query will return all documents where the value is not equal.                                     |
| greater\_than        | For numeric or date-based fields.                                                                     |
| greater\_than\_equal | For numeric or date-based fields.                                                                     |
| less\_than           | For numeric or date-based fields.                                                                     |
| less\_than\_equal    | For numeric or date-based fields.                                                                     |
| like                 | Case-insensitive string must be present. If string of words, all words must be present, in any order. |
| contains             | Must contain the value entered, case-insensitive.                                                     |
| in                   | The value must be found within the provided comma-delimited list of values.                           |
| not\_in              | The value must NOT be within the provided comma-delimited list of values.                             |
| all                  | The value must contain all values provided in the comma-delimited list.                               |
| exists               | Only return documents where the value either exists (true) or does not exist (false).                 |

### Query Parameters

<ParamField query="where[or][0][and][0][name][equals]" type="string" optional={true} placeholder="stockx-us">
  An example of a query parameter for the name field.
</ParamField>

<ParamField query="where[or][0][and][0][sku][equals]" type="string" optional={true} placeholder="CD4487-100">
  An example of a query parameter for the sku field.
</ParamField>

<ParamField query="page" type="number" optional={true} placeholder="1">
  The page number to return. Defaults to 1. You can paginate with the `totalPages` in the response.
</ParamField>

<Note>I want to get all products with a retail price of 85 or 90 and with a description.</Note>

```markdown Example Query theme={null}
GET https://app.retailed.io/api/v1/db/products?where[or][0][and][0][price][in]=85&where[or][1][and][0][price][in]=90&where[or][2][and][0][description][exists]=true&sort=-description
```

### Sort

Retailed find queries support a sort parameter through all APIs. Pass the name of a top-level field to sort by that field in ascending order.
Prefix the name of the field with a minus symbol ("-") to sort in descending order.
Because sorting is handled by the database, the field you wish to sort on must be stored in the database to work; not a virtual field.

`https://app.retailed.io/api/v1/db/products?sort=-createdAt`

### Response

<Info>1 request returns 10 products by default.</Info>

<ResponseField name="products" type="Products Object">
  <Expandable title="docs">
    <ResponseField name="id" type="string">
      The unique identifier for the product
    </ResponseField>

    <ResponseField name="productId" type="string">
      The unique identifier for the product from the source : `websitesource-countrycode-productid` (e.g `stockx-us-air-jordan-alpha-1-university-blue`).
    </ResponseField>

    <ResponseField name="name" type="string">
      The name of the source website : `stockx-us`, `zalando-fr`, etc.
    </ResponseField>

    <ResponseField name="country" type="string">
      The country of the source website : `us`, `fr`, etc.
    </ResponseField>

    <ResponseField name="currency" type="string">
      The currency of the source website : `usd`, `eur`, etc.
    </ResponseField>

    <ResponseField name="currencySymbol" type="string">
      The currency symbol of the source website : `$`, `€`, etc.
    </ResponseField>

    <ResponseField name="url" type="string">
      The url of the product on the source website
    </ResponseField>

    <ResponseField name="domain" type="string">
      The domain of the source website : `stockx.com`, `zalando.fr`, etc.
    </ResponseField>

    <ResponseField name="urlSlug" type="string">
      The url slug of the product on the source website
    </ResponseField>

    <ResponseField name="errorCrawling" type="boolean">
      Whether the product has an error while crawling
    </ResponseField>

    <ResponseField name="isNotFound" type="boolean">
      Whether the product is not found on the source website
    </ResponseField>

    <ResponseField name="createdAt" type="string">
      The date of creation of the product in our system
    </ResponseField>

    <ResponseField name="updatedAt" type="string">
      The date of last update of the product in our system
    </ResponseField>

    <ResponseField name="description" type="string">
      The description of the product
    </ResponseField>

    <ResponseField name="images" type="array">
      The images of the product with the thumbnail and the original size
    </ResponseField>

    <ResponseField name="lastCrawledAt" type="string">
      The date of last crawl of the product
    </ResponseField>

    <ResponseField name="price" type="number">
      The retail price of the product
    </ResponseField>

    <ResponseField name="urlId" type="string">
      The unique identifier for the product url
    </ResponseField>

    <ResponseField name="variants" type="array">
      Related variants of the product
    </ResponseField>

    <ResponseField name="sizes" type="array">
      The sizes of the product
    </ResponseField>

    <ResponseField name="sku" type="string">
      The sku of the product
    </ResponseField>

    <ResponseField name="title" type="string">
      The title of the product
    </ResponseField>
  </Expandable>
</ResponseField>

<RequestExample>
  ```bash Request slug theme={null}
  curl --location --request GET 'https://app.retailed.io/api/v1/db/products?where[or][0][and][0][productId][equals]=stockx-us-air-jordan-alpha-1-university-blue' \
  --header 'Content-Type: application/json' \
  --header 'x-api-key: <token>' \
  ```

  ```bash Request sku theme={null}
  curl --location --request GET 'https://app.retailed.io/api/v1/db/products?where[or][0][and][0][sku][equals]=392813-103' \
  --header 'Content-Type: application/json' \
  --header 'x-api-key: <token>' \
  ```

  ```bash Request upc or ean (relation) theme={null}
  curl --location --request GET 'https://app.retailed.io/api/v1/db/products?where[or][0][and][0][variants.id][equals]=884500475069' \
  --header 'Content-Type: application/json' \
  --header 'x-api-key: <token>' \
  ```
</RequestExample>

<ResponseExample>
  ```json Example Response theme={null}
  {
      "docs": [
          {
              "id": "65495f475493f73e4ea472ea",
              "productId": "stockx-us-air-jordan-alpha-1-university-blue",
              "name": "stockx-us",
              "country": "us",
              "currency": "usd",
              "currencySymbol": "$",
              "url": "https://stockx.com/air-jordan-alpha-1-university-blue",
              "domain": "stockx.com",
              "urlSlug": "air-jordan-alpha-1-university-blue",
              "errorCrawling": false,
              "isNotFound": false,
              "createdAt": "2023-11-06T21:48:55.897Z",
              "updatedAt": "2024-01-18T09:40:13.428Z",
              "lastCrawledAt": "2024-01-18T09:40:11.403Z",
              "price": 125,
              "urlId": "69b1ca16-a37f-4643-99b4-55d037e56ec9",
              "variants": [
                  {
                      "id": "884500475069",
                      "products": [
                          "65495f475493f73e4ea472ea"
                      ],
                      "barcodeFormats": "UPC-A 884500475069",
                      "model": "Jordan Alpha 1",
                      "sku": "392813-103",
                      "title": "Jordan Alpha 1 University Blue",
                      "category": "sneakers",
                      "brand": "Jordan",
                      "color": "White/Black-University Blue",
                      "size": "9",
                      "releaseDate": "2010-03-13T00:00:00.000Z",
                      "lastCrawledAt": "2024-01-18T09:40:11.555Z",
                      "errorCrawling": false,
                      "createdAt": "2023-11-17T00:46:04.652Z",
                      "updatedAt": "2024-01-18T09:40:11.660Z",
                      "description": null,
                      "reviews": []
                  },
                  {
                      "id": "884500475106",
                      "products": [
                          "65495f475493f73e4ea472ea"
                      ],
                      "barcodeFormats": "UPC-A 884500475106",
                      "model": "Jordan Alpha 1",
                      "sku": "392813-103",
                      "title": "Jordan Alpha 1 University Blue",
                      "category": "sneakers",
                      "brand": "Jordan",
                      "color": "White/Black-University Blue",
                      "size": "11",
                      "releaseDate": "2010-03-13T00:00:00.000Z",
                      "lastCrawledAt": "2024-01-18T09:40:12.077Z",
                      "errorCrawling": false,
                      "createdAt": "2023-11-17T00:46:04.986Z",
                      "updatedAt": "2024-01-18T09:40:12.168Z",
                      "description": null,
                      "reviews": []
                  }
              ],
              "description": null,
              "images": [
                  {
                      "id": "65a8f1fd47cea783f4fd15cb",
                      "productIdAlpha": "stockx-us-air-jordan-alpha-1-university-blue",
                      "prefix": "media",
                      "filename": "65495f475493f73e4ea472ea.jpg",
                      "mimeType": "image/jpeg",
                      "filesize": 93448,
                      "width": 1400,
                      "height": 1000,
                      "sizes": {
                          "thumbnail": {
                              "width": 480,
                              "height": 320,
                              "mimeType": "image/webp",
                              "filesize": 14840,
                              "filename": "65495f475493f73e4ea472ea-480x320.webp",
                              "url": "https://cdn.retailed.app/media/65495f475493f73e4ea472ea-480x320.webp"
                          }
                      },
                      "createdAt": "2024-01-18T09:40:13.281Z",
                      "updatedAt": "2024-01-18T09:40:13.281Z",
                      "url": "https://cdn.retailed.app/media/65495f475493f73e4ea472ea.jpg"
                  }
              ],
              "sizes": [
                  "7",
                  "7.5",
                  "8",
                  "8.5",
                  "9",
                  "9.5",
                  "10",
                  "10.5",
                  "11",
                  "11.5",
                  "12",
                  "12.5",
                  "13",
                  "14",
                  "15",
                  "16",
                  "17",
                  "18"
              ],
              "sku": "392813-103",
              "title": "Jordan Alpha 1 University Blue"
          }
      ],
      "totalDocs": 1,
      "limit": 10,
      "totalPages": 1,
      "page": 1,
      "pagingCounter": 1,
      "hasPrevPage": false,
      "hasNextPage": false,
      "prevPage": null,
      "nextPage": null
  }
  ```
</ResponseExample>
