> ## Documentation Index
> Fetch the complete documentation index at: https://docs.pulseguard.nl/llms.txt
> Use this file to discover all available pages before exploring further.

# API Playground

> Interactive testing environment for PulseGuard API endpoints

# API Playground

Welcome to the PulseGuard API Playground! This interactive environment allows you to test and explore our API endpoints directly from the documentation.

## Features

### 🚀 Interactive Testing

* Test all API endpoints directly from your browser
* Real-time request/response inspection
* Automatic code generation in multiple languages
* Live schema validation

### 🔧 Code Examples

Our playground automatically generates code examples in:

* **cURL** - Command line testing
* **Python** - Using requests library
* **JavaScript** - Fetch API and axios
* **PHP** - Guzzle HTTP client

### 🛡️ Authentication

The playground supports all PulseGuard authentication methods:

* **Bearer Token** - For standard API access
* **Agent Token** - For device communications
* **Public Endpoints** - No authentication required

## Getting Started

### 1. Obtain Your API Token

1. Log into your [PulseGuard Dashboard](https://guard.ipulse.one)
2. Navigate to **Settings** → **API Tokens**
3. Generate a new token with appropriate permissions
4. Copy the token for use in the playground

### 2. Configure Authentication

In any API endpoint playground:

1. Click the **🔒 Authorize** button
2. Enter your API token in the format: `Bearer YOUR_TOKEN`
3. Click **Authorize** to apply to all requests

### 3. Test Endpoints

1. Navigate to any endpoint in the [API Reference](/api-reference)
2. Fill in required parameters
3. Click **Try it out**
4. View the response and generated code

## Quick Start Examples

### Domain Monitoring

```bash theme={null}
# List all domains
curl -X GET "https://api.ipulse.one/domains" \
  -H "Authorization: Bearer YOUR_API_TOKEN"

# Create a new domain monitor
curl -X POST "https://api.ipulse.one/domains" \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "My Website",
    "url": "https://example.com",
    "check_interval": 5
  }'
```

### Device Management

```bash theme={null}
# Get device metrics
curl -X GET "https://api.ipulse.one/devices/DEVICE-UUID" \
  -H "Authorization: Bearer YOUR_API_TOKEN"

# Regenerate device token
curl -X POST "https://api.ipulse.one/devices/DEVICE-UUID/regenerate-token" \
  -H "Authorization: Bearer YOUR_API_TOKEN"
```

### Toolbox Utilities

```bash theme={null}
# DNS lookup
curl -X POST "https://api.ipulse.one/toolbox/dns-lookup" \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "domain": "example.com",
    "record_type": "A"
  }'
```

## Response Format

All API responses follow a consistent format:

```json theme={null}
{
  "success": true,
  "message": "Operation completed successfully",
  "data": {
    // Response data here
  }
}
```

### Error Responses

```json theme={null}
{
  "success": false,
  "message": "Error description",
  "errors": {
    "field_name": ["Validation error message"]
  }
}
```

## Rate Limiting

The playground respects all rate limits:

| Plan   | Requests/Minute | Requests/Hour |
| ------ | --------------- | ------------- |
| Expert | 1,000           | 10,000        |
| Pro    | 300             | 3,000         |
| Free   | 100             | 1,000         |

Rate limit information is shown in response headers:

* `X-RateLimit-Limit`
* `X-RateLimit-Remaining`
* `X-RateLimit-Reset`

## Best Practices

### 🔒 Security

* Never expose API tokens in client-side code
* Use environment variables for token storage
* Rotate tokens regularly
* Use minimum required permissions

### ⚡ Performance

* Cache frequently accessed data
* Use appropriate pagination parameters
* Batch requests when possible
* Implement exponential backoff for retries

### 🐛 Error Handling

* Always check the `success` field in responses
* Handle rate limit errors gracefully
* Log errors for debugging
* Implement proper timeout handling

## Troubleshooting

### Common Issues

**401 Unauthorized**

* Check your API token is valid
* Ensure token has required permissions
* Verify Expert Plan subscription for API access

**403 Forbidden**

* Upgrade to required subscription plan
* Check endpoint-specific plan requirements
* Verify token permissions

**422 Validation Error**

* Review request payload format
* Check required fields are present
* Validate data types and formats

**429 Rate Limit Exceeded**

* Implement exponential backoff
* Consider upgrading your plan
* Optimize request frequency

### Getting Help

* Check our [Troubleshooting Guide](/resources/support)
* Review response error messages
* Contact support at [info@ipulse.one](mailto:info@ipulse.one)
* Join our [Discord Community](https://discord.gg/pulseguard)

***

Ready to start testing? Head over to our [API Reference](/api-reference) and try out the interactive playground!
