金価格 API
金、銀、プラチナ、パラジウム、銅のリアルタイム価格、為替レート、日次履歴、ローソク足を、APIキーを使ったシンプルなGETリクエストで取得できます。
リファレンス
- ベースURL
- https://goldapi.dev/api/v1
- 認証
- X-API-Key ヘッダーにキーを指定
- レスポンス形式
- JSON
- 無料プラン
- 1時間あたり100リクエスト、カード不要
curl --fail-with-body --max-time 10 "https://goldapi.dev/api/v1/price/XAU/USD" \ -H "X-API-Key: $API_KEY"const res = await fetch("https://goldapi.dev/api/v1/price/XAU/USD", { headers: { "X-API-Key": process.env.API_KEY }, signal: AbortSignal.timeout(10_000),});if (!res.ok) throw new Error("HTTP " + res.status);console.log(await res.json());import os, requestsres = requests.get( "https://goldapi.dev/api/v1/price/XAU/USD", headers={"X-API-Key": os.environ["API_KEY"]}, timeout=10,)res.raise_for_status()print(res.json())package mainimport ( "fmt" "io" "net/http" "os" "time")func main() { client := http.Client{Timeout: 10 * time.Second} req, err := http.NewRequest("GET", "https://goldapi.dev/api/v1/price/XAU/USD", nil) if err != nil { panic(err) } req.Header.Set("X-API-Key", os.Getenv("API_KEY")) res, err := client.Do(req) if err != nil { panic(err) } defer res.Body.Close() body, err := io.ReadAll(res.Body) if err != nil { panic(err) } if res.StatusCode != 200 { panic(fmt.Sprintf("HTTP %d: %s", res.StatusCode, body)) } fmt.Println(string(body))}import java.io.IOException;import java.net.URI;import java.net.http.HttpClient;import java.net.http.HttpRequest;import java.net.http.HttpResponse;import java.time.Duration;public class Main { public static void main(String[] args) throws Exception { HttpRequest request = HttpRequest.newBuilder(URI.create("https://goldapi.dev/api/v1/price/XAU/USD")) .header("X-API-Key", System.getenv("API_KEY")) .timeout(Duration.ofSeconds(10)) .build(); HttpResponse<String> response = HttpClient.newHttpClient() .send(request, HttpResponse.BodyHandlers.ofString()); if (response.statusCode() != 200) throw new IOException("HTTP " + response.statusCode()); System.out.println(response.body()); }}import Foundationvar request = URLRequest(url: URL(string: "https://goldapi.dev/api/v1/price/XAU/USD")!)request.setValue(ProcessInfo.processInfo.environment["API_KEY"], forHTTPHeaderField: "X-API-Key")request.timeoutInterval = 10let (data, response) = try await URLSession.shared.data(for: request)guard (response as? HTTPURLResponse)?.statusCode == 200 else { throw URLError(.badServerResponse) }print(String(data: data, encoding: .utf8)!)$context = stream_context_create(["http" => [ "header" => "X-API-Key: " . getenv("API_KEY"), "timeout" => 10,]]);$body = file_get_contents("https://goldapi.dev/api/v1/price/XAU/USD", false, $context);if ($body === false) throw new RuntimeException("Request failed");echo $body;レスポンス 200
{
"symbol": "XAU",
"name": "Gold",
"currency": "USD",
"unit": "oz",
"price": 4072.1,
"gram": 130.921,
"karat": 24,
"updatedAt": "2026-11-07T02:39:06+02:00"
}
用途ごとのエンドポイント
アプリのための金属データ
実用ガイド
よくある質問
金価格APIは無料ですか?
はい。Freeには、1時間あたり100リクエスト、金、銀、銅、プラチナ、パラジウムのリアルタイムのスポット価格、為替レートが含まれます。クレジットカードは不要です。Freeは見えるリンクを付ければ商用利用できます。
商品価格データの取得に適したAPIですか?
はい。すべてのプランに、金、銀、銅、プラチナ、パラジウムのリアルタイムのスポット価格と他通貨への換算が含まれます。月額$8のBasicでは日次履歴も利用できます。
APIはどのデータソースを使っていますか?
スポット価格は当社の市場データソースから取得します。他通貨の価格はUSDスポット×リアルタイム為替レートで、EGP建ての金はエジプトの現地市場にも連動します。各レスポンスには計算時刻が含まれます。
商用利用できますか?
すべてのプランで商用利用できます。Freeでは価格の近くにgoldapi.devへの見えるリンクが必要です。データ自体の再配布や再販売には別途契約が必要です。[email protected]までお問い合わせください。