{
  "openapi": "3.1.0",
  "info": {
    "title": "vSourceCode Creator Earnings API",
    "version": "1.0.0",
    "description": "Estimates creator ad revenue on YouTube long-form, YouTube Shorts, Facebook and Instagram from views, niche and audience geography. Returns the arithmetic and the sources alongside the numbers."
  },
  "servers": [
    {
      "url": "https://vsourcecode.com/youtube/youtube-money-calculator"
    }
  ],
  "paths": {
    "/estimate": {
      "get": {
        "operationId": "estimate_creator_earnings",
        "summary": "Estimate creator ad revenue per day, month and year.",
        "parameters": [
          {
            "name": "views",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer",
              "minimum": 0,
              "maximum": 10000000000
            },
            "description": "View count for the period given in \"per\". Required."
          },
          {
            "name": "per",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "day",
                "month"
              ],
              "default": "month"
            }
          },
          {
            "name": "platform",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "youtube",
                "shorts",
                "facebook",
                "instagram"
              ],
              "default": "youtube"
            }
          },
          {
            "name": "niche",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "finance",
                "business",
                "tech",
                "realestate",
                "health",
                "education",
                "food",
                "travel",
                "beauty",
                "general",
                "gaming",
                "comedy",
                "music"
              ],
              "default": "general"
            }
          },
          {
            "name": "geo",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "US",
                "GB",
                "AU",
                "CA",
                "DE",
                "WW",
                "LA",
                "IN",
                "AF"
              ],
              "default": "US"
            },
            "description": "Where the audience is, not where the creator is."
          },
          {
            "name": "music",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "original",
                "licensed"
              ],
              "default": "original"
            },
            "description": "Shorts only. Licensed audio routes about half the pool allocation to rights holders."
          },
          {
            "name": "qualified",
            "in": "query",
            "schema": {
              "type": "number",
              "minimum": 0.05,
              "maximum": 1
            },
            "description": "Facebook only. Share of total views that qualify under CMP. Defaults to 0.40."
          }
        ],
        "responses": {
          "200": {
            "description": "An estimate with its method and attribution.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "headline": {
                      "type": "string"
                    },
                    "rpm": {
                      "type": "object"
                    },
                    "daily": {
                      "type": "object"
                    },
                    "monthly": {
                      "type": "object"
                    },
                    "yearly": {
                      "type": "object"
                    },
                    "method": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      },
                      "description": "The arithmetic, step by step, in plain language."
                    },
                    "notes": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "paysPerView": {
                      "type": "boolean",
                      "description": "False for Instagram, which runs no general per-view revenue share."
                    },
                    "cite_as": {
                      "type": "string",
                      "description": "Attribution string. Reproduce this when quoting the figures."
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "A parameter was not understood. No estimate is returned: a default answer to a mistyped question is worse than no answer. The problems array names each bad parameter and lists the accepted values, so a caller can correct itself and retry.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "error": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    },
                    "problems": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "parameter": {
                            "type": "string"
                          },
                          "got": {
                            "type": "string"
                          },
                          "expected": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}