policies
Get store policies including terms and conditions, privacy policy, shipping policy, and refund policy.
Query Structure
query {
policies {
termsAndConditions {
title
body
url
}
privacyPolicy {
title
body
url
}
shippingPolicy {
title
body
url
}
refundPolicy {
title
body
url
}
}
}
Arguments
Argument | Type | Description | Required | Default |
---|---|---|---|---|
None | This query does not accept any arguments. | No | N/A |
Return Type
StorePolicies
An object containing the store’s policies. Each policy field is optional and returns a Policy object with the following fields:
Field | Type | Description |
---|---|---|
termsAndConditions | Policy | Terms and conditions of the store. |
privacyPolicy | Policy | Privacy policy of the store. |
shippingPolicy | Policy | Shipping policy of the store. |
refundPolicy | Policy | Refund policy of the store. |
Policy
Field | Type | Description |
---|---|---|
title | String | Title of the policy document. |
body | String | Full text content of the policy. |
url | String | URL to the policy page on the store. |
Examples
Basic Query
query {
policies {
termsAndConditions {
title
body
}
}
}
Advanced Query
query {
policies {
termsAndConditions {
title
body
url
}
privacyPolicy {
title
body
url
}
shippingPolicy {
title
body
url
}
refundPolicy {
title
body
url
}
}
}
Field Selection
query {
policies {
privacyPolicy {
title
url
}
refundPolicy {
title
body
}
}
}
cURL Example
curl -X POST https://www.mystoreurl.com/graphql/0.8.0/ \
-H "Content-Type: application/json" \
-d '{"query":"query { policies { termsAndConditions { title body url } } }"}'
JavaScript Example
async function fetchStorePolicies() {
const query = `
query {
policies {
termsAndConditions {
title
body
url
}
privacyPolicy {
title
body
url
}
shippingPolicy {
title
body
url
}
refundPolicy {
title
body
url
}
}
}
`;
try {
const response = await fetch('https://www.mystoreurl.com/graphql/0.8.0/', {
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;
}
console.log('Store Policies:', data.policies);
} catch (error) {
console.error('Fetch error:', error);
}
}
fetchStorePolicies();
Response Format
{
"data": {
"policies": {
"termsAndConditions": {
"title": "Terms and Conditions",
"body": "These are the terms and conditions...",
"url": "https://www.mystoreurl.com/terms"
},
"privacyPolicy": {
"title": "Privacy Policy",
"body": "This is the privacy policy...",
"url": "https://www.mystoreurl.com/privacy"
},
"shippingPolicy": {
"title": "Shipping Policy",
"body": "Details about shipping...",
"url": "https://www.mystoreurl.com/shipping"
},
"refundPolicy": {
"title": "Refund Policy",
"body": "Information about refunds...",
"url": "https://www.mystoreurl.com/refund"
}
}
}
}
Error Handling
Error Code | Description | Handling Recommendation |
---|---|---|
400 Bad Request | The query is malformed or contains invalid fields. | Check query syntax and field names. |
500 Internal Server Error | Unexpected server error occurred. | Retry after some time; contact support if persists. |
200 OK with errors field | GraphQL-level errors such as invalid queries or unavailable fields. | Inspect errors array in response and adjust query accordingly. |
Performance Considerations
- The
policies
query returns static content that rarely changes, so it is safe to cache responses on the client or CDN to reduce load and improve response times. - Since no arguments are accepted, caching is straightforward and can be done globally.
- Rate limiting may apply on the API server; avoid excessive polling by caching results and refreshing only when necessary.
- The response size depends on the length of policy bodies; request only the fields needed to optimize payload size.
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.
Related Types
Type | Description |
---|---|
StorePolicies | Container for all store policy documents. |
Policy | Represents an individual policy document with title, body, and URL. |
Notes
- All policy fields (
termsAndConditions
,privacyPolicy
,shippingPolicy
,refundPolicy
) are optional and may benull
if not set by the store. - Use field selection to request only the policies relevant to your application to optimize performance.
- URLs provided in policy fields link to the store’s public-facing policy pages for user reference.
Last updated on