---
title: "Create Monitor"
description: "Creates a new keyword monitor across Reddit posts and/or comments. Billed 10 credits upfront for the first 24 hours. Daily match volume and webhooks are free.\n"
---

> Documentation Index
> Fetch the complete documentation index at: https://staging.threadapi.dev/llms.txt
> Use this file to discover all available pages before exploring further.

Path: ThreadAPI API › Monitors

`POST /v1/monitors`

Creates a new keyword monitor across Reddit posts and/or comments. Billed 10 credits upfront for the first 24 hours. Daily match volume and webhooks are free.

## Authentication

Requires one of the following:

- `bearerAuth`, http, header `Authorization`
- `apiKeyAuth`, apiKey, in header, header `x-api-key`

## Request body

_Required._

- `name` (`createMonitor.name`; string, required)
  - example `"Mentions of restic"`
- `keywords` (`createMonitor.keywords`; array<string>, required)
  - example `["restic","\"borg backup\""]`
- `exclude` (`createMonitor.exclude`; array<string>, optional)
  - example `["hiring"]`
- `subreddits` (`createMonitor.subreddits`; array<string>, optional)
  - example `["selfhosted","DataHoarder"]`
- `posts` (`createMonitor.posts`; boolean, optional)
  - default `true`
- `comments` (`createMonitor.comments`; boolean, optional)
  - default `true`
- `nsfw` (`createMonitor.nsfw`; boolean, optional)
  - default `false`
- `webhook_url` (`createMonitor.webhook_url`; string, optional)
  - example `"https://example.com/hook"`
- `webhook_kind` (`createMonitor.webhook_kind`; string, optional)
  - one of `"generic"`, `"slack"`, `"discord"`, `"telegram"`

## Example request

```json
{
  "name": "Mentions of restic",
  "keywords": [
    "restic",
    "\"borg backup\""
  ],
  "exclude": [
    "hiring"
  ],
  "subreddits": [
    "selfhosted",
    "DataHoarder"
  ],
  "posts": true,
  "comments": true,
  "nsfw": false,
  "webhook_url": "https://example.com/hook",
  "webhook_kind": "generic"
}
```

## Code samples

### cURL

```bash
curl --request POST \
  --url https://api.threadapi.dev/v1/monitors \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "name": "Mentions of restic",
  "keywords": [
    "restic",
    "\"borg backup\""
  ],
  "exclude": [
    "hiring"
  ],
  "subreddits": [
    "selfhosted",
    "DataHoarder"
  ],
  "posts": true,
  "comments": true,
  "nsfw": false,
  "webhook_url": "https://example.com/hook",
  "webhook_kind": "generic"
}
'
```

### TypeScript

```typescript
const url = 'https://api.threadapi.dev/v1/monitors';
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json', Authorization: 'Bearer <token>'},
  body: JSON.stringify({
    name: 'Mentions of restic',
    keywords: ['restic', '"borg backup"'],
    exclude: ['hiring'],
    subreddits: ['selfhosted', 'DataHoarder'],
    posts: true,
    comments: true,
    nsfw: false,
    webhook_url: 'https://example.com/hook',
    webhook_kind: 'generic'
  })
};

fetch(url, options)
  .then(res => res.json())
  .then(json => console.log(json))
  .catch(err => console.error(err));
```

### Python

```python
import requests

url = "https://api.threadapi.dev/v1/monitors"

payload = {
    "name": "Mentions of restic",
    "keywords": ["restic", "\"borg backup\""],
    "exclude": ["hiring"],
    "subreddits": ["selfhosted", "DataHoarder"],
    "posts": True,
    "comments": True,
    "nsfw": False,
    "webhook_url": "https://example.com/hook",
    "webhook_kind": "generic"
}
headers = {
    "Content-Type": "application/json",
    "Authorization": "Bearer <token>"
}

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

print(response.text)
```

## Responses

### 201

Created monitor and HMAC secret

#### Example

