{
  "openapi": "3.0.3",
  "info": {
    "title": "Ahrefs API",
    "version": "1.0.0",
    "description": "Ahrefs SEO and backlink data routed through the AIsa gateway. Covers Site Explorer domain authority (Domain Rating) and core site metrics (organic/paid keywords, organic traffic, traffic value). Proxies the Ahrefs API v3 Site Explorer endpoints."
  },
  "servers": [
    { "url": "https://api.aisa.one/apis/v1" }
  ],
  "security": [
    { "BearerAuth": [] }
  ],
  "paths": {
    "/ahrefs/site-explorer/domain-rating": {
      "get": {
        "x-aisa-pricing": {
          "model": "per_request",
          "currency": "USD",
          "price_usd": 0.08,
          "cost_tier": "med",
          "note": "self / already-verified-domain lookups bill ~$0.02 (reduced-unit floor); $0.08 otherwise"
        },
        "summary": "Domain Rating",
        "description": "Return the Ahrefs Domain Rating (0-100 authority score) and Ahrefs Rank for a target domain on a given date. Billed $0.02 per successful call; 4xx/5xx are not charged.",
        "operationId": "get_ahrefs_domain_rating",
        "parameters": [
          {
            "name": "target",
            "in": "query",
            "required": true,
            "description": "Target domain, e.g. `ahrefs.com`.",
            "schema": { "type": "string" }
          },
          {
            "name": "date",
            "in": "query",
            "required": true,
            "description": "Snapshot date in `YYYY-MM-DD` format.",
            "schema": { "type": "string", "format": "date", "example": "2026-08-01" }
          }
        ],
        "responses": {
          "200": {
            "description": "Domain Rating result.",
            "content": {
              "application/json": {
                "example": { "domain_rating": { "domain_rating": 91.0, "ahrefs_rank": 619 } },
                "schema": {
                  "type": "object",
                  "properties": {
                    "domain_rating": {
                      "type": "object",
                      "properties": {
                        "domain_rating": { "type": "number", "description": "Domain Rating (0-100)." },
                        "ahrefs_rank": { "type": "integer", "description": "Global Ahrefs Rank." }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/ahrefs/site-explorer/metrics": {
      "get": {
        "x-aisa-pricing": {
          "model": "per_request",
          "currency": "USD",
          "price_usd": 0.18,
          "cost_tier": "med"
        },
        "summary": "Site Metrics",
        "description": "Return core Site Explorer metrics for a target domain on a given date: organic and paid keyword counts, top-3 keyword count, organic traffic, and traffic value. Billed $0.18 per successful call; 4xx/5xx are not charged.",
        "operationId": "get_ahrefs_site_metrics",
        "parameters": [
          {
            "name": "target",
            "in": "query",
            "required": true,
            "description": "Target domain, e.g. `ahrefs.com`.",
            "schema": { "type": "string" }
          },
          {
            "name": "date",
            "in": "query",
            "required": true,
            "description": "Snapshot date in `YYYY-MM-DD` format.",
            "schema": { "type": "string", "format": "date", "example": "2026-08-01" }
          }
        ],
        "responses": {
          "200": {
            "description": "Core site metrics.",
            "content": {
              "application/json": {
                "example": {
                  "metrics": {
                    "org_keywords": 1843000,
                    "paid_keywords": 6790,
                    "org_keywords_1_3": 412000,
                    "org_traffic": 20413900,
                    "org_cost": 42474500
                  }
                },
                "schema": {
                  "type": "object",
                  "properties": {
                    "metrics": {
                      "type": "object",
                      "properties": {
                        "org_keywords": { "type": "integer", "description": "Organic keyword count." },
                        "paid_keywords": { "type": "integer", "description": "Paid keyword count." },
                        "org_keywords_1_3": { "type": "integer", "description": "Organic keywords ranking in top 3." },
                        "org_traffic": { "type": "integer", "description": "Estimated monthly organic traffic." },
                        "org_cost": { "type": "integer", "description": "Estimated organic traffic value." }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "BearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "AISA API Key"
      }
    }
  }
}
