POSTrandom-phone-generate
隨機手機號碼生成
批次生成符合各國規則的隨機手機號,支援中國、美國、日本等多國,可指定運營商及格式,單次最多100條,滿足多語言系統的測試需求。
1 匠幣/次
批次生成符合各國規則的隨機手機號,支援中國、美國、日本等多國,可指定運營商及格式,單次最多100條,滿足多語言系統的測試需求。
1 匠幣/次
count:生成數量,單次最多 100 條。country:國家或地區程式碼(如 CN 代表中國)。operator:運營商型別(如 all 表示不限,或指定特定運營商)。includeDialCode:是否在號碼前附加國際區號(如 +86)。formatWithDash:是否使用連字元(-)對號碼進行格式化分隔。data 欄位將返回一個字串陣列,包含按指定規則生成的隨機手機號碼列表。提供 Shell、Python、Go、Java、PHP 等常見接入示例,便於直接接到現有專案裡。
{
"count": 10,
"country": "CN",
"operator": "all",
"includeDialCode": false,
"formatWithDash": false
}{
"code": "SUCCESS",
"message": "success",
"data": [
"13812345678",
"15987654321"
]
}以下欄位根據示例 JSON 自動提取,僅作接入參考。
| 欄位路徑 | 型別 | 示例值 |
|---|---|---|
| count | number | 10 |
| country | string | CN |
| operator | string | all |
| includeDialCode | boolean | false |
| formatWithDash | boolean | false |
以下欄位根據示例 JSON 自動提取,僅作接入參考。
| 欄位路徑 | 型別 | 示例值 |
|---|---|---|
| code | string | SUCCESS |
| message | string | success |
| data | array | "13812345678" |
| data[] | string | 13812345678 |
curl --request POST \
--url 'https://openapi.toolkk.com/v1/random-phone-generate' \
--header 'Content-Type: application/json' \
--header 'X-API-Key: YOUR_API_KEY' \
--data '{\n "count": 10,\n "country": "CN",\n "operator": "all",\n "includeDialCode": false,\n "formatWithDash": false\n}'import os
import requests
url = "https://openapi.toolkk.com/v1/random-phone-generate"
payload = {
"count": 10,
"country": "CN",
"operator": "all",
"includeDialCode": false,
"formatWithDash": false
}
headers = {
"Content-Type": "application/json",
"X-API-Key": os.getenv("TOOLKK_API_KEY", "YOUR_API_KEY"),
}
response = requests.request("POST", url, headers=headers, json=payload, timeout=30)
response.raise_for_status()
print(response.json())package main
import (
"bytes"
"fmt"
"io"
"net/http"
)
func main() {
endpoint := "https://openapi.toolkk.com/v1/random-phone-generate"
payload := []byte("{\n \"count\": 10,\n \"country\": \"CN\",\n \"operator\": \"all\",\n \"includeDialCode\": false,\n \"formatWithDash\": false\n}")
req, err := http.NewRequest("POST", endpoint, bytes.NewBuffer(payload))
if err != nil {
panic(err)
}
req.Header.Set("Content-Type", "application/json")
req.Header.Set("X-API-Key", "YOUR_API_KEY")
resp, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
body, err := io.ReadAll(resp.Body)
if err != nil {
panic(err)
}
fmt.Println(string(body))
}import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class ToolkkExample {
public static void main(String[] args) throws Exception {
String payload = "{\n \"count\": 10,\n \"country\": \"CN\",\n \"operator\": \"all\",\n \"includeDialCode\": false,\n \"formatWithDash\": false\n}";
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://openapi.toolkk.com/v1/random-phone-generate"))
.method("POST", HttpRequest.BodyPublishers.ofString(payload))
.header("Content-Type", "application/json")
.header("X-API-Key", "YOUR_API_KEY")
.build();
HttpResponse<String> response = HttpClient.newHttpClient()
.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
}<?php
$endpoint = 'https://openapi.toolkk.com/v1/random-phone-generate';
$payload = "{\n \"count\": 10,\n \"country\": \"CN\",\n \"operator\": \"all\",\n \"includeDialCode\": false,\n \"formatWithDash\": false\n}";
$ch = curl_init($endpoint);
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_HTTPHEADER => [
'Content-Type: application/json',
'X-API-Key: YOUR_API_KEY',
],
CURLOPT_POSTFIELDS => $payload,
]);
$response = curl_exec($ch);
if ($response === false) {
throw new RuntimeException(curl_error($ch));
}
curl_close($ch);
echo $response;