Learn more about API Checks in the API Checks overview.
Prerequisites
Prerequisites
Before creating API Checks, ensure you have:
- An initialized Checkly CLI project
- URLs or HTTP endpoints you want to monitor
- Understanding of HTTP status codes and response behavior
- Network access to the URLs you want to monitor
Configuration
The API Check configuration consists of specific API Check options and inherited general check options.Parameter | Type | Required | Default | Description |
---|---|---|---|---|
request | object | ✅ | - | HTTP request configuration object |
degradedResponseTime | number | ❌ | 10000 | Response time threshold in milliseconds for degraded status |
maxResponseTime | number | ❌ | 20000 | Maximum response time in milliseconds before marking as failed |
shouldFail | boolean | ❌ | false | Whether a failure should count as a pass (status 400+ reported as passed) |
setupScript | object | ❌ | - | Script to run before the API Check execution |
tearDownScript | object | ❌ | - | Script to run after the API Check execution |
API Check Options
The HTTP request configuration that defines the API endpoint to monitor. This is the core component of any API Check.Usage:Parameters:
Examples:Use cases: HTTP endpoint monitoring, REST API testing, GraphQL API validation, authentication testing.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
method | string | ✅ | - | HTTP method: GET | POST | PUT | PATCH | HEAD | DELETE | OPTIONS |
url | string | ✅ | - | The target URL for the HTTP request |
assertions | array | ❌ | [] | Response assertions using AssertionBuilder |
basicAuth | object | ❌ | - | Basic auth credentials: { username, password } |
body | string | ❌ | - | HTTP request body content |
bodyType | string | ❌ | NONE | Body type: JSON | FORM | RAW | GRAPHQL | NONE |
followRedirects | boolean | ❌ | true | Whether to automatically follow 30x redirects |
headers | array | ❌ | [] | Array of { key, value } objects for HTTP headers |
skipSSL | boolean | ❌ | false | Whether to skip SSL certificate validation |
queryParameters | array | ❌ | [] | Array of { key, value } objects for query parameters |
Response time threshold in milliseconds for marking the check as degraded. This provides an early warning before the check fails completely.Usage:Use cases: Performance alerting, SLA monitoring, gradual degradation detection.
Maximum response time in milliseconds before marking the check as failed. This sets the absolute threshold for check failure based on response time.Usage:Use cases: Performance monitoring, SLA compliance, timeout management.
Whether a failure should count as a pass. When set to Examples:Use cases: Negative testing, error handling validation, security testing.
true
, HTTP status codes 400 and above are reported as passed instead of failed.Usage:Script to run before the API Check execution. Useful for setting up test data or authentication tokens.Usage:Parameters:
Use cases: Test data setup, authentication preparation, environment configuration.
Parameter | Type | Required | Description |
---|---|---|---|
entrypoint | string | ❌ | Path to a .js or .ts file containing the setup script |
content | string | ❌ | Inline JavaScript/TypeScript code as a string |
You must provide either
entrypoint
or content
, but not both.Learn more about writing setup and teardown scripts in the setup and teardown scripts documentation.
Script to run after the API Check execution. Useful for cleaning up test data or resources.Usage:Parameters:
Use cases: Test data cleanup, resource cleanup, logging and reporting.
Parameter | Type | Required | Description |
---|---|---|---|
entrypoint | string | ❌ | Path to a .js or .ts file containing the teardown script |
content | string | ❌ | Inline JavaScript/TypeScript code as a string |
You must provide either
entrypoint
or content
, but not both.Learn more about writing setup and teardown scripts in the setup and teardown scripts documentation.
Examples
When using environment variables in your requests (like
{{API_TOKEN}}
), make sure they are properly configured in your project or check group settings.