
# Create Multiple Monitors at Once

The bulk monitor creation endpoint allows you to create up to 1,000 DNS monitors in a single API request. This is ideal for onboarding new customers, deploying monitoring across multiple domains, or managing large DNS infrastructures.

## Bulk Creation Endpoint

Send a POST request to `/monitors/bulk` with an array of monitor configurations.

```
POST https://api.dnsradar.dev/monitors/bulk

monitors:
    - domain: piedpiper.com
      record_type: A
      expected_value: ["1.2.3.4", "5.6.7.8"]
    - domain: piedpiper.com
      subdomain: www
      record_type: CNAME
      expected_value: piedpiper.netlify.app
    - domain: piedpiper.com
      record_type: TXT
      expected_value: v=spf1 include:_spf.service.com -all
    - domain: piedpiper.com
      subdomain: _dmarc
      record_type: TXT
      expected_value: "v=DMARC1; p=reject; pct=100; adkim=s; aspf=s"
  group: production-dns
  frequency: 60
```

## Request Structure

### Required Fields

- `monitors` (array): Array of monitor objects to create (1-1000 items). Please refer to [Create a DNS Monitor](/docs/create-monitor) for its detailled structure.

Each monitor object requires:
- `domain`: The domain name to monitor
- `record_type`: DNS record type (A, AAAA, CNAME, MX, TXT, NS, PTR)
- `expected_value`: Expected DNS value(s)

### Optional Global Parameters

You can specify default values that apply to all monitors in the batch:

- `group` (string): Default group slug for all monitors
- `frequency` (integer): Default check frequency in minutes (5, 10, 15, 30, 60, 120)

Individual monitors can override these defaults by including their own `group` or `frequency` fields.

> ℹ️ **INFO:** **Auto-Creation**: If a specified group provided by its slug doesn't exist, we will create one automatically during the bulk operation.

## Per-Monitor Configuration

Each monitor in the array can have its own configuration:

```
POST https://api.dnsradar.dev/monitors/bulk

monitors:
    - domain: api.piedpiper.com
      record_type: A
      expected_value: ["1.2.3.4"]
      frequency: 5
      group: critical-services
    - domain: blog.piedpiper.com
      record_type: CNAME
      expected_value: piedpiper.netlify.app
      frequency: 60
      group: marketing-sites
    - domain: mail.piedpiper.com
      record_type: MX
      expected_value: ["10 mx1.provider.com", "20 mx2.provider.com"]
      is_exact_match: false
      group: email-infrastructure
```

## API Response

The API returns an array of created monitor objects, maintaining the same order as your request:

```json
{
  "data": [
    {
      "uuid": "mon_abc123",
      "created": "2026-01-06T12:34:56Z",
      "domain": "piedpiper.com",
      "subdomain": null,
      "record_type": "A",
      "expected_value": ["1.2.3.4", "5.6.7.8"],
      "current_value": null,
      "is_exact_match": true,
      "state": "UNSET",
      "incidence_count": 0,
      "last_checked": null,
      "is_active": true,
      "frequency": 60
    },
    {
      "uuid": "mon_abc456",
      "created": "2026-01-06T12:34:56Z",
      "domain": "piedpiper.com",
      "subdomain": "www",
      "record_type": "CNAME",
      "expected_value": ["piedpiper.netlify.app"],
      "current_value": null,
      "is_exact_match": true,
      "state": "UNSET",
      "incidence_count": 0,
      "last_checked": null,
      "is_active": true,
      "frequency": 60
    }
  ]
}
```

## Scalability and Performance

The bulk creation endpoint is optimized for high-throughput operations:

### Rate Limiting

> ✅ **SUCCESS:** **Higher Limits**: The `/monitors/bulk` endpoint, like the `/monitors` endpoint, has a rate limit of 250 requests per minute.

In the `/monitors/bulk` endpoint, this allows you to create up to 250,000 monitors per minute (250 requests × 1,000 monitors).

### Batch Size Recommendations

- **Small batches (1-100 monitors)**: Fast response times, ideal for real-time operations
- **Medium batches (100-500 monitors)**: Good balance of throughput and response time
- **Large batches (500-1000 monitors)**: Maximum efficiency for bulk imports

## Error Handling

If any monitor in the batch fails validation, the entire request is rejected, and no monitors are created. This ensures data consistency.

> 🚨 **DANGER:** **Transaction Guarantee**: Bulk creation is atomic. Either all monitors are created successfully, or none are created. This prevents partial deployments.

Common validation errors include:
- Invalid domain format
- Unsupported record type
- Missing required fields
- Monitor limit exceeded


## Plan Limitations

> ⚠️ **WARNING:** **Monitor Limits**: Free plan limited to 50 total monitors.

Premium plans support unlimited monitors. The bulk creation endpoint respects these limits.

## Best Practices

1. **Group Related Monitors**: Use the `group` parameter to organize monitors logically
2. **Set Appropriate Frequencies**: Balance monitoring coverage with API usage
3. **Use Consistent Naming**: Establish naming conventions for your groups
4. **Implement Error Handling**: Always handle API errors gracefully in your application

## Next Steps

- [Update multiple monitors at once](/docs/update-monitors-bulk)
- [Configure webhooks for notifications](/docs/configure-webhooks)
- [Monitor SPF records with flexible matching](/docs/spf-flexible-matching)
