> For the complete documentation index, see [llms.txt](https://docs.globo.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.globo.io/pre-order/app-api/rest-api/back-in-stock/post-send-mail-restock.md).

# \[POST] Send mail restock

You can send mail restock for single or multiple submissions within the same request.

### \* Authentication&#x20;

<mark style="color:red;">Required</mark> `Authorization`

Limit  `throttle:30,1`

### Request

Endpoint <mark style="background-color:green;">\[POST]</mark> - `/shop-api/back-in-stock/send-notify-restock`&#x20;

**Payload body**

> When allow\_resend is true, submissions that have already been emailed for restock in the list ID will be resent.

| Params        | Type               | Required |
| ------------- | ------------------ | -------- |
| ids           | array              | `yes`    |
| allow\_resend | sometimes\|boolean | `option` |

{% tabs %}
{% tab title="HTTP" %}

```http
POST /shop-api/back-in-stock/send-notify-restock HTTP/1.1
Host: preorder.globo.io
Content-Type: application/json
Authorization: ************
Content-Length: 49
{
    "ids": [1,2,3],
    "allow_resend": false
}
```

{% endtab %}

{% tab title="Javascript" %}

```javascript
const myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Authorization", "************");
const raw = JSON.stringify({
  "ids": [1,2,3],
  "allow_resend": false
});
const requestOptions = {
  method: "POST",
  headers: myHeaders,
  body: raw,
  redirect: "follow"
};
fetch("https://preorder.globo.io/shop-api/back-in-stock/send-notify-restock", requestOptions)
  .then((response) => response.text())
  .then((result) => console.log(result))
  .catch((error) => console.error(error));
```

{% endtab %}

{% tab title="PHP" %}

```php
$curl = curl_init();
curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://preorder.globo.io/shop-api/back-in-stock/send-notify-restock',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_POSTFIELDS =>'{
    "ids": [1,2,3],
    "allow_resend": false
  }',
  CURLOPT_HTTPHEADER => array(
    'Content-Type: application/json',
    'Authorization: ************'
  ),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
```

{% endtab %}
{% endtabs %}

#### Success response `200`

```json
{
  "success": true,
  "message": "Restock notification sent successfully",
  "data": {
    "sent_count": 2, // total submission sent
    "sent_ids": [12345, 12346], // IDs submission sent
    "skipped_ids": [12347], // IDs submission skipped (submission sent + allow_resend=false, unsubscribe, no email, limit...)
    "allow_resend": false
  }
}
```

**Failed**

<pre class="language-json"><code class="lang-json"><strong>// Not found submission
</strong><strong>{ "success": false, "message": "Not found submissions to send", "data": { "sent_count": 0, "skipped_ids": [12345] } }
</strong>// reach to limit 
{ "success": false, "message": "Daily or monthly email limit reached" }
// id submission required
{ "success": false, "message": "The ids field is required." }
// catch
{ "success": false, "message": "Something went wrong" }
</code></pre>
