Skip to Content

currencies

Retrieve all enabled currencies available in the store.

Query Structure

query { currencies { code name symbol enabled } }

Arguments

This query does not accept any arguments.

ArgumentTypeDescriptionRequiredDefault
This query has no argumentsNoN/A

Return Type

[Currency]

  • Currency object fields:
    • code (String): The ISO currency code (e.g., “USD”, “EUR”).
    • name (String): The full name of the currency (e.g., “United States Dollar”).
    • symbol (String): The currency symbol (e.g., ”$”, ”€”).
    • enabled (Boolean): Indicates if the currency is currently enabled in the store.

Examples

Basic Query

query { currencies { code name } }

Advanced Query

query { currencies { code name symbol enabled } }

Field Selection

query { currencies { code symbol } }

cURL Example

curl -X POST https://www.mystoreurl.com/graphql/0.8.0/ \ -H "Content-Type: application/json" \ -d '{"query":"query { currencies { code name symbol enabled } }"}'

JavaScript Example

async function fetchCurrencies() { const endpoint = "https://www.mystoreurl.com/graphql/0.8.0/"; const query = ` query { currencies { code name symbol enabled } } `; try { const response = await fetch(endpoint, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ query }) }); if (!response.ok) { throw new Error(`Network error: ${response.status} ${response.statusText}`); } const { data, errors } = await response.json(); if (errors) { console.error("GraphQL errors:", errors); return null; } return data.currencies; } catch (error) { console.error("Fetch error:", error); return null; } }

Response Format

The response returns a JSON object with a currencies array containing currency objects:

{ "data": { "currencies": [ { "code": "USD", "name": "United States Dollar", "symbol": "$", "enabled": true }, { "code": "EUR", "name": "Euro", "symbol": "€", "enabled": true } ] } }

Error Handling

Possible error scenarios include:

Error CodeDescriptionHandling Recommendation
400Bad Request - malformed queryVerify query syntax and structure
500Internal Server ErrorRetry after some time or contact support
GraphQL ErrorsValidation or execution errors returned in errors fieldInspect errors array for details and adjust query accordingly

Performance Considerations

  • This query returns all enabled currencies without pagination; the dataset is typically small and performant.
  • Avoid requesting unnecessary fields to reduce response size.
  • Cache results client-side when possible, as currency data changes infrequently.
  • Rate limiting may apply; implement exponential backoff on repeated failures.

Authentication

This API currently does not require authentication. However, authentication requirements may be introduced in future versions. Monitor API updates for any changes to authentication requirements.

Currency

FieldTypeDescription
codeStringISO currency code
nameStringFull currency name
symbolStringCurrency symbol
enabledBooleanWhether the currency is enabled

Notes

  • The enabled field indicates if the currency is currently active in the store.
  • Use this query to dynamically populate currency options in your storefront or admin tools.
  • Since no arguments are accepted, the query always returns all enabled currencies.
Last updated on