CORS Checker API¶
Overview¶
Analyze a remote server’s response to an HTTP request and inspect its CORS-related response headers. This endpoint accepts a JSON request body and runs synchronously.
Endpoint¶
| Property | Value |
|---|---|
| Method | POST |
| URL | https://api.apidatatools.com/cors-checker-api |
Authentication¶
Include your API key in the x-api-key request header.
Input modes¶
This endpoint supports the body input mode.
Headers¶
Header names are case-insensitive. Use the lowercase spellings shown below.
| Header | Type | Required | Default / values | Description |
|---|---|---|---|---|
x-api-key | string | Yes | No default | Your API key. |
x-source-type | string | No | Default: body; supported value: body | Selects the input mode. |
Request body¶
Send a JSON object with these fields:
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
remote_url | string | Yes | — | Remote HTTP or HTTPS URL to check. Requests to private or internal IP ranges are not allowed. |
method | string | No | GET | HTTP method to use. Supported values: GET, POST, PUT, PATCH, HEAD, and OPTIONS. |
request_headers | string | No | "" | Semicolon-separated request header pairs, such as Authorization: Bearer token; X-Test: 1. |
request_body | string | No | "" | Body to send with the remote request. |
The request body must be valid JSON. An empty request body is rejected.
curl example¶
curl --request POST 'https://api.apidatatools.com/cors-checker-api' \
--header 'x-api-key: YOUR_API_KEY' \
--header 'x-source-type: body' \
--data-raw '{
"remote_url": "https://example.com",
"method": "GET",
"request_headers": "",
"request_body": ""
}'
Success responses¶
A successful request returns HTTP 200 with a JSON response containing:
| Field | Type | Description |
|---|---|---|
request_id | string | Identifier for the API request. |
status | string | Success indicator: success. |
preview | string | Serialized JSON containing the remote response status, CORS report, and response headers. |
The JSON represented by preview contains:
| Field | Type | Description |
|---|---|---|
status | string | Success indicator: success. |
remote_status | number | HTTP status returned by the remote server. |
cors_report | object | Values of access_control_allow_origin, access_control_allow_methods, access_control_allow_headers, access_control_allow_credentials, access_control_expose_headers, and vary. A value is null when the corresponding response header is absent. |
response_headers | object | Headers returned by the remote server. |
Error handling¶
Errors use an envelope containing status, error, request_id, and details.message. Additional fields may be included in details.
| HTTP status | Error code | Description |
|---|---|---|
400 | EMPTY_BODY | The request body is empty. |
400 | INVALID_JSON | The request body is not valid JSON. |
400 | MISSING_URL | remote_url is missing. |
400 | INVALID_URL | The URL is not a valid HTTP or HTTPS URL. |
400 | INVALID_METHOD | The requested method is not supported. |
400 | SSRF_BLOCKED | The URL resolves to a private or internal IP range. |
400 | URL_UNREACHABLE | The URL could not be reached for the preliminary check. |
400 | REQUEST_FAILED | The request to the remote server failed. |
400 | INVALID_SOURCE_TYPE | The x-source-type value is not supported for this endpoint. |
401 | UNAUTHORIZED | Authentication is missing or invalid. |
404 | USER_NOT_FOUND | The authenticated user was not found. |
404 | UNKNOWN_FUNCTION | The requested API endpoint is unsupported. |
413 | PAYLOAD_TOO_LARGE | The request body exceeds the limit for the account’s plan. |
429 | QUOTA_EXCEEDED | The account’s request quota is exhausted. |
429 | RATE_LIMITED | The request rate limit has been exceeded. |
500 | PLAN_NOT_FOUND | Plan configuration could not be found. |
500 | AUTH_ERROR | An unexpected authentication error occurred. |
500 | INTERNAL_ERROR | The request could not be processed. |
Errors raised while validating or making the remote request use HTTP 400.
Notes¶
- Request body size, quota, and rate limits depend on your plan. See API tool limits.
- The remote server’s response headers are returned as received by the API; this endpoint does not establish whether a browser will accept a cross-origin request.