```json
{
  "monitor": {
    "id": "string",
    "name": "string",
    "keywords": [
      "string"
    ],
    "exclude": [
      "string"
    ],
    "subreddits": [
      "string"
    ],
    "include_posts": true,
    "include_comments": true,
    "nsfw": true,
    "webhook_url": "string",
    "webhook_kind": "generic",
    "status": "active",
    "webhook_failing": true,
    "next_charge_at": "2019-08-24T14:15:22Z",
    "last_match_at": "2019-08-24T14:15:22Z",
    "created_at": "2019-08-24T14:15:22Z",
    "updated_at": "2019-08-24T14:15:22Z"
  },
  "webhook_secret": "string"
}
```

- `monitor` (`createMonitor.response.201.monitor`; object, optional)
  - `id` (`createMonitor.response.201.monitor.id`; string, required)
  - `name` (`createMonitor.response.201.monitor.name`; string, required)
  - `keywords` (`createMonitor.response.201.monitor.keywords`; array<string>, required)
  - `include_posts` (`createMonitor.response.201.monitor.include_posts`; boolean, required)
  - `include_comments` (`createMonitor.response.201.monitor.include_comments`; boolean, required)
  - `nsfw` (`createMonitor.response.201.monitor.nsfw`; boolean, required)
  - `status` (`createMonitor.response.201.monitor.status`; string, required)
    - one of `"active"`, `"paused"`, `"paused_balance"`, `"deleted"`
  - `next_charge_at` (`createMonitor.response.201.monitor.next_charge_at`; string, required)
    - format `date-time`
  - `created_at` (`createMonitor.response.201.monitor.created_at`; string, required)
    - format `date-time`
  - `updated_at` (`createMonitor.response.201.monitor.updated_at`; string, required)
    - format `date-time`
  - `exclude` (`createMonitor.response.201.monitor.exclude`; array<string>, optional)
  - `subreddits` (`createMonitor.response.201.monitor.subreddits`; array<string>, optional)
  - `webhook_url` (`createMonitor.response.201.monitor.webhook_url`; string | null, optional)
  - `webhook_kind` (`createMonitor.response.201.monitor.webhook_kind`; string | null, optional)
    - one of `"generic"`, `"slack"`, `"discord"`, `"telegram"`, `null`
  - `webhook_failing` (`createMonitor.response.201.monitor.webhook_failing`; boolean, optional)
  - `last_match_at` (`createMonitor.response.201.monitor.last_match_at`; string | null, optional)
    - format `date-time`
- `webhook_secret` (`createMonitor.response.201.webhook_secret`; string, optional)

### 400

Bad request (invalid parameter or unknown action)

#### Example

```json
{
  "error": "unauthorized: missing or invalid credentials",
  "error_code": "insufficient_credits"
}
```

One of:

- `ErrorResponse`
- `Error`

### 401

Missing or invalid API key or OAuth access token

#### Example

```json
{
  "error": "unauthorized: missing or invalid credentials",
  "error_code": "insufficient_credits"
}
```

One of:

- `ErrorResponse`
- `Error`

### 402

The account has no credits left (`insufficient_credits`).

#### Example

```json
{
  "error": {
    "code": "not_found",
    "message": "string",
    "retryable": true,
    "retry_after": 0
  }
}
```

- `error` (`createMonitor.response.402.error`; object, required)
  - `code` (`createMonitor.response.402.error.code`; string, required)
    - example `"not_found"`
  - `message` (`createMonitor.response.402.error.message`; string, required)
  - `retryable` (`createMonitor.response.402.error.retryable`; boolean, required)
  - `retry_after` (`createMonitor.response.402.error.retry_after`; integer, optional) — Seconds to wait before retrying.

### 429

Rate limit or daily request quota exceeded

#### Example

```json
{
  "error": "unauthorized: missing or invalid credentials",
  "error_code": "insufficient_credits"
}
```

One of:

- `ErrorResponse`
- `Error`


Source: https://staging.threadapi.dev/api/Monitors/createMonitor/index.md
