Skip to content

REST API

REST API in the polski/v1/ namespace. Manage settings, legal checkboxes, legal pages and product search.

The API requires authentication for data-modifying endpoints (POST, PUT, DELETE). The search endpoint (/search) is publicly accessible.

Supported authentication methods:

  • Application Passwords (WordPress 5.6+) - recommended
  • Cookie + nonce - for requests from the admin panel
  • Basic Auth (with the Basic Auth plugin) - for development only

Required permission: manage_woocommerce (default Administrator and Shop Manager roles).

Retrieves all plugin setting groups.

Permissions: manage_woocommerce

Example request:

Okno terminala
curl -u admin:XXXX-XXXX-XXXX-XXXX \
"https://yourstore.com/wp-json/polski/v1/settings"

Example response:

{
"groups": [
{
"id": "general",
"label": "General settings",
"description": "Basic plugin configuration"
},
{
"id": "compliance",
"label": "Legal requirements",
"description": "EU and Polish law requirements settings"
},
{
"id": "storefront",
"label": "Storefront modules",
"description": "Store extension modules"
},
{
"id": "checkout",
"label": "Checkout and orders",
"description": "Checkout and order process settings"
}
]
}

Retrieves settings from a selected group.

URL parameters:

ParameterTypeDescription
groupstringSetting group ID

Permissions: manage_woocommerce

Example request:

Okno terminala
curl -u admin:XXXX-XXXX-XXXX-XXXX \
"https://yourstore.com/wp-json/polski/v1/settings/compliance"

Example response:

{
"group": "compliance",
"settings": {
"omnibus_enabled": true,
"omnibus_days": 30,
"gpsr_enabled": true,
"withdrawal_enabled": true,
"withdrawal_days": 14,
"dsa_enabled": true,
"ksef_enabled": false,
"greenwashing_enabled": true
}
}

Updates settings in a selected group.

Permissions: manage_woocommerce

Example request:

Okno terminala
curl -X POST \
-u admin:XXXX-XXXX-XXXX-XXXX \
-H "Content-Type: application/json" \
-d '{"omnibus_days": 30, "withdrawal_days": 14}' \
"https://yourstore.com/wp-json/polski/v1/settings/compliance"

Example response:

{
"updated": true,
"group": "compliance",
"changes": {
"omnibus_days": 30,
"withdrawal_days": 14
}
}

Retrieves a list of all legal checkboxes (checkout, registration, contact).

Permissions: manage_woocommerce

Example response:

{
"checkboxes": [
{
"id": 1,
"label": "I accept the store terms and conditions",
"required": true,
"location": "checkout",
"enabled": true,
"position": 10,
"legal_page_id": 45
},
{
"id": 2,
"label": "I have read the privacy policy",
"required": true,
"location": "checkout",
"enabled": true,
"position": 20,
"legal_page_id": 47
}
],
"total": 2
}

Retrieves checkbox acceptance statistics.

Permissions: manage_woocommerce

Example response:

{
"stats": [
{
"checkbox_id": 1,
"label": "I accept the store terms and conditions",
"total_shown": 1250,
"total_accepted": 1180,
"acceptance_rate": 94.4
}
]
}

Retrieves details of a single checkbox.

URL parameters:

ParameterTypeDescription
idintCheckbox ID

Permissions: manage_woocommerce

Example response:

{
"id": 1,
"label": "I accept the store terms and conditions",
"required": true,
"location": "checkout",
"enabled": true,
"position": 10,
"legal_page_id": 45,
"created_at": "2025-01-15T10:30:00",
"updated_at": "2025-06-01T14:22:00",
"stats": {
"total_shown": 1250,
"total_accepted": 1180,
"acceptance_rate": 94.4
}
}

Updates a checkbox.

Permissions: manage_woocommerce

Example request:

