# Store API

The Stock Reminder plugin provides two Store API endpoints that can be used for headless projects or custom storefront implementations.

## Create Subscription

Creates a new notification subscription for a product.

**Endpoint:** `POST /store-api/prems/stock-reminder/subscribe`

**Login required:** No

**Parameters:**

| Parameter | Type   | Required | Description                                                                                                                                                                  |
| --------- | ------ | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| productId | string | Yes      | The UUID of the product.                                                                                                                                                     |
| email     | string | Yes      | The subscriber's email address. Must be a valid email address.                                                                                                               |
| quantity  | int    | No       | The desired order quantity. Default: 1. Ignored when the quantity field is hidden in the configuration — in that case, the product's minimum order quantity is used instead. |

**Response:** `204 No Content` on success.

**Errors:**

* `403 Forbidden` – The plugin is not active for the sales channel or the subscription limit of the free version has been reached.
* `400 Bad Request` – Invalid input data (missing product ID, invalid email).

## Confirm Subscription

Confirms a subscription via the double opt-in hash.

**Endpoint:** `POST /store-api/prems/stock-reminder/confirm/{hash}`

**Login required:** No

**Parameters:**

| Parameter | Type   | Required | Description                                                               |
| --------- | ------ | -------- | ------------------------------------------------------------------------- |
| hash      | string | Yes      | The unique confirmation hash from the confirmation email (URL parameter). |

**Response:** `204 No Content` on success.

**Errors:**

* `404 Not Found` – Invalid or already confirmed hash.


---

# 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.premsoft.de/en/plugins/back-in-stock-notification/store-api.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.
