# Fixed reference example. Playground inputs do not update this sample.
curl --request POST \
--url https://api.aisa.one/apis/v1/dataforseo/on_page/keyword_density \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '[
{
"id": "09101923-1535-0216-0000-2389a8854b70",
"url": "https://dataforseo.com/",
"keyword_length": 2,
"filters": [
"frequency",
">",
5
]
}
]'curl --request POST \
--url https://api.aisa.one/apis/v1/dataforseo/on_page/keyword_density \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
[
{
"filters": [
"frequency",
">",
5
],
"id": "09101923-1535-0216-0000-2389a8854b70",
"keyword_length": 2,
"url": "https://dataforseo.com/"
}
]
'import requests
url = "https://api.aisa.one/apis/v1/dataforseo/on_page/keyword_density"
payload = [
{
"filters": ["frequency", ">", 5],
"id": "09101923-1535-0216-0000-2389a8854b70",
"keyword_length": 2,
"url": "https://dataforseo.com/"
}
]
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify([
{
filters: ['frequency', '>', 5],
id: '09101923-1535-0216-0000-2389a8854b70',
keyword_length: 2,
url: 'https://dataforseo.com/'
}
])
};
fetch('https://api.aisa.one/apis/v1/dataforseo/on_page/keyword_density', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.aisa.one/apis/v1/dataforseo/on_page/keyword_density",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
[
'filters' => [
'frequency',
'>',
5
],
'id' => '09101923-1535-0216-0000-2389a8854b70',
'keyword_length' => 2,
'url' => 'https://dataforseo.com/'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.aisa.one/apis/v1/dataforseo/on_page/keyword_density"
payload := strings.NewReader("[\n {\n \"filters\": [\n \"frequency\",\n \">\",\n 5\n ],\n \"id\": \"09101923-1535-0216-0000-2389a8854b70\",\n \"keyword_length\": 2,\n \"url\": \"https://dataforseo.com/\"\n }\n]")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.aisa.one/apis/v1/dataforseo/on_page/keyword_density")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("[\n {\n \"filters\": [\n \"frequency\",\n \">\",\n 5\n ],\n \"id\": \"09101923-1535-0216-0000-2389a8854b70\",\n \"keyword_length\": 2,\n \"url\": \"https://dataforseo.com/\"\n }\n]")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.aisa.one/apis/v1/dataforseo/on_page/keyword_density")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "[\n {\n \"filters\": [\n \"frequency\",\n \">\",\n 5\n ],\n \"id\": \"09101923-1535-0216-0000-2389a8854b70\",\n \"keyword_length\": 2,\n \"url\": \"https://dataforseo.com/\"\n }\n]"
response = http.request(request)
puts response.read_body{
"cost": 123,
"status_code": 123,
"status_message": "<string>",
"tasks_count": 123,
"tasks_error": 123,
"time": "<string>",
"version": "<string>",
"tasks": [
{
"cost": 123,
"data": {},
"id": "<string>",
"path": [
"<string>"
],
"result_count": 123,
"status_code": 123,
"status_message": "<string>",
"time": "<string>",
"result": [
{
"crawl_progress": "<string>",
"crawl_status": {
"max_crawl_pages": 123,
"pages_crawled": 123,
"pages_in_queue": 123
},
"items": [
{
"density": 123,
"frequency": 123,
"keyword": "<string>"
}
],
"items_count": 123,
"total_items_count": 123
}
]
}
]
}关键词密度
一次爬取内的词与词组频次,keyword_length 选 n-gram 长度。
# Fixed reference example. Playground inputs do not update this sample.
curl --request POST \
--url https://api.aisa.one/apis/v1/dataforseo/on_page/keyword_density \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '[
{
"id": "09101923-1535-0216-0000-2389a8854b70",
"url": "https://dataforseo.com/",
"keyword_length": 2,
"filters": [
"frequency",
">",
5
]
}
]'curl --request POST \
--url https://api.aisa.one/apis/v1/dataforseo/on_page/keyword_density \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
[
{
"filters": [
"frequency",
">",
5
],
"id": "09101923-1535-0216-0000-2389a8854b70",
"keyword_length": 2,
"url": "https://dataforseo.com/"
}
]
'import requests
url = "https://api.aisa.one/apis/v1/dataforseo/on_page/keyword_density"
payload = [
{
"filters": ["frequency", ">", 5],
"id": "09101923-1535-0216-0000-2389a8854b70",
"keyword_length": 2,
"url": "https://dataforseo.com/"
}
]
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify([
{
filters: ['frequency', '>', 5],
id: '09101923-1535-0216-0000-2389a8854b70',
keyword_length: 2,
url: 'https://dataforseo.com/'
}
])
};
fetch('https://api.aisa.one/apis/v1/dataforseo/on_page/keyword_density', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.aisa.one/apis/v1/dataforseo/on_page/keyword_density",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
[
'filters' => [
'frequency',
'>',
5
],
'id' => '09101923-1535-0216-0000-2389a8854b70',
'keyword_length' => 2,
'url' => 'https://dataforseo.com/'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.aisa.one/apis/v1/dataforseo/on_page/keyword_density"
payload := strings.NewReader("[\n {\n \"filters\": [\n \"frequency\",\n \">\",\n 5\n ],\n \"id\": \"09101923-1535-0216-0000-2389a8854b70\",\n \"keyword_length\": 2,\n \"url\": \"https://dataforseo.com/\"\n }\n]")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.aisa.one/apis/v1/dataforseo/on_page/keyword_density")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("[\n {\n \"filters\": [\n \"frequency\",\n \">\",\n 5\n ],\n \"id\": \"09101923-1535-0216-0000-2389a8854b70\",\n \"keyword_length\": 2,\n \"url\": \"https://dataforseo.com/\"\n }\n]")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.aisa.one/apis/v1/dataforseo/on_page/keyword_density")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "[\n {\n \"filters\": [\n \"frequency\",\n \">\",\n 5\n ],\n \"id\": \"09101923-1535-0216-0000-2389a8854b70\",\n \"keyword_length\": 2,\n \"url\": \"https://dataforseo.com/\"\n }\n]"
response = http.request(request)
puts response.read_body{
"cost": 123,
"status_code": 123,
"status_message": "<string>",
"tasks_count": 123,
"tasks_error": 123,
"time": "<string>",
"version": "<string>",
"tasks": [
{
"cost": 123,
"data": {},
"id": "<string>",
"path": [
"<string>"
],
"result_count": 123,
"status_code": 123,
"status_message": "<string>",
"time": "<string>",
"result": [
{
"crawl_progress": "<string>",
"crawl_status": {
"max_crawl_pages": 123,
"pages_crawled": 123,
"pages_in_queue": 123
},
"items": [
{
"density": 123,
"frequency": 123,
"keyword": "<string>"
}
],
"items_count": 123,
"total_items_count": 123
}
]
}
]
}keyword_length 选 n-gram 长度。返回 total_items_count、items_count 和 items。实测 611 字节。读的是一次已完成的爬取,因此需要 post_dataforseo_on_page_submit 返回的 id,并会带回 crawl_progress 和 crawl_status(max_crawl_pages、pages_in_queue、pages_crawled)——结果偏少时先看这几个字段,爬取还在跑就是本来没那么多。 它说的是这个站怎么描述自己;要看全网怎么描述它用 post_dataforseo_backlinks_anchors_live,要看人们实际搜什么用 post_dataforseo_keywords_gads_search_volume_live。## 示例
curl -X POST "https://api.aisa.one/apis/v1/dataforseo/on_page/keyword_density" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-d '[{"id": "...", "keyword_length": "...", "url": "..."}]'
// 把整段复制给 Claude Code、Codex、Cursor 或任意 coding agent。
// 连接、授权、跑通这个例子需要的东西都在里面 ——
// 不用粘贴任何 key,浏览器里点一次 Allow 就好。
{
"calls": [
{
"call_id": "1",
"tool": "post_dataforseo_on_page_keyword_density",
"arguments": {}
}
]
}
// ── for the agent ─────────────────────────────────────────────────────────
// Register the AIsa MCP server, then call its `batch_quote` tool with the JSON above.
// name aisa
// endpoint https://mcp.aisa.one/mcp
// transport streamable-http
// auth OAuth. The server publishes RFC 9728 metadata, so open a
// browser and the user clicks Allow once — nothing to paste.
// If AISA_API_KEY is set, send it as a bearer header instead.
// Use your own MCP mechanism, not a hand-edited config file:
// Codex codex mcp add aisa --url https://mcp.aisa.one/mcp
// Claude Code claude mcp add --transport http -s user aisa https://mcp.aisa.one/mcp
// Cursor / VS Code a "url" entry for https://mcp.aisa.one/mcp in the MCP config
// The server reaches https://mcp.aisa.one/servers worth of APIs through a few meta
// tools: search, list_categories, get_details, batch_quote, batch_use.
// search, get_details and batch_quote are free; batch_use is billed per
// call. This operation's full contract — every argument, the response
// shape, the price and the pitfalls — is at
// https://aisa.one/docs/zh/api-reference/dataforseo/post_dataforseo-on-page-keyword-density.md
// Show me the quoted cost. Once I approve, run the same calls with
// batch_use and show me the result.
https://mcp.aisa.one/mcp —— Claude Code、
Codex、Cursor、VS Code 都可以。鉴权走 OAuth:客户端打开浏览器,你点一次
Allow,不需要粘贴任何 key。之后智能体通过几个元工具调用所有端点:
search、list_categories、get_details 和 batch_quote 免费,batch_use
按次计费。各客户端的接入步骤见通过 MCP 连接;实时工具列表和
每次调用的价格见 aisa.one/zh-cn/mcp。请求规范
- 方法与路径: POST /apis/v1/dataforseo/on_page/keyword_density
- 可用状态: enabled
- 请求 URL 模板:
https://api.aisa.one/apis/v1/dataforseo/on_page/keyword_density
{
"operationId": "post_dataforseo_on_page_keyword_density",
"method": "POST",
"path": "/apis/v1/dataforseo/on_page/keyword_density",
"servers": [
{
"url": "https://api.aisa.one"
}
],
"parameters": [],
"security": [
{
"bearerAuth": []
}
],
"requestBody": {
"content": {
"application/json": {
"schema": {
"example": [
{
"filters": [
"frequency",
">",
5
],
"id": "09101923-1535-0216-0000-2389a8854b70",
"keyword_length": 2,
"url": "https://dataforseo.com/"
}
],
"items": {
"oneOf": [
{
"properties": {
"filters": {
"description": "<em>array of results filtering parameters</em><br>optional field<br><strong>you can add several filters at once (8 filters maximum)</strong><br>you should set a logical operator <code>and</code>, <code>or</code> between the conditions<br>the following operators are supported:<br><code>regex</code>, <code>not_regex</code>, <code>=</code>, <code><></code>, <code>in</code>, <code>not_in</code>, <code>like</code>, <code>not_like</code><br>you can use the <code>%</code> operator with <code>like</code> and <code>not_like</code> to match any string of zero or more characters<br>example:<br><code>[\"keyword\",\"=\",\"%seo%\"]</code><p><code>[[\"keyword\",\"=\",\"%seo%\"],<br>\"and\",<br>[\"frequency\",\"<\",\"6\"]]</code><p><code>[[\"keyword\",\"not_like\",\"%seo%\"],<br>\"and\",<br>[[\"frequency\",\">\",\"6\"],\"or\",[\"density\",\">\",\"0.02\"]]]</code><p>The full list of possible filters is available <a href=\"/v3/on_page/filters_and_thresholds/?bash\" target=\"_blank\" rel=\"noopener noreferrer\">by this link.</a>",
"items": {
"anyOf": [
{
"type": "string"
},
{
"type": "number"
},
{
"type": "boolean"
},
{
"additionalProperties": {
"$ref": "#/components/schemas/ProviderF3207D84Cc07_AisaDataforseoFilterJsonValue"
},
"type": [
"object",
"null"
]
},
{
"items": {
"$ref": "#/components/schemas/ProviderF3207D84Cc07_AisaDataforseoFilterJsonValue"
},
"type": "array"
}
],
"description": "JSON representation of filter values and nested expressions. Field names, operators, condition counts and operand compatibility remain provider-validated as documented for each endpoint; this is not a complete filter-language validator."
},
"type": [
"array",
"null"
]
},
"id": {
"description": "<em>ID of the task</em><br><strong>required field</strong><br>you can get this ID in the response of the <a href=\"/v3/on_page/task_post/\">Task POST</a> endpoint<br>example:<br>\"07131248-1535-0216-1000-17384017ad04\"",
"type": "string"
},
"keyword_length": {
"description": "<em>number of words for a keyword</em><br><strong>required field</strong><br>possible values:<br><code>1</code>, <code>2</code>, <code>3</code>, <code>4</code>, <code>5</code>",
"type": "integer"
},
"limit": {
"description": "<em>the maximum number of returned keywords</em><br>optional field<br>default value: <code>100</code><br>maximum value: <code>1000</code>",
"type": [
"integer",
"null"
]
},
"order_by": {
"description": "<em>results sorting rules</em><br>optional field<br>you can use the same values as in the <code>filters</code> array to sort the results<br>possible sorting types:<br><code>asc</code> - results will be sorted in the ascending order<br><code>desc</code> - results will be sorted in the descending order<br>you should use a comma to set up a sorting type<br>example:<br><code>[\"frequency,desc\"]</code><br><strong>note that you can set no more than three sorting rules in a single request</strong><br>you should use a comma to separate several sorting rules<br>example:<br><code>[\"keyword,asc\",\"frequency,desc\"]</code>",
"items": {
"type": "string"
},
"type": [
"array",
"null"
]
},
"tag": {
"description": "<em>user-defined task identifier</em><br>optional field<br><em>the character limit is 255</em><br>you can use this parameter to identify the task and match it with the result<br>you will find the specified <code>tag</code> value in the <code>data</code> object of the response",
"type": [
"string",
"null"
]
},
"url": {
"description": "<em>page URL</em><br>optional field<br><strong>if you do not specify a page here, the results will be provided for the whole website</strong><br>if you use this field, the API response will contain only keywords from the specified page<br>a page should be specified with absolute URL (including <code>http://</code> or <code>https://</code>)",
"type": [
"string",
"null"
]
}
},
"type": "object"
}
],
"type": [
"object",
"null"
]
},
"type": "array"
}
}
}
},
"x-aisa-status": "enabled",
"components": {
"schemas": {
"ProviderF3207D84Cc07_AisaDataforseoFilterJsonValue": {
"anyOf": [
{
"type": "string"
},
{
"type": "number"
},
{
"type": "boolean"
},
{
"additionalProperties": {
"$ref": "#/components/schemas/ProviderF3207D84Cc07_AisaDataforseoFilterJsonValue"
},
"type": [
"object",
"null"
]
},
{
"items": {
"$ref": "#/components/schemas/ProviderF3207D84Cc07_AisaDataforseoFilterJsonValue"
},
"type": "array"
}
],
"description": "JSON representation of filter values and nested expressions. Field names, operators, condition counts and operand compatibility remain provider-validated as documented for each endpoint; this is not a complete filter-language validator."
}
},
"securitySchemes": {
"bearerAuth": {
"scheme": "bearer",
"type": "http"
}
}
}
}
费用与请求规则
按实际用量收费。 默认请求预估费用:$0.012 USD。 最终费用以实际用量为准。 账户适用价格可能不同;支持报价的接口可按实际请求获取报价。授权
请求体
array of results filtering parameters
optional field
you can add several filters at once (8 filters maximum)
you should set a logical operator and, or between the conditions
the following operators are supported:regex, not_regex, =, <>, in, not_in, like, not_like
you can use the % operator with like and not_like to match any string of zero or more characters
example:["keyword","=","%seo%"]
[["keyword","=","%seo%"],"and",["frequency","<","6"]]
[["keyword","not_like","%seo%"],"and",[["frequency",">","6"],"or",["density",">","0.02"]]]
The full list of possible filters is available by this link.
- string
- number
- boolean
- object
- any[]
JSON representation of filter values and nested expressions. Field names, operators, condition counts and operand compatibility remain provider-validated as documented for each endpoint; this is not a complete filter-language validator.
ID of the task
required field
you can get this ID in the response of the Task POST endpoint
example:
"07131248-1535-0216-1000-17384017ad04"
results sorting rules
optional field
you can use the same values as in the filters array to sort the results
possible sorting types:asc - results will be sorted in the ascending orderdesc - results will be sorted in the descending order
you should use a comma to set up a sorting type
example:["frequency,desc"]
note that you can set no more than three sorting rules in a single request
you should use a comma to separate several sorting rules
example:["keyword,asc","frequency,desc"]
[
{
"filters": ["frequency", ">", 5],
"id": "09101923-1535-0216-0000-2389a8854b70",
"keyword_length": 2,
"url": "https://dataforseo.com/"
}
]
响应
Successful operation