{
  "openapi": "3.0.3",
  "info": {
    "title": "Daily Search Volume API",
    "version": "1.0.0",
    "description": "REST API for daily Google keyword search volume, keyword tracking, CSV exports, and JSON time series from DailySearchVolume.com.",
    "contact": {
      "name": "DailySearchVolume.com",
      "email": "shaun@dailysearchvolume.com",
      "url": "https://www.dailysearchvolume.com/api"
    }
  },
  "servers": [
    {
      "url": "https://www.dailysearchvolume.com",
      "description": "Production"
    }
  ],
  "tags": [
    {
      "name": "Keyword data",
      "description": "Daily keyword search volume and forecast time series."
    },
    {
      "name": "Keyword tracking",
      "description": "Manage tracked keywords for an authenticated account."
    }
  ],
  "security": [
    {
      "ApiKeyHeader": []
    },
    {
      "ApiKeyQuery": []
    }
  ],
  "components": {
    "securitySchemes": {
      "ApiKeyHeader": {
        "type": "apiKey",
        "in": "header",
        "name": "X-API-KEY"
      },
      "ApiKeyQuery": {
        "type": "apiKey",
        "in": "query",
        "name": "apikey"
      }
    },
    "parameters": {
      "ApiKeyQuery": {
        "name": "apikey",
        "in": "query",
        "required": false,
        "description": "DailySearchVolume.com API key. You can also send X-API-KEY as an HTTP header.",
        "schema": {
          "type": "string"
        }
      },
      "KeywordPath": {
        "name": "keyword",
        "in": "path",
        "required": true,
        "description": "URL-encoded keyword phrase.",
        "schema": {
          "type": "string",
          "example": "dropshipping"
        }
      },
      "KeywordQuery": {
        "name": "keyword",
        "in": "query",
        "required": true,
        "description": "Keyword phrase to add or retrieve.",
        "schema": {
          "type": "string",
          "example": "dropshipping"
        }
      },
      "LocalePath": {
        "name": "locale",
        "in": "path",
        "required": true,
        "description": "Keyword locale such as en-us, en-gb, en-ca, de-de, or all-all.",
        "schema": {
          "type": "string",
          "example": "en-us"
        }
      },
      "LocaleQuery": {
        "name": "locale",
        "in": "query",
        "required": true,
        "description": "Keyword locale such as en-us, en-gb, en-ca, de-de, or all-all.",
        "schema": {
          "type": "string",
          "example": "en-us"
        }
      },
      "ResponseType": {
        "name": "type",
        "in": "query",
        "required": false,
        "description": "Response format. Use json for structured arrays or csv for date,volume rows.",
        "schema": {
          "type": "string",
          "enum": [
            "json",
            "csv"
          ],
          "default": "json"
        }
      }
    },
    "schemas": {
      "DateVolumePoint": {
        "type": "array",
        "description": "A two-item point: ISO date string and integer search volume.",
        "minItems": 2,
        "maxItems": 2,
        "items": {
          "oneOf": [
            {
              "type": "string",
              "format": "date"
            },
            {
              "type": "integer"
            }
          ]
        },
        "example": [
          "2026-05-28",
          4322
        ]
      },
      "KeywordSeriesResponse": {
        "type": "object",
        "properties": {
          "existing": {
            "type": "array",
            "description": "Historical daily values as [date, volume].",
            "items": {
              "$ref": "#/components/schemas/DateVolumePoint"
            }
          },
          "predicted": {
            "type": "array",
            "description": "Predicted daily values as [date, volume].",
            "items": {
              "$ref": "#/components/schemas/DateVolumePoint"
            }
          }
        },
        "example": {
          "existing": [
            [
              "2026-05-28",
              4322
            ],
            [
              "2026-05-29",
              4456
            ]
          ],
          "predicted": [
            [
              "2026-05-30",
              4512
            ],
            [
              "2026-05-31",
              4580
            ]
          ]
        }
      },
      "KeywordMapping": {
        "type": "object",
        "properties": {
          "keyword": {
            "type": "string",
            "example": "dropshipping"
          },
          "locale": {
            "type": "string",
            "example": "en-us"
          },
          "group": {
            "type": "string",
            "example": "ecommerce"
          }
        }
      },
      "StatusResponse": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "example": "All 1 keywords were added."
          }
        }
      },
      "MonthlyDataResponse": {
        "type": "object",
        "properties": {
          "avg_monthly_searches": {
            "type": "integer",
            "example": 5400
          }
        }
      },
      "ErrorResponse": {
        "type": "object",
        "properties": {
          "error": {
            "type": "string",
            "example": "not authenticated"
          }
        }
      }
    }
  },
  "paths": {
    "/keyword_data/{locale}/{keyword}": {
      "get": {
        "tags": [
          "Keyword data"
        ],
        "summary": "Get daily keyword search volume",
        "description": "Returns historical daily search volume and predicted daily values for a tracked keyword. Public keywords can be fetched without a key; private/account keywords require authentication.",
        "parameters": [
          {
            "$ref": "#/components/parameters/LocalePath"
          },
          {
            "$ref": "#/components/parameters/KeywordPath"
          },
          {
            "$ref": "#/components/parameters/ResponseType"
          },
          {
            "$ref": "#/components/parameters/ApiKeyQuery"
          }
        ],
        "responses": {
          "200": {
            "description": "Keyword time series in JSON, or CSV when type=csv.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/KeywordSeriesResponse"
                }
              },
              "text/csv": {
                "schema": {
                  "type": "string",
                  "example": "date,volume\n2026-05-28,4322\n2026-05-29,4456\n"
                }
              }
            }
          }
        }
      }
    },
    "/get_keyword": {
      "get": {
        "tags": [
          "Keyword data"
        ],
        "summary": "Get daily keyword search volume using query parameters",
        "description": "Legacy-compatible query-parameter form of the keyword data endpoint.",
        "parameters": [
          {
            "$ref": "#/components/parameters/KeywordQuery"
          },
          {
            "$ref": "#/components/parameters/LocaleQuery"
          },
          {
            "$ref": "#/components/parameters/ResponseType"
          },
          {
            "$ref": "#/components/parameters/ApiKeyQuery"
          }
        ],
        "responses": {
          "200": {
            "description": "Keyword time series.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/KeywordSeriesResponse"
                }
              }
            }
          }
        }
      }
    },
    "/monthly_data": {
      "get": {
        "tags": [
          "Keyword data"
        ],
        "summary": "Get average monthly search volume",
        "description": "Returns the average monthly search volume for an authenticated keyword.",
        "parameters": [
          {
            "$ref": "#/components/parameters/KeywordQuery"
          },
          {
            "$ref": "#/components/parameters/LocaleQuery"
          },
          {
            "$ref": "#/components/parameters/ApiKeyQuery"
          }
        ],
        "responses": {
          "200": {
            "description": "Average monthly search volume.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MonthlyDataResponse"
                }
              }
            }
          }
        }
      }
    },
    "/add_keyword": {
      "post": {
        "tags": [
          "Keyword tracking"
        ],
        "summary": "Add a tracked keyword",
        "description": "Adds a keyword to the authenticated account and queues daily volume collection. Send parameters on a POST request as form data or query parameters.",
        "parameters": [
          {
            "$ref": "#/components/parameters/ApiKeyQuery"
          },
          {
            "$ref": "#/components/parameters/KeywordQuery"
          },
          {
            "$ref": "#/components/parameters/LocaleQuery"
          },
          {
            "name": "group",
            "in": "query",
            "required": false,
            "description": "Optional keyword group label.",
            "schema": {
              "type": "string",
              "example": "ecommerce"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Keyword add status.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StatusResponse"
                }
              }
            }
          }
        }
      }
    },
    "/submit_keywords": {
      "post": {
        "tags": [
          "Keyword tracking"
        ],
        "summary": "Submit one or more tracked keywords",
        "description": "Adds one keyword with keyword, locale, and optional group fields, or accepts a newline-separated keywords payload in keyword,locale,group format.",
        "requestBody": {
          "required": true,
          "content": {
            "application/x-www-form-urlencoded": {
              "schema": {
                "type": "object",
                "properties": {
                  "keyword": {
                    "type": "string",
                    "example": "dropshipping"
                  },
                  "locale": {
                    "type": "string",
                    "example": "en-us"
                  },
                  "group": {
                    "type": "string",
                    "example": "ecommerce"
                  },
                  "keywords": {
                    "type": "string",
                    "example": "dropshipping,en-us,ecommerce\nai tools,en-us,technology"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Keyword add status.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StatusResponse"
                }
              }
            }
          }
        }
      }
    },
    "/list_keywords": {
      "get": {
        "tags": [
          "Keyword tracking"
        ],
        "summary": "List tracked keywords",
        "description": "Returns the authenticated account keyword list as JSON or CSV.",
        "parameters": [
          {
            "$ref": "#/components/parameters/ResponseType"
          },
          {
            "$ref": "#/components/parameters/ApiKeyQuery"
          }
        ],
        "responses": {
          "200": {
            "description": "Tracked keywords.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/KeywordMapping"
                  }
                }
              },
              "text/csv": {
                "schema": {
                  "type": "string",
                  "example": "keyword,locale,group\ndropshipping,en-us,ecommerce\n"
                }
              }
            }
          }
        }
      }
    }
  }
}