Okno terminala
curl -X PUT \
-u admin:XXXX-XXXX-XXXX-XXXX \
-H "Content-Type: application/json" \
-d '{"label": "I accept the terms", "required": true}' \
"https://yourstore.com/wp-json/polski/v1/checkboxes/1"

Retrieves a list of legal pages (terms, privacy policy, etc.).

Permissions: manage_woocommerce

Example response:

{
"pages": [
{
"id": 45,
"type": "terms",
"title": "Store terms and conditions",
"status": "publish",
"url": "https://yourstore.com/terms/",
"last_modified": "2025-06-01T14:00:00",
"word_count": 3200
},
{
"id": 47,
"type": "privacy",
"title": "Privacy policy",
"status": "publish",
"url": "https://yourstore.com/privacy-policy/",
"last_modified": "2025-05-15T09:30:00",
"word_count": 2800
}
],
"total": 2
}

Generates a legal page based on a template.

Permissions: manage_woocommerce

Body parameters:

ParameterTypeRequiredDescription
typestringYesPage type: terms, privacy, withdrawal, dsa_report
company_namestringYesCompany name
company_addressstringYesCompany address
emailstringYesContact email address
phonestringNoPhone number
nipstringNoCompany NIP

Example request:

Okno terminala
curl -X POST \
-u admin:XXXX-XXXX-XXXX-XXXX \
-H "Content-Type: application/json" \
-d '{"type": "terms", "company_name": "My Store Sp. z o.o.", "company_address": "ul. Przykladowa 1, 00-001 Warsaw", "email": "[email protected]"}' \
"https://yourstore.com/wp-json/polski/v1/legal-pages/generate"

Example response:

{
"page_id": 120,
"type": "terms",
"title": "Store terms and conditions",
"url": "https://yourstore.com/terms/",
"status": "draft"
}

Product search (public endpoint).

Query parameters:

ParameterTypeRequiredDescription
qstringYesSearch phrase
limitintNoResults limit (default 8)
catintNoCategory ID

Permissions: public (no authentication required)

Example request:

Okno terminala
curl "https://yourstore.com/wp-json/polski/v1/search?q=shoes&limit=5"

Example response:

{
"results": [
{
"id": 456,
"title": "Nike Sports Shoes",
"url": "https://yourstore.com/product/nike-sports-shoes/",
"image": "https://yourstore.com/wp-content/uploads/nike-shoes.jpg",
"price_html": "<span class=\"amount\">299.00&nbsp;PLN</span>",
"category": "Footwear",
"in_stock": true,
"rating": 4.8
}
],
"total": 1,
"query": "shoes"
}

Marks the configuration wizard as completed.

Permissions: manage_woocommerce

Body parameters:

ParameterTypeRequiredDescription
steps_completedarrayYesList of completed steps

Example request:

Okno terminala
curl -X POST \
-u admin:XXXX-XXXX-XXXX-XXXX \
-H "Content-Type: application/json" \
-d '{"steps_completed": ["company_info", "legal_pages", "checkboxes", "compliance"]}' \
"https://yourstore.com/wp-json/polski/v1/wizard/complete"

Example response:

{
"completed": true,
"completed_at": "2025-06-15T12:00:00",
"steps": {
"company_info": true,
"legal_pages": true,
"checkboxes": true,
"compliance": true
}
}
CodeDescription
200Success
201Resource created (POST)
400Bad request (missing parameters)
401Not authenticated
403Insufficient permissions
404Resource not found
500Server error

Each endpoint supports a WordPress filter allowing response modification:

add_filter('polski/rest/settings_response', function (array $response, WP_REST_Request $request): array {
// Modify the response
return $response;
}, 10, 2);

The API does not implement its own rate limiting. Using a plugin or server configuration (e.g. Cloudflare, Nginx rate limiting) is recommended for public endpoints.

Report issues: github.com/wppoland/polski/issues

This page is for informational purposes only and does not constitute legal advice. Consult a lawyer before implementation. Polski for WooCommerce is open source software (GPLv2) provided without warranty.