Extract Structured Data from HTML
/v1/extractRuns allowlisted Crawl4AI structured extraction against caller-supplied HTML. This endpoint does not fetch the URL, open a browser, persist artifacts, or create a run.
On this page
Request example
Replace placeholders with your values. Use your Team API key for authenticated requests.
https://kieapi.comcurl -X POST "https://kieapi.com/v1/extract" \
-H "Authorization: Bearer $SPIDER_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"url": "<value>",
"html": "<value>",
"extraction": {
"type": "json_css"
}
}'Authentication
BearerAuth
Request body required
application/json
urlstring (uri) requiredhtmlstring requiredextractionStructuredExtractionRequest required
Responses
200 Structured extraction completed.
application/json
urlstring (uri) requiredstructuredStructuredExtractionResult requiredusagePublicUsage required
400 Request validation failed.
401 Missing or invalid API key.
403 Authenticated principal cannot access this resource.
429 Temporary rate limit.
503 Required runtime service is unavailable.
Schemas
Field definitions and complete validation rules for this API. Follow a type link to its definition.
ExtractRequest
object
urlstring (uri) requiredhtmlstring requiredextractionStructuredExtractionRequest required
Complete schema
{
"type": "object",
"additionalProperties": false,
"required": [
"url",
"html",
"extraction"
],
"properties": {
"url": {
"type": "string",
"format": "uri"
},
"html": {
"type": "string",
"minLength": 1,
"maxLength": 2000000
},
"extraction": {
"$ref": "#/components/schemas/StructuredExtractionRequest"
}
}
}StructuredExtractionRequest
object
typestring requiredAllowed:
"json_css", "llm"schemaJsonCssExtractionSchemaraw_crawl4ai_schemaobject | null- Allowlisted raw Crawl4AI JsonCssExtractionStrategy schema. Only JSON schema keys for name, baseSelector, baseFields, fields, selector, source, default, scalar/list/nested field types, regex, and safe transforms are accepted. function/expression hooks are rejected.
computed_fieldsarray of StructuredComputedFieldDefault:
[]llmStructuredLLMExtractionOptions or null
Complete schema
{
"type": "object",
"additionalProperties": false,
"required": [
"type"
],
"properties": {
"type": {
"type": "string",
"enum": [
"json_css",
"llm"
]
},
"schema": {
"$ref": "#/components/schemas/JsonCssExtractionSchema"
},
"raw_crawl4ai_schema": {
"type": [
"object",
"null"
],
"additionalProperties": true,
"description": "Allowlisted raw Crawl4AI JsonCssExtractionStrategy schema. Only JSON schema keys for name, baseSelector, baseFields, fields, selector, source, default, scalar/list/nested field types, regex, and safe transforms are accepted. function/expression hooks are rejected.\n"
},
"computed_fields": {
"type": "array",
"maxItems": 100,
"default": [],
"items": {
"$ref": "#/components/schemas/StructuredComputedField"
}
},
"llm": {
"anyOf": [
{
"$ref": "#/components/schemas/StructuredLLMExtractionOptions"
},
{
"type": "null"
}
]
}
}
}JsonCssExtractionSchema
object
namestring | nullbase_selectorstring requiredfieldsarray of StructuredExtractionField required
Complete schema
{
"type": "object",
"additionalProperties": false,
"required": [
"base_selector",
"fields"
],
"properties": {
"name": {
"type": [
"string",
"null"
],
"minLength": 1,
"maxLength": 128
},
"base_selector": {
"type": "string",
"minLength": 1,
"maxLength": 1024
},
"fields": {
"type": "array",
"minItems": 1,
"maxItems": 100,
"items": {
"$ref": "#/components/schemas/StructuredExtractionField"
}
}
}
}StructuredExtractionField
object
namestring requiredselectorstring | nulltypestring requiredAllowed:
"text", "html", "attribute", "regex", "nested", "list", "nested_list"attributestring | nullpatternstring | nullgroupinteger | nulltransformstring | nullAllowed:
"strip", "lowercase", "uppercase"fieldsarray of StructuredExtractionField or null
Complete schema
{
"type": "object",
"additionalProperties": false,
"required": [
"name",
"type"
],
"properties": {
"name": {
"type": "string",
"minLength": 1,
"maxLength": 128
},
"selector": {
"type": [
"string",
"null"
],
"minLength": 1,
"maxLength": 1024
},
"type": {
"type": "string",
"enum": [
"text",
"html",
"attribute",
"regex",
"nested",
"list",
"nested_list"
]
},
"attribute": {
"type": [
"string",
"null"
],
"minLength": 1,
"maxLength": 128
},
"pattern": {
"type": [
"string",
"null"
],
"minLength": 1,
"maxLength": 1024
},
"group": {
"type": [
"integer",
"null"
],
"minimum": 0
},
"transform": {
"type": [
"string",
"null"
],
"enum": [
"strip",
"lowercase",
"uppercase"
]
},
"fields": {
"anyOf": [
{
"type": "array",
"minItems": 1,
"maxItems": 100,
"items": {
"$ref": "#/components/schemas/StructuredExtractionField"
}
},
{
"type": "null"
}
]
}
}
}StructuredComputedField
object
namestring requiredoperationstring requiredAllowed:
"template", "join", "first_non_empty"Default:
"template"sourcesarray of stringDefault:
[]templatestring | nullseparatorstringDefault:
""defaultstring | nulltransformstring | nullAllowed:
"strip", "lowercase", "uppercase"
Complete schema
{
"type": "object",
"additionalProperties": false,
"required": [
"name",
"operation"
],
"properties": {
"name": {
"type": "string",
"minLength": 1,
"maxLength": 128
},
"operation": {
"type": "string",
"enum": [
"template",
"join",
"first_non_empty"
],
"default": "template"
},
"sources": {
"type": "array",
"maxItems": 20,
"default": [],
"items": {
"type": "string",
"pattern": "^[A-Za-z_][A-Za-z0-9_]*(?:\\.[A-Za-z_][A-Za-z0-9_]*|\\[[0-9]{1,4}\\])*$"
}
},
"template": {
"type": [
"string",
"null"
],
"minLength": 1,
"maxLength": 2048
},
"separator": {
"type": "string",
"maxLength": 128,
"default": ""
},
"default": {
"type": [
"string",
"null"
],
"maxLength": 2048
},
"transform": {
"type": [
"string",
"null"
],
"enum": [
"strip",
"lowercase",
"uppercase"
]
}
}
}StructuredLLMExtractionOptions
object
namestring | nullinstructionstringschemaobject | null- JSON Schema-style target shape sent to the server-configured LLM.
extraction_typestringAllowed:
"schema", "block"Default:
"schema"input_formatstringAllowed:
"html", "markdown", "text", "fit_html"Default:
"html"chunk_token_thresholdintegerDefault:
4096overlap_ratenumberDefault:
0.1apply_chunkingbooleanDefault:
trueforce_json_responsebooleanDefault:
truetemperaturenumber | nullmax_tokensinteger | null
Complete schema
{
"type": "object",
"additionalProperties": false,
"properties": {
"name": {
"type": [
"string",
"null"
],
"minLength": 1,
"maxLength": 128
},
"instruction": {
"type": "string",
"minLength": 1,
"maxLength": 4096
},
"schema": {
"type": [
"object",
"null"
],
"additionalProperties": true,
"description": "JSON Schema-style target shape sent to the server-configured LLM."
},
"extraction_type": {
"type": "string",
"enum": [
"schema",
"block"
],
"default": "schema"
},
"input_format": {
"type": "string",
"enum": [
"html",
"markdown",
"text",
"fit_html"
],
"default": "html"
},
"chunk_token_threshold": {
"type": "integer",
"minimum": 128,
"maximum": 200000,
"default": 4096
},
"overlap_rate": {
"type": "number",
"minimum": 0,
"maximum": 0.5,
"default": 0.1
},
"apply_chunking": {
"type": "boolean",
"default": true
},
"force_json_response": {
"type": "boolean",
"default": true
},
"temperature": {
"type": [
"number",
"null"
],
"minimum": 0,
"maximum": 2
},
"max_tokens": {
"type": [
"integer",
"null"
],
"minimum": 1,
"maximum": 128000
}
}
}ExtractResponse
object
urlstring (uri) requiredstructuredStructuredExtractionResult requiredusagePublicUsage required
Complete schema
{
"type": "object",
"additionalProperties": false,
"required": [
"url",
"structured",
"usage"
],
"properties": {
"url": {
"type": "string",
"format": "uri"
},
"structured": {
"$ref": "#/components/schemas/StructuredExtractionResult"
},
"usage": {
"$ref": "#/components/schemas/PublicUsage"
}
}
}StructuredExtractionResult
object
typestring requiredAllowed:
"json_css"sourcestring requiredAllowed:
"crawl4ai"schema_namestring | nullitemsarray of object requireditem_countinteger requiredusageStructuredExtractionUsage or nullerrorStructuredExtractionError or null
Complete schema
{
"type": "object",
"additionalProperties": false,
"required": [
"type",
"source",
"items",
"item_count"
],
"properties": {
"type": {
"type": "string",
"enum": [
"json_css"
]
},
"source": {
"type": "string",
"enum": [
"crawl4ai"
]
},
"schema_name": {
"type": [
"string",
"null"
]
},
"items": {
"type": "array",
"items": {
"type": "object",
"additionalProperties": true
}
},
"item_count": {
"type": "integer",
"minimum": 0
},
"usage": {
"anyOf": [
{
"$ref": "#/components/schemas/StructuredExtractionUsage"
},
{
"type": "null"
}
]
},
"error": {
"anyOf": [
{
"$ref": "#/components/schemas/StructuredExtractionError"
},
{
"type": "null"
}
]
}
}
}StructuredExtractionUsage
object
providerstring requiredAllowed:
"server_configured"prompt_tokensinteger | nullcompletion_tokensinteger | nulltotal_tokensinteger | null
Complete schema
{
"type": "object",
"additionalProperties": false,
"required": [
"provider"
],
"properties": {
"provider": {
"type": "string",
"enum": [
"server_configured"
]
},
"prompt_tokens": {
"type": [
"integer",
"null"
],
"minimum": 0
},
"completion_tokens": {
"type": [
"integer",
"null"
],
"minimum": 0
},
"total_tokens": {
"type": [
"integer",
"null"
],
"minimum": 0
}
}
}StructuredExtractionError
object
codestring requiredAllowed:
"structured_extraction_failed"messagestring required
Complete schema
{
"type": "object",
"additionalProperties": false,
"required": [
"code",
"message"
],
"properties": {
"code": {
"type": "string",
"enum": [
"structured_extraction_failed"
]
},
"message": {
"type": "string"
}
}
}PublicUsage
object
cost_unitsinteger | nullbudget_exhaustedboolean
Complete schema
{
"type": "object",
"additionalProperties": false,
"properties": {
"cost_units": {
"type": [
"integer",
"null"
],
"minimum": 0
},
"budget_exhausted": {
"type": "boolean"
}
}
}PublicErrorResponse
object
errorPublicError required
Complete schema
{
"type": "object",
"additionalProperties": false,
"required": [
"error"
],
"properties": {
"error": {
"$ref": "#/components/schemas/PublicError"
}
}
}PublicError
object
codestring requiredAllowed:
"seoapi_price_pending", "seoapi_unavailable", "seoapi_busy", "seoapi_not_found", "seoapi_rate_limited", "seoapi_budget_exceeded", "seoapi_idempotency_conflict", "seoapi_insufficient_credits", "seoapi_admission_failed", "seoapi_execution_interrupted", "seoapi_delivery_unknown", "seoapi_response_invalid", "seoapi_model_unsupported", "seoapi_model_options_invalid", "seoapi_provider_rejected", "seo_price_pending", "seo_provider_blocked", "seo_local_rate_limited", "seo_fallback_unavailable", "seo_fallback_budget_exceeded", "seo_pagination_expired", "seo_delivery_uncertain", "seo_auth_required", "seo_initialization_required", "seo_permission_denied", "seo_verification_required", "seo_rate_limited", "seo_upstream_unavailable", "seo_transport_failed", "seo_invalid_response", "seo_rpc_error", "seo_period_unavailable", "seo_account_unavailable", "seo_session_busy", "seo_configuration_required", "validation_error", "invalid_request", "unsupported_feature", "authentication_required", "permission_denied", "not_found", "run_not_found", "crawl_not_found", "artifact_not_found", "session_not_found", "profile_not_found", "profile_in_use", "profile_not_ready", "profile_not_cloneable", "profile_limit_reached", "profile_proxy_conflict", "proxy_not_found", "proxy_unavailable", "invalid_session_options", "invalid_query_options", "invalid_cursor", "idempotency_key_required", "browser_session_limit_reached", "browser_capacity_exhausted", "browser_start_timeout", "browser_runtime_unavailable", "session_not_active", "controller_already_connected", "browser_relay_unavailable", "precondition_required", "precondition_failed", "timeout", "run_not_ready", "artifact_expired", "quota_exceeded", "insufficient_credits", "billing_reconciliation_required", "rate_limited", "fetch_failed", "render_failed", "maps_rate_limited", "maps_challenge", "maps_schema_changed", "maps_invalid_response", "maps_transport_failed", "maps_page_budget_exhausted", "google_trends_rate_limited", "google_trends_challenge", "google_trends_explore_failed", "google_trends_widget_missing", "google_trends_related_failed", "google_trends_invalid_response", "google_trends_transport_failed", "google_trends_collection_failed", "google_ads_account_context_missing", "google_ads_batch_failed", "google_ads_browser_context_missing", "google_ads_browser_unavailable", "google_ads_collection_failed", "google_ads_page_failed", "google_ads_protocol_drift", "google_ads_rate_limited", "google_ads_timeout", "twitter_provider_unavailable", "twitter_provider_rejected", "twitter_submission_unknown", "wechat_transport_failed", "wechat_rate_limited", "wechat_invalid_response", "wechat_redirect_rejected", "wechat_verification_required", "wechat_parse_failed", "blackhatworld_search_failed", "blackhatworld_no_results", "reddit_read_failed", "idempotency_conflict", "idempotency_in_progress", "service_unavailable", "internal_error"messagestring requiredtypestring requiredAllowed:
"auth", "validation", "quota", "rate_limit", "not_found", "execution", "conflict", "internal"retryableboolean requiredrequest_idstring | nulldetailsobject
Complete schema
{
"type": "object",
"additionalProperties": false,
"required": [
"code",
"message",
"type",
"retryable"
],
"properties": {
"code": {
"type": "string",
"enum": [
"seoapi_price_pending",
"seoapi_unavailable",
"seoapi_busy",
"seoapi_not_found",
"seoapi_rate_limited",
"seoapi_budget_exceeded",
"seoapi_idempotency_conflict",
"seoapi_insufficient_credits",
"seoapi_admission_failed",
"seoapi_execution_interrupted",
"seoapi_delivery_unknown",
"seoapi_response_invalid",
"seoapi_model_unsupported",
"seoapi_model_options_invalid",
"seoapi_provider_rejected",
"seo_price_pending",
"seo_provider_blocked",
"seo_local_rate_limited",
"seo_fallback_unavailable",
"seo_fallback_budget_exceeded",
"seo_pagination_expired",
"seo_delivery_uncertain",
"seo_auth_required",
"seo_initialization_required",
"seo_permission_denied",
"seo_verification_required",
"seo_rate_limited",
"seo_upstream_unavailable",
"seo_transport_failed",
"seo_invalid_response",
"seo_rpc_error",
"seo_period_unavailable",
"seo_account_unavailable",
"seo_session_busy",
"seo_configuration_required",
"validation_error",
"invalid_request",
"unsupported_feature",
"authentication_required",
"permission_denied",
"not_found",
"run_not_found",
"crawl_not_found",
"artifact_not_found",
"session_not_found",
"profile_not_found",
"profile_in_use",
"profile_not_ready",
"profile_not_cloneable",
"profile_limit_reached",
"profile_proxy_conflict",
"proxy_not_found",
"proxy_unavailable",
"invalid_session_options",
"invalid_query_options",
"invalid_cursor",
"idempotency_key_required",
"browser_session_limit_reached",
"browser_capacity_exhausted",
"browser_start_timeout",
"browser_runtime_unavailable",
"session_not_active",
"controller_already_connected",
"browser_relay_unavailable",
"precondition_required",
"precondition_failed",
"timeout",
"run_not_ready",
"artifact_expired",
"quota_exceeded",
"insufficient_credits",
"billing_reconciliation_required",
"rate_limited",
"fetch_failed",
"render_failed",
"maps_rate_limited",
"maps_challenge",
"maps_schema_changed",
"maps_invalid_response",
"maps_transport_failed",
"maps_page_budget_exhausted",
"google_trends_rate_limited",
"google_trends_challenge",
"google_trends_explore_failed",
"google_trends_widget_missing",
"google_trends_related_failed",
"google_trends_invalid_response",
"google_trends_transport_failed",
"google_trends_collection_failed",
"google_ads_account_context_missing",
"google_ads_batch_failed",
"google_ads_browser_context_missing",
"google_ads_browser_unavailable",
"google_ads_collection_failed",
"google_ads_page_failed",
"google_ads_protocol_drift",
"google_ads_rate_limited",
"google_ads_timeout",
"twitter_provider_unavailable",
"twitter_provider_rejected",
"twitter_submission_unknown",
"wechat_transport_failed",
"wechat_rate_limited",
"wechat_invalid_response",
"wechat_redirect_rejected",
"wechat_verification_required",
"wechat_parse_failed",
"blackhatworld_search_failed",
"blackhatworld_no_results",
"reddit_read_failed",
"idempotency_conflict",
"idempotency_in_progress",
"service_unavailable",
"internal_error"
]
},
"message": {
"type": "string"
},
"type": {
"type": "string",
"enum": [
"auth",
"validation",
"quota",
"rate_limit",
"not_found",
"execution",
"conflict",
"internal"
]
},
"retryable": {
"type": "boolean"
},
"request_id": {
"type": [
"string",
"null"
]
},
"details": {
"type": "object",
"additionalProperties": true
}
}
}