> For clean Markdown of any page, append .md to the page URL. > For a complete documentation index, see https://docs.holidays.rest/holidays-rest-api/country/llms.txt. > For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.holidays.rest/_mcp/server. # country GET https://api.holidays.rest/v1/country/{countryID} This endpoint retrieves a specific country, including its subdivisions. You can use the `alpha2` code to retrieve public holidays of a region when calling the `holidays` endpoint. Reference: https://docs.holidays.rest/holidays-rest-api/country ## Authentication - `Authorization` header (bearer token, required) — Bearer authentication of the form `Bearer `, where token is your auth token. ## Request ### Path parameters - `countryID` (string, required) — (Required) Country code in ISO-3166 alpha-2 format ## Response ### 200 OK - `name` (string, required) - `long_name` (string, required) - `region` (string, required) - `subregion` (string, required) - `world_region` (string, required) - `alpha2` (string, required) - `subdivisions` (list of V1CountryCountryIdGetResponsesContentApplicationJsonSchemaSubdivisionsItems, required) ## Errors ### 401 Unauthorized Error Unauthorized - `error` (string, required) ## Types ### V1CountryCountryIdGetResponsesContentApplicationJsonSchemaSubdivisionsItems - `name` (string, required) - `alpha2` (string, required) ## Examples **Response** ```json { "name": "United States of America", "long_name": "The United States of America", "region": "Americas", "subregion": "Northern America", "world_region": "AMER", "alpha2": "US", "subdivisions": [ { "name": "Alaska", "alpha2": "AK" }, { "name": "Alabama", "alpha2": "AL" }, { "name": "Arkansas", "alpha2": "AR" }, { "name": "American Samoa", "alpha2": "AS" }, { "name": "Arizona", "alpha2": "AZ" }, { "name": "California", "alpha2": "CA" }, { "name": "Colorado", "alpha2": "CO" }, { "name": "Connecticut", "alpha2": "CT" }, { "name": "District of Columbia", "alpha2": "DC" }, { "name": "Delaware", "alpha2": "DE" }, { "name": "Florida", "alpha2": "FL" }, { "name": "Georgia", "alpha2": "GA" }, { "name": "Guam", "alpha2": "GU" }, { "name": "Hawaii", "alpha2": "HI" }, { "name": "Iowa", "alpha2": "IA" }, { "name": "Idaho", "alpha2": "ID" }, { "name": "Illinois", "alpha2": "IL" }, { "name": "Indiana", "alpha2": "IN" }, { "name": "Kansas", "alpha2": "KS" }, { "name": "Kentucky", "alpha2": "KY" }, { "name": "Louisiana", "alpha2": "LA" }, { "name": "Massachusetts", "alpha2": "MA" }, { "name": "Maryland", "alpha2": "MD" }, { "name": "Maine", "alpha2": "ME" }, { "name": "Michigan", "alpha2": "MI" }, { "name": "Minnesota", "alpha2": "MN" }, { "name": "Missouri", "alpha2": "MO" }, { "name": "Northern Mariana Islands", "alpha2": "MP" }, { "name": "Mississippi", "alpha2": "MS" }, { "name": "Montana", "alpha2": "MT" }, { "name": "North Carolina", "alpha2": "NC" }, { "name": "North Dakota", "alpha2": "ND" }, { "name": "Nebraska", "alpha2": "NE" }, { "name": "New Hampshire", "alpha2": "NH" }, { "name": "New Jersey", "alpha2": "NJ" }, { "name": "New Mexico", "alpha2": "NM" }, { "name": "Nevada", "alpha2": "NV" }, { "name": "New York", "alpha2": "NY" }, { "name": "Ohio", "alpha2": "OH" }, { "name": "Oklahoma", "alpha2": "OK" }, { "name": "Oregon", "alpha2": "OR" }, { "name": "Pennsylvania", "alpha2": "PA" }, { "name": "Puerto Rico", "alpha2": "PR" }, { "name": "Rhode Island", "alpha2": "RI" }, { "name": "South Carolina", "alpha2": "SC" }, { "name": "South Dakota", "alpha2": "SD" }, { "name": "Tennessee", "alpha2": "TN" }, { "name": "Texas", "alpha2": "TX" }, { "name": "United States Minor Outlying Islands", "alpha2": "UM" }, { "name": "Utah", "alpha2": "UT" }, { "name": "Virginia", "alpha2": "VA" }, { "name": "Virgin Islands, U.S.", "alpha2": "VI" }, { "name": "Vermont", "alpha2": "VT" }, { "name": "Washington", "alpha2": "WA" }, { "name": "Wisconsin", "alpha2": "WI" }, { "name": "West Virginia", "alpha2": "WV" }, { "name": "Wyoming", "alpha2": "WY" } ] } ``` **SDK Code** ```python country_example import requests url = "https://api.holidays.rest/v1/country/US" headers = {"Authorization": "Bearer "} response = requests.get(url, headers=headers) print(response.json()) ``` ```javascript country_example const url = 'https://api.holidays.rest/v1/country/US'; const options = {method: 'GET', headers: {Authorization: 'Bearer '}}; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go country_example package main import ( "fmt" "net/http" "io" ) func main() { url := "https://api.holidays.rest/v1/country/US" req, _ := http.NewRequest("GET", url, nil) req.Header.Add("Authorization", "Bearer ") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` ```ruby country_example require 'uri' require 'net/http' url = URI("https://api.holidays.rest/v1/country/US") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Get.new(url) request["Authorization"] = 'Bearer ' response = http.request(request) puts response.read_body ``` ```java country_example import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.get("https://api.holidays.rest/v1/country/US") .header("Authorization", "Bearer ") .asString(); ``` ```php country_example request('GET', 'https://api.holidays.rest/v1/country/US', [ 'headers' => [ 'Authorization' => 'Bearer ', ], ]); echo $response->getBody(); ``` ```csharp country_example using RestSharp; var client = new RestClient("https://api.holidays.rest/v1/country/US"); var request = new RestRequest(Method.GET); request.AddHeader("Authorization", "Bearer "); IRestResponse response = client.Execute(request); ``` ```swift country_example import Foundation let headers = ["Authorization": "Bearer "] let request = NSMutableURLRequest(url: NSURL(string: "https://api.holidays.rest/v1/country/US")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "GET" request.allHTTPHeaderFields = headers let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ```