> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.getoutprice.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.getoutprice.com/_mcp/server.

# Create Rule

POST https://getoutprice.com/v1/alert-rules
Content-Type: application/json

Reference: https://docs.getoutprice.com/api-reference/alerts/create-rule

## Authentication

- `X-API-Key` header (required) — Your Outprice API key (starts with pw_).

## Request

### Query parameters

- `require_deliverable` (boolean, optional, nullable) — Refuse the rule (409) unless an alert from it could be delivered right now. On by default for API keys, off for the dashboard. Send false to create rules before confirming where they go.

### Body (application/json)

This endpoint expects an AlertRuleCreate.

- `threshold_type` (enum, required)
  - Allowed values: `price_below`, `price_change_pct`, `back_in_stock`, `out_of_stock`, `undercut_own_price_pct`, `below_my_cost`, `competitor_out_of_stock`, `below_map`
- `tracked_item_id` (integer, optional, nullable)
- `category_tag` (string, optional, nullable)
- `threshold_value` (double, optional, nullable)
- `channel` (enum, optional, nullable)
  - Allowed values: `whatsapp`, `email`, `webhook`, `slack`, `teams`, `telegram`
- `frequency_cap` (enum, optional) — FR-3.4 — configurable per channel, so immediate WhatsApp can coexist with a daily email digest.
  - Allowed values: `immediate`, `hourly_digest`, `daily_digest`

## Response

### 201

Successful Response

- `id` (integer, required)
- `threshold_type` (enum, required)
  - Allowed values: `price_below`, `price_change_pct`, `back_in_stock`, `out_of_stock`, `undercut_own_price_pct`, `below_my_cost`, `competitor_out_of_stock`, `below_map`
- `channel` (enum, required)
  - Allowed values: `whatsapp`, `email`, `webhook`, `slack`, `teams`, `telegram`
- `frequency_cap` (enum, required) — FR-3.4 — configurable per channel, so immediate WhatsApp can coexist with a daily email digest.
  - Allowed values: `immediate`, `hourly_digest`, `daily_digest`
- `active` (boolean, required)
- `tracked_item_id` (integer, optional, nullable)
- `category_tag` (string, optional, nullable)
- `threshold_value` (double, optional, nullable)
- `deliverable` (boolean, optional, default: true)
- `delivery_problem` (string, optional, nullable)

## Errors

### 422 Unprocessable Entity Error

Validation Error

- `detail` (list of ValidationError, optional)

## Types

### ValidationError

- `loc` (list of ValidationErrorLocItems, required)
- `msg` (string, required)
- `type` (string, required)
- `input` (any, optional)
- `ctx` (ValidationErrorCtx, optional)

### ValidationErrorLocItems

- string
- integer

### ValidationErrorCtx

## Examples

**Request**

```json
{
  "threshold_type": "price_below"
}
```

**Response**

```json
{
  "id": 1,
  "threshold_type": "price_below",
  "channel": "whatsapp",
  "frequency_cap": "immediate",
  "active": true,
  "tracked_item_id": 1,
  "category_tag": "string",
  "threshold_value": 1.1,
  "deliverable": true,
  "delivery_problem": "string"
}
```

**SDK Code**

```python
import requests

url = "https://getoutprice.com/v1/alert-rules"

payload = { "threshold_type": "price_below" }
headers = {
    "X-API-Key": "<apiKey>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript
const url = 'https://getoutprice.com/v1/alert-rules';
const options = {
  method: 'POST',
  headers: {'X-API-Key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"threshold_type":"price_below"}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://getoutprice.com/v1/alert-rules"

	payload := strings.NewReader("{\n  \"threshold_type\": \"price_below\"\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("X-API-Key", "<apiKey>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://getoutprice.com/v1/alert-rules")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"threshold_type\": \"price_below\"\n}"

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://getoutprice.com/v1/alert-rules")
  .header("X-API-Key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"threshold_type\": \"price_below\"\n}")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://getoutprice.com/v1/alert-rules', [
  'body' => '{
  "threshold_type": "price_below"
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'X-API-Key' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://getoutprice.com/v1/alert-rules");
var request = new RestRequest(Method.POST);
request.AddHeader("X-API-Key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"threshold_type\": \"price_below\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "X-API-Key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = ["threshold_type": "price_below"] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://getoutprice.com/v1/alert-rules")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```