
Robots.txt Generator API
Web Development
Create SEO-optimized robots.txt files instantly. Control search engine crawlers and improve your site's indexing with AI-powered generation.
Authentication
Send your API key in the Authorization header as a Bearer token (Authorization: Bearer YOUR_API_KEY) or in the X-API-Key header.
Rate Limit
10 requests per minute
Endpoints
1 endpoint available
Overview
Send a domain and plain-language crawl rules (what to block or allow, for which bots, where the sitemap is) and get back robots.txt content.
Notes
domainis up to 253 characters andrequirementsup to 5,000. Nothing is fetched from the domain.- robots.txt is advice to well-behaved crawlers. It does not hide or protect pages.
This endpoint calls an AI model, so it uses the AI rate limit: 10 requests per minute and 200 requests per day per API key. Output is generated by a model and can be wrong, so review it before you use it.
Endpoints
POST
https://opentools.ca/api/v1/tools/robots-txt-generatorGenerate robots.txt content
Request Body
Content-Type: application/json
| Parameter | Type | Required | Description |
|---|---|---|---|
| domain | string | Required | Your site domain, e.g. "example.com". 1-253 characters. |
| requirements | string | Required | Crawl rules in plain language. 1-5,000 characters. |
Response Example
{
"success": true,
"domain": "example.com",
"robotsTxt": "User-agent: *\nDisallow: /admin\nDisallow: /checkout\n\nUser-agent: GPTBot\nDisallow: /\n\nSitemap: https://example.com/sitemap.xml"
}Error Codes
400
Invalid JSON or a field failed validation (missing, empty, too long, or not an allowed value). details lists each problem.401
Missing or invalid API key403
API key is inactive or expired, or the request IP is not allowed for this key429
Rate limit exceeded (10 per minute or 200 per day per key)500
Internal server error, including a failed AI model callCode Examples
curl -X POST https://opentools.ca/api/v1/tools/robots-txt-generator \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"domain": "example.com",
"requirements": "Block /admin and /checkout for all bots, block GPTBot entirely, and point to the sitemap at /sitemap.xml"
}'Rather use it in your browser? Open the Robots.txt Generator