Skip to content

armgit / spree

Public Imported from GitHub
0

Open Source Platform for DTC, B2B Commerce, Marketplaces & Omnichannel. REST APIs, TypeScript SDKs, and production-ready Next.js storefront. Self-host it. Own your data. No vendor lock-in. Zero platform fees.

Add Policies API documentation

Damian Legawiec6018ccdc8ea2
diff --git a/docs/api-reference/storefront.yaml b/docs/api-reference/storefront.yaml
index a83946e3a3..9c4a12abca 100644
--- a/docs/api-reference/storefront.yaml
+++ b/docs/api-reference/storefront.yaml
@@ -1357,6 +1357,32 @@ paths:
$ref: '#/components/responses/403Forbidden'
security:
- bearerAuth: []
+ /api/v2/storefront/policies:
+ get:
+ summary: List all Store Policies
+ description: 'Returns a list of Store Policies. This endpoint is only available in Spree 5.2 or later.'
+ tags:
+ - Policies
+ operationId: policies-list
+ responses:
+ '200':
+ $ref: '#/components/responses/PolicyList'
+ security:
+ - bearerAuth: []
+ /api/v2/storefront/policies/{policy_slug}:
+ get:
+ summary: Retrieve a Policy
+ description: 'Returns the details of a specified Policy. This endpoint is only available in Spree 5.2 or later.'
+ tags:
+ - Policies
+ operationId: show-policy
+ responses:
+ '200':
+ $ref: '#/components/responses/Policy'
+ '404':
+ $ref: '#/components/responses/404NotFound'
+ security:
+ - bearerAuth: []
/api/v2/storefront/taxons:
get:
description: 'Returns a list of Taxons. [Read more about Taxons](/developer/core-concepts/products#taxons-and-taxonomies)'
@@ -3006,6 +3032,56 @@ components:
- id
- type
- attributes
+ Policy:
+ type: object
+ title: Policy
+ description: 'Policy represents terms and conditions, privacy policies, and other legal documents that can be displayed on the storefront.'
+ properties:
+ id:
+ type: string
+ example: '1'
+ type:
+ type: string
+ default: policy
+ attributes:
+ type: object
+ properties:
+ name:
+ type: string
+ example: Terms and Conditions
+ description: Display name of the policy
+ slug:
+ type: string
+ example: terms-and-conditions
+ description: URL-friendly identifier for the policy
+ show_in_checkout_footer:
+ type: boolean
+ example: true
+ description: Whether to display this policy in the checkout footer
+ created_at:
+ $ref: '#/components/schemas/Timestamp'
+ updated_at:
+ $ref: '#/components/schemas/Timestamp'
+ body:
+ type: string
+ example: asdrdfas
+ description: Raw text content of the policy
+ nullable: true
+ body_html:
+ type: string
+ example: "<div class=\"trix-content\">\n <div>asdrdfas</div>\n</div>\n"
+ description: HTML formatted content of the policy
+ nullable: true
+ required:
+ - name
+ - slug
+ - show_in_checkout_footer
+ - created_at
+ - updated_at
+ required:
+ - id
+ - type
+ - attributes
Product:
type: object
title: Product
@@ -8207,6 +8283,31 @@ components:
relationships:
checkout_zone_applicable_states:
data: []
+ Policy:
+ description: 200 Success - Returns the `policy` object.
+ content:
+ application/vnd.api+json:
+ schema:
+ type: object
+ properties:
+ data:
+ $ref: '#/components/schemas/Policy'
+ required:
+ - data
+ examples:
+ Policy:
+ value:
+ data:
+ id: '1'
+ type: policy
+ attributes:
+ name: Terms and Conditions
+ slug: terms-and-conditions
+ show_in_checkout_footer: true
+ created_at: '2025-08-12T12:13:09.183Z'
+ updated_at: '2025-08-12T13:27:59.470Z'
+ body: asdrdfas
+ body_html: "<div class=\"trix-content\">\n <div>asdrdfas</div>\n</div>\n"
Taxon:
description: 200 Success - Returns the `taxon` object.
content:
@@ -15179,6 +15280,43 @@ components:
name: Check
description: Pay by check.
preferences: {}
+ PolicyList:
+ description: 200 Success - Returns an array of `policy` objects.
+ content:
+ application/vnd.api+json:
+ schema:
+ type: object
+ properties:
+ data:
+ type: array
+ items:
+ $ref: '#/components/schemas/Policy'
+ required:
+ - data
+ examples:
+ List of Policies:
+ value:
+ data:
+ - id: '1'
+ type: policy
+ attributes:
+ name: Terms and Conditions
+ slug: terms-and-conditions
+ show_in_checkout_footer: true
+ created_at: '2025-08-12T12:13:09.183Z'
+ updated_at: '2025-08-12T13:27:59.470Z'
+ body: asdrdfas
+ body_html: "<div class=\"trix-content\">\n <div>asdrdfas</div>\n</div>\n"
+ - id: '2'
+ type: policy
+ attributes:
+ name: Privacy Policy
+ slug: privacy-policy
+ show_in_checkout_footer: false
+ created_at: '2025-08-12T10:00:00.000Z'
+ updated_at: '2025-08-12T10:00:00.000Z'
+ body: Privacy policy content
+ body_html: "<div class=\"trix-content\">\n <div>Privacy policy content</div>\n</div>\n"
Vendor:
description: 200 Success - Returns the `vendor` object.
content:
@@ -15266,6 +15404,7 @@ tags:
- name: Products
- name: Variants
- name: Stores
+ - name: Policies
- name: Taxons
- name: Vendors
- name: Wishlists
diff --git a/docs/api-reference/storefront/policies/list-all-store-policies.mdx b/docs/api-reference/storefront/policies/list-all-store-policies.mdx
new file mode 100644
index 0000000000..0a78340d32
--- /dev/null
+++ b/docs/api-reference/storefront/policies/list-all-store-policies.mdx
@@ -0,0 +1,3 @@
+---
+openapi: get /api/v2/storefront/policies
+---
\ No newline at end of file
diff --git a/docs/api-reference/storefront/policies/retrieve-a-policy.mdx b/docs/api-reference/storefront/policies/retrieve-a-policy.mdx
new file mode 100644
index 0000000000..7c135a2356
--- /dev/null
+++ b/docs/api-reference/storefront/policies/retrieve-a-policy.mdx
@@ -0,0 +1,3 @@
+---
+openapi: get /api/v2/storefront/policies/{policy_slug}
+---
\ No newline at end of file
diff --git a/docs/docs.json b/docs/docs.json
index 35b888ae37..6e317ed115 100644
--- a/docs/docs.json
+++ b/docs/docs.json
@@ -348,6 +348,13 @@
"api-reference/storefront/stores/return-the-current-store"
]
},
+ {
+ "group": "Policies",
+ "pages": [
+ "api-reference/storefront/policies/list-all-store-policies",
+ "api-reference/storefront/policies/retrieve-a-policy"
+ ]
+ },
{
"group": "Taxons",
"pages": [