Get Country
About
The country query retrieves detailed information about a single country by its ID. Use this query to:
- Display country-specific information and settings
- Fetch all states/provinces for a country
- Get country translations for multi-language support
- Populate address forms with state options for a selected country
- Build country-specific pages and configurations
- Display country-specific shipping rules
- Render localized country and state names
This query returns comprehensive country data including all states with translations and country translations for multiple languages.
Arguments
| Argument | Type | Description |
|---|---|---|
id | ID! | Country ID in format "106" or "/api/shop/countries/106". |
Possible Returns
| Field | Type | Description |
|---|---|---|
id | ID! | Unique country API identifier. |
_id | Int! | Numeric country ID. |
code | String! | ISO 3166-1 alpha-2 country code (e.g., 'US', 'GB', 'AE'). |
name | String! | Country name in default language. |
states | CountryStateCollection! | States/provinces for this country. |
states.edges | [Edge!]! | State edges with cursors. |
states.edges.node | CountryState! | Individual state information. |
states.edges.node.id | ID! | State API identifier. |
states.edges.node._id | Int! | Numeric state ID. |
states.edges.node.code | String | State code (e.g., 'CA' for California). |
states.edges.node.defaultName | String! | State name in default language. |
states.edges.node.countryId | Int! | Associated country ID. |
states.edges.node.countryCode | String! | Associated country code. |
states.edges.node.translations | StateTranslationCollection! | All state translations. |
states.edges.node.translations.edges | [Edge!]! | Translation edges. |
states.edges.node.translations.edges.node.id | ID! | Translation ID. |
states.edges.node.translations.edges.node.locale | String! | Language locale code. |
states.edges.node.translations.edges.node.defaultName | String! | Translated state name. |
states.pageInfo | PageInfo! | Pagination info for states. |
states.pageInfo.hasNextPage | Boolean! | More states available. |
states.pageInfo.endCursor | String | Last state cursor. |
states.totalCount | Int! | Total states for this country. |
translations | CountryTranslationCollection! | All country translations. |
translations.edges | [Edge!]! | Translation edges with cursors. |
translations.edges.node | CountryTranslation! | Individual translation. |
translations.edges.node.id | ID! | Translation identifier. |
translations.edges.node._id | Int! | Numeric translation ID. |
translations.edges.node.locale | String! | Language locale code. |
translations.edges.node.name | String! | Country name in locale language. |
translations.edges.cursor | String! | Pagination cursor. |
translations.pageInfo | PageInfo! | Pagination info for translations. |
translations.totalCount | Int! | Total translations for this country. |
Use Cases
1. Address Form State Selection
Use the "With States" example to populate state dropdown when user selects a country.
2. Multi-Language Display
Use the "With Translations" example to display country name in user's language.
3. Country Details Page
Use the "Complete Details" example for a comprehensive country information display.
Best Practices
- Cache Country Data - Country information rarely changes, cache the response
- Load States Dynamically - Fetch states when user selects a country in forms
- Include Translations - Always fetch translations for multi-language support
- Handle No States - Some countries have no states configured, handle gracefully
- Use Correct ID - Use numeric ID format "106" or full API path
Related Resources
- Countries - Get all countries with pagination
- Country States - Get states for a country
- Country State - Get single state by ID
- Pagination Guide - Cursor pagination documentation
- Shop API Overview - Overview of Shop API resources

