{
  "openapi": "3.0.1",
  "info": {
    "title": "Tennis Player Stats & H2H Scraper — ATP, WTA Match History",
    "description": "Head-to-head records and full match history for any ATP, WTA, Challenger or ITF player from Sofascore. Give names, IDs or pairs like \"Sinner vs Alcaraz\": get every meeting, the tally by surface, and each player's results with scores, opponents and rankings. Optional serve stats and odds. No API key.",
    "version": "1.0",
    "x-build-id": "bLiubvL4eg6EZlCXy"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/incognito_mode~tennis-player-stats-h2h-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-incognito_mode-tennis-player-stats-h2h-scraper",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/acts/incognito_mode~tennis-player-stats-h2h-scraper/runs": {
      "post": {
        "operationId": "runs-sync-incognito_mode-tennis-player-stats-h2h-scraper",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor and returns information about the initiated run in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/runsResponseSchema"
                }
              }
            }
          }
        }
      }
    },
    "/acts/incognito_mode~tennis-player-stats-h2h-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-incognito_mode-tennis-player-stats-h2h-scraper",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "inputSchema": {
        "type": "object",
        "properties": {
          "players": {
            "title": "Players",
            "type": "array",
            "description": "Players whose recent match history you want, one per line. Each line can be a full name (\"Iga Swiatek\"), a Sofascore player ID (\"206570\") or a Sofascore player URL (\"https://www.sofascore.com/team/tennis/sinner-jannik/206570\"). Full names are safest: a surname shared by two players (\"Zverev\") picks the more followed one and logs a warning. Returns one row per finished singles match, newest first.",
            "items": {
              "type": "string"
            }
          },
          "matchups": {
            "title": "Head-to-head pairs",
            "type": "array",
            "description": "Pairs to compare, one per line, written \"Player A vs Player B\" (\"v\", \"-\" and \"x\" also work, with spaces around them). Each side accepts a name, ID or URL like \"Players\". Returns every finished meeting between the two, from player A's side, numbered oldest first, plus one free summary row (rowType \"h2h\") with the overall and per-surface tally.",
            "items": {
              "type": "string"
            }
          },
          "maxMatchesPerPlayer": {
            "title": "Matches per player",
            "minimum": 0,
            "type": "integer",
            "description": "How many of each player's most recent matches to return, counted after the filters below (so 50 with Surface = grass is the 50 most recent grass matches). 0 returns the whole career, up to about 700 matches for a top player. Does not limit head-to-head pairs, which always return every meeting.",
            "default": 50
          },
          "maxItems": {
            "title": "Maximum match rows",
            "minimum": 1,
            "type": "integer",
            "description": "Hard cap on match rows stored (and charged) across the whole run. Head-to-head summary rows are free and not counted. If the cap cuts a pair short, that pair's summary row is left out rather than showing a partial tally.",
            "default": 1000
          },
          "dateFrom": {
            "title": "From date",
            "type": "string",
            "description": "Only matches on or after this date: YYYY-MM-DD, or relative such as \"1 year\" or \"6 months\" (counted back from today). Applies to player history and to head-to-head pairs."
          },
          "dateTo": {
            "title": "To date",
            "type": "string",
            "description": "Only matches on or before this date (inclusive), same formats as \"From date\"."
          },
          "surface": {
            "title": "Surface",
            "type": "array",
            "description": "Keep only matches on these surfaces. Empty = all surfaces.",
            "items": {
              "type": "string",
              "enum": [
                "hard",
                "clay",
                "grass",
                "carpet"
              ],
              "enumTitles": [
                "Hard (indoor and outdoor)",
                "Clay",
                "Grass",
                "Carpet"
              ]
            },
            "default": []
          },
          "tourLevels": {
            "title": "Tour level",
            "type": "array",
            "description": "Keep only these levels. Empty = all of them: ATP, WTA, Challenger, ITF and team events (exhibitions are controlled separately below). For a tour-level-only head-to-head, choose ATP or WTA plus Team events.",
            "items": {
              "type": "string",
              "enum": [
                "atp",
                "wta",
                "challenger",
                "itf",
                "team"
              ],
              "enumTitles": [
                "ATP (incl. Grand Slams)",
                "WTA (incl. Grand Slams and WTA 125)",
                "Challenger",
                "ITF (men and women)",
                "Team events (Davis Cup, Billie Jean King Cup, United Cup)"
              ]
            },
            "default": []
          },
          "includeExhibitions": {
            "title": "Include exhibitions and UTR events",
            "type": "boolean",
            "description": "Exhibitions and UTR events are left out by default because they are not competitive tour matches. Turn on to include them.",
            "default": false
          },
          "matchDetails": {
            "title": "Match details (optional, paid add-ons)",
            "type": "array",
            "description": "Extra data per match, one request each. Statistics: serve, return, points and games per player for the match and each set. Odds: opening and closing decimal odds for match winner, first set and total games. Charged only for matches where Sofascore has the data.",
            "items": {
              "type": "string",
              "enum": [
                "statistics",
                "odds"
              ],
              "enumTitles": [
                "Match statistics",
                "Odds"
              ]
            },
            "default": []
          },
          "proxyConfiguration": {
            "title": "Proxy configuration",
            "type": "object",
            "description": "Leave off. Requests go to Sofascore directly, which costs nothing. If an IP is blocked, the Actor switches on its own to a datacenter proxy (in every Apify plan) and only then to residential. Set this only to pin a specific proxy from the start.",
            "default": {
              "useApifyProxy": false
            }
          }
        }
      },
      "runsResponseSchema": {
        "type": "object",
        "properties": {
          "data": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "actId": {
                "type": "string"
              },
              "userId": {
                "type": "string"
              },
              "startedAt": {
                "type": "string",
                "format": "date-time",
                "example": "2025-01-08T00:00:00.000Z"
              },
              "finishedAt": {
                "type": "string",
                "format": "date-time",
                "example": "2025-01-08T00:00:00.000Z"
              },
              "status": {
                "type": "string",
                "example": "READY"
              },
              "meta": {
                "type": "object",
                "properties": {
                  "origin": {
                    "type": "string",
                    "example": "API"
                  },
                  "userAgent": {
                    "type": "string"
                  }
                }
              },
              "stats": {
                "type": "object",
                "properties": {
                  "inputBodyLen": {
                    "type": "integer",
                    "example": 2000
                  },
                  "rebootCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "restartCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "resurrectCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "computeUnits": {
                    "type": "integer",
                    "example": 0
                  }
                }
              },
              "options": {
                "type": "object",
                "properties": {
                  "build": {
                    "type": "string",
                    "example": "latest"
                  },
                  "timeoutSecs": {
                    "type": "integer",
                    "example": 300
                  },
                  "memoryMbytes": {
                    "type": "integer",
                    "example": 1024
                  },
                  "diskMbytes": {
                    "type": "integer",
                    "example": 2048
                  }
                }
              },
              "buildId": {
                "type": "string"
              },
              "defaultKeyValueStoreId": {
                "type": "string"
              },
              "defaultDatasetId": {
                "type": "string"
              },
              "defaultRequestQueueId": {
                "type": "string"
              },
              "buildNumber": {
                "type": "string",
                "example": "1.0.0"
              },
              "containerUrl": {
                "type": "string"
              },
              "usage": {
                "type": "object",
                "properties": {
                  "ACTOR_COMPUTE_UNITS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_WRITES": {
                    "type": "integer",
                    "example": 1
                  },
                  "KEY_VALUE_STORE_LISTS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_INTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_EXTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_SERPS": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_UNBLOCKER_UNITS": {
                    "type": "integer",
                    "example": 0
                  }
                }
              },
              "usageTotalUsd": {
                "type": "number",
                "example": 0.00005
              },
              "usageUsd": {
                "type": "object",
                "properties": {
                  "ACTOR_COMPUTE_UNITS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_WRITES": {
                    "type": "number",
                    "example": 0.00005
                  },
                  "KEY_VALUE_STORE_LISTS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_INTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_EXTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_SERPS": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_UNBLOCKER_UNITS": {
                    "type": "integer",
                    "example": 0
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}