curl -H "X-FH-APIKEY: $FINHAY_API_KEY" \
"https://open-api.fhsc.com.vn/market/indices/VN30/constituents"import requests
url = "https://open-api.fhsc.com.vn/market/indices/{symbol}/constituents"
headers = {"X-FH-APIKEY": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'X-FH-APIKEY': '<api-key>'}};
fetch('https://open-api.fhsc.com.vn/market/indices/{symbol}/constituents', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://open-api.fhsc.com.vn/market/indices/{symbol}/constituents",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"X-FH-APIKEY: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://open-api.fhsc.com.vn/market/indices/{symbol}/constituents"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("X-FH-APIKEY", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://open-api.fhsc.com.vn/market/indices/{symbol}/constituents")
.header("X-FH-APIKEY", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://open-api.fhsc.com.vn/market/indices/{symbol}/constituents")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["X-FH-APIKEY"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"data": {
"index": "VN30",
"items": [
{
"symbol": "VCB",
"name": "Ngân hàng TMCP Ngoại thương Việt Nam",
"exchange": "HOSE",
"weight_percent": 12.41,
"market_cap": 512000000000000,
"price": 92500,
"change_percent": 1.09
}
],
"page": 1,
"page_size": 20,
"total": 30,
"updated_at": "2026-08-17T14:30:15+07:00"
},
"error_code": "0",
"message": "success"
}{
"error_code": "400",
"message": "Invalid parameter"
}{
"error_code": "401",
"message": "Invalid signature"
}{
"error_code": "404",
"message": "Not found"
}{
"error_code": "429",
"message": "Too many requests"
}{
"error_code": "500",
"message": "Internal server error"
}Rổ cấu phần chỉ số
Các mã trong rổ một chỉ số kèm tỷ trọng theo vốn hoá, vốn hoá, giá khớp gần nhất và thay đổi %.
VN30 / HNX30 trả đúng rổ chọn lọc; VNINDEX / HNXINDEX / UPCOMINDEX là chỉ số toàn thị trường nên trả mọi mã niêm yết trên sàn tương ứng — hai con số total không so sánh trực tiếp được với nhau.
curl -H "X-FH-APIKEY: $FINHAY_API_KEY" \
"https://open-api.fhsc.com.vn/market/indices/VN30/constituents"import requests
url = "https://open-api.fhsc.com.vn/market/indices/{symbol}/constituents"
headers = {"X-FH-APIKEY": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'X-FH-APIKEY': '<api-key>'}};
fetch('https://open-api.fhsc.com.vn/market/indices/{symbol}/constituents', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://open-api.fhsc.com.vn/market/indices/{symbol}/constituents",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"X-FH-APIKEY: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://open-api.fhsc.com.vn/market/indices/{symbol}/constituents"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("X-FH-APIKEY", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://open-api.fhsc.com.vn/market/indices/{symbol}/constituents")
.header("X-FH-APIKEY", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://open-api.fhsc.com.vn/market/indices/{symbol}/constituents")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["X-FH-APIKEY"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"data": {
"index": "VN30",
"items": [
{
"symbol": "VCB",
"name": "Ngân hàng TMCP Ngoại thương Việt Nam",
"exchange": "HOSE",
"weight_percent": 12.41,
"market_cap": 512000000000000,
"price": 92500,
"change_percent": 1.09
}
],
"page": 1,
"page_size": 20,
"total": 30,
"updated_at": "2026-08-17T14:30:15+07:00"
},
"error_code": "0",
"message": "success"
}{
"error_code": "400",
"message": "Invalid parameter"
}{
"error_code": "401",
"message": "Invalid signature"
}{
"error_code": "404",
"message": "Not found"
}{
"error_code": "429",
"message": "Too many requests"
}{
"error_code": "500",
"message": "Internal server error"
}Authorizations
API key dài hạn của client. Cấu hình 1 lần lúc khởi tạo; có thể wire thẳng
vào static setter của SDK tự-gen. Đi kèm với FINHAY_API_SECRET — secret
này chỉ dùng ở phía client để tính X-FH-SIGNATURE, không bao giờ
gửi qua mạng.
Path Parameters
Mã chỉ số. Chỉ các chỉ số có membership tra được mới dùng được ở nhóm endpoint này; chỉ số quốc tế không được hỗ trợ.
VNINDEX, HNXINDEX, UPCOMINDEX, VN30, HNX30 "VNINDEX"
Query Parameters
Field sắp xếp, thêm - ở đầu để giảm dần. Mặc định -weight_percent. Field hợp lệ: weight_percent, market_cap, change_percent, symbol.
weight_percent, -weight_percent, market_cap, -market_cap, change_percent, -change_percent, symbol, -symbol "-weight_percent"
Trang cần lấy, bắt đầu từ 1.
x >= 11
Số mã mỗi trang, tối đa 50.
1 <= x <= 5020
Response
data.items là danh sách mã trong rổ.
Các field chung của envelope trong mọi response của Finhay API.
error_codelà"0"(string) khi thành công, mã khác"0"khi lỗi.messagelà thông điệp ngắn từ server.