Get robots.txt rules
client.aiAudit.robots.get(RobotGetParams { zone_id, subdomain } params, RequestOptionsoptions?): RobotGetResponse { userAgents, sitemaps, status }
GET/zones/{zone_id}/ai-audit/robots
Fetches and parses the robots.txt file for a zone or a specific subdomain within the zone. Returns parsed user-agent rules, content signals, and sitemaps.
Security
API Token
The preferred authorization scheme for interacting with the Cloudflare API. Create a token.
Example:
API Email + API Key
The previous authorization scheme for interacting with the Cloudflare API, used in conjunction with a Global API key.
Example:
The previous authorization scheme for interacting with the Cloudflare API. When possible, use API tokens instead of Global API keys.
Example:
Accepted Permissions (at least one required)
Get robots.txt rules
import Cloudflare from 'cloudflare';
const client = new Cloudflare({
apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted
});
const robot = await client.aiAudit.robots.get({ zone_id: 'zone_id' });
console.log(robot.userAgents);{
"errors": [],
"messages": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"success": true,
"result": {
"userAgents": {
"foo": {
"allow": [
"string"
],
"disallow": [
"string"
],
"contentSignals": {
"ai-input": "yes",
"ai-train": "yes",
"search": "yes"
},
"crawlDelay": 0
}
},
"sitemaps": [
"string"
],
"status": 0
}
}Returns Examples
{
"errors": [],
"messages": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"success": true,
"result": {
"userAgents": {
"foo": {
"allow": [
"string"
],
"disallow": [
"string"
],
"contentSignals": {
"ai-input": "yes",
"ai-train": "yes",
"search": "yes"
},
"crawlDelay": 0
}
},
"sitemaps": [
"string"
],
"status": 0
}
}