Integrate Web Defender's powerful security features into your applications
The Web Defender API allows you to integrate our security features into your applications, automate security operations, and access your security data programmatically. Our RESTful API uses standard HTTP methods and returns JSON responses.
https://api.webdefender.online/v1
The Web Defender API is versioned to ensure backward compatibility. The current version is v1
. When a new version is released, the previous version will be supported for at least 12 months.
All requests should include the Content-Type: application/json
header. Responses will also be in JSON format.
To start using the API, you'll need to authenticate your requests using an API key.
All API requests must be authenticated using an API key. You can generate an API key in the Web Defender dashboard under Settings > API.
Include your API key in the Authorization
header of your requests:
Authorization: Bearer YOUR_API_KEY
curl -X GET "https://api.webdefender.online/v1/websites" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json"
Keep your API key secure and never share it publicly. If you believe your API key has been compromised, you can regenerate it in the dashboard.
To ensure the stability and availability of the API, we enforce rate limits on API requests. The rate limits vary based on your subscription plan.
Plan | Rate Limit | Burst Limit |
---|---|---|
Free Trial | 60 requests per minute | 100 requests |
Standard | 300 requests per minute | 500 requests |
Enterprise | 1,000 requests per minute | 2,000 requests |
Each API response includes headers that provide information about your current rate limit status:
X-RateLimit-Limit: 300
X-RateLimit-Remaining: 297
X-RateLimit-Reset: 1620000000
X-RateLimit-Limit
: The maximum number of requests you can make per minuteX-RateLimit-Remaining
: The number of requests remaining in the current minuteX-RateLimit-Reset
: The time at which the rate limit will reset, in Unix timeIf you exceed the rate limit, you'll receive a 429 Too Many Requests
response. The response will include a Retry-After
header indicating how many seconds to wait before making another request.
The Web Defender API uses standard HTTP status codes to indicate the success or failure of a request. In addition to the status code, error responses include a JSON body with more information about the error.
{
"error": {
"code": "invalid_request",
"message": "The request was invalid",
"details": "The 'website_id' parameter is required"
}
}
Status Code | Error Code | Description |
---|---|---|
400 | invalid_request | The request was invalid or malformed |
401 | unauthorized | Authentication failed or was not provided |
403 | forbidden | You don't have permission to access the resource |
404 | not_found | The requested resource was not found |
429 | rate_limit_exceeded | You've exceeded the rate limit |
500 | server_error | An error occurred on the server |
When handling errors in your application, we recommend checking both the HTTP status code and the error code in the response body. This will give you more detailed information about what went wrong and how to fix it.
try {
const response = await fetch('https://api.webdefender.online/v1/websites', {
headers: {
'Authorization': `Bearer ${apiKey}`,
'Content-Type': 'application/json'
}
});
if (!response.ok) {
const error = await response.json();
throw new Error(`${response.status}: ${error.error.message}`);
}
const data = await response.json();
// Process data
} catch (error) {
console.error('API Error:', error.message);
}
The Websites API allows you to manage the websites protected by Web Defender. You can list, create, update, and delete websites, as well as configure their protection settings.
Retrieve a list of all websites protected by Web Defender.
GET /websites
curl -X GET "https://api.webdefender.online/v1/websites" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json"
{
"data": [
{
"id": "ws_123456",
"domain": "example.com",
"protocol": "https",
"created_at": "2023-01-15T12:00:00Z",
"protection_level": "standard",
"status": "active"
},
{
"id": "ws_789012",
"domain": "another-example.com",
"protocol": "https",
"created_at": "2023-02-20T15:30:00Z",
"protection_level": "high",
"status": "active"
}
],
"meta": {
"total": 2,
"per_page": 10,
"current_page": 1,
"last_page": 1
}
}
Add a new website to Web Defender for protection.
POST /websites
Parameter | Type | Required | Description |
---|---|---|---|
domain | string | Yes | The domain name of the website (e.g., example.com) |
protocol | string | Yes | The protocol used by the website (http or https) |
protection_level | string | No | The protection level (low, standard, high). Default: standard |
curl -X POST "https://api.webdefender.online/v1/websites" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"domain": "new-example.com",
"protocol": "https",
"protection_level": "standard"
}'
{
"data": {
"id": "ws_345678",
"domain": "new-example.com",
"protocol": "https",
"created_at": "2023-06-10T09:45:00Z",
"protection_level": "standard",
"status": "active"
}
}
We provide official SDKs and libraries to make it easier to integrate with the Web Defender API in your preferred programming language.
Our JavaScript SDK works in both Node.js and browser environments, making it easy to integrate Web Defender into your JavaScript applications.
npm install webdefender-js
Our Python SDK provides a simple and intuitive interface for interacting with the Web Defender API in your Python applications.
pip install webdefender
Our PHP SDK makes it easy to integrate Web Defender into your PHP applications, with support for modern PHP features and frameworks.
composer require webdefender/webdefender-php
Our Java SDK provides a robust and type-safe interface for interacting with the Web Defender API in your Java applications.
<dependency>
<groupId>online.webdefender</groupId>
<artifactId>webdefender-java</artifactId>
<version>1.0.0</version>
</dependency>
Our Go SDK provides a clean and idiomatic interface for interacting with the Web Defender API in your Go applications.
go get github.com/webdefender/webdefender-go
Our community has developed SDKs for additional languages and frameworks. These SDKs are maintained by the community but follow our best practices.
Available for: Ruby, .NET, Swift, Rust, and more.
View on GitHubOur developer support team is here to help you integrate Web Defender into your applications. Contact us with any questions or issues.