WooCommerce REST API Legacy Documentation
repository·trunk·Indexed 41 days ago
https://github.com/woocommerce/woocommerce-rest-api-docsLegacy documentation for the WooCommerce REST API, including details for v1 and v2. Covers endpoints for coupons, customers, orders, products, and sales reports, as well as configuration for JSON/XML response formats and JSON-P. Note: This documentation is deprecated in favor of the official WooCommerce developer portal.
What's inside WooCommerce REST API
- The System Status Tools API allows you to view and execute diagnostic or maintenance tools available within the WooCommerce system status interface. You can list available tools, retrieve specific tool details, or trigger a tool's action.
Manage order refunds via the REST API
trunkThe Order Refunds API provides endpoints to create, view, and delete individual refunds associated with an existing order. Refunds are treated as separate resources linked to a parent order.Manage Payment Gateways via the WooCommerce REST API
trunkThe Payment Gateways API allows you to view and update individual payment gateways. Note that results for this endpoint are not paginated; all available gateways will be returned in a single response.Manage Order Notes via REST API
trunkThe Order Notes API allows you to create, view, and delete individual order notes. Order notes are used by administrators or programmatically to store data about an order or specific order events. You can distinguish between internal admin notes and customer-facing notes using thecustomer_noteproperty.Locate current WooCommerce REST API documentation
trunkThis repository is deprecated and is only maintained for legacy purposes. For the most up-to-date and current WooCommerce REST API documentation, visit the official developer portal at: https://developer.woocommerce.com/docs/apis/rest-api/Manage Product Attribute Terms
trunkThe Product Attribute Terms API allows you to perform CRUD (Create, Read, Update, Delete) operations on individual attribute terms or perform batch updates. Attribute terms are the specific values within a product attribute (e.g., 'Red' or 'Blue' within the 'Color' attribute).Manage customers via the WooCommerce REST API
trunkThe Customer API allows you to perform CRUD operations on customer resources. You can create, view, update, and delete individual customers or process them in batches.Manage product variations via the WooCommerce REST API
trunkThe Product Variations API allows you to perform CRUD operations (Create, Read, Update, Delete) on individual product variations or perform batch operations. Variations are sub-resources of products that allow for different combinations of attributes (like size or color) with unique pricing, stock, and dimensions.Manage Tax Classes via the WooCommerce REST API
trunkThe Tax Classes API allows you to create, view, and delete individual tax classes.
Tax Class Properties
When interacting with tax classes, you will encounter the following properties:
Attribute Type Description slugstring Unique identifier for the resource (read-only). namestring Tax class name (required). Use Webhook Topics to trigger events
trunkA topic is a combination of a resource and an event. When you create a webhook using a core topic name, the appropriate hooks are automatically added.
Core Topics:
- Coupons:
coupon.created,coupon.updated,coupon.deleted - Customers:
customer.created,customer.updated,customer.deleted - Orders:
order.created,order.updated,order.deleted - Products:
product.created,product.updated,product.deleted
Custom Topics: You can use custom topics that map to a single hook name. For example, a topic named
action.woocommerce_add_to_cartwill trigger on that specific event. Custom topics pass the first hook argument directly into the payload (e.g., thecart_item_keywould be included).- Coupons:
Handle API pagination and Link headers
trunkRequests returning multiple items are paginated. By default, 10 items are returned per page (configurable via the site's
posts_per_pageoption).Pagination Controls:
?filter[limit]=N: Specify items per page.?page=N: Specify the page number (1-based; omitting returns the first page).?filter[offset]=N: Specify the offset from the first resource.
Metadata and Navigation:
- HTTP Headers: The total number of resources is provided in
X-WC-Totaland the total pages inX-WC-TotalPages. - Link Header: Pagination URLs are provided in the standard RFC 5988 Link header. It is recommended to use these provided URLs rather than constructing your own. Supported
relvalues include:next: URL for the immediate next page.last: URL for the last page.first: URL for the first page.prev: URL for the immediate previous page.
Link: <https://www.example.com/wc-api/v1/products?page=2>; rel="next", <https://www.example.com/wc-api/v1/products?page=3>; rel="last"Understand the Index JSON response structure
trunkThe Index response contains a
storeobject with the following primary sections:URL: The base URL of the store.description: The store description.meta: Configuration settings such ascurrency,timezone,tax_included, andweight_unit.routes: A map of available API endpoints. Each route entry includes:meta: Metadata for the route (e.g.,selflink).supports: An array of supported HTTP methods (e.g.,GET,POST,PUT,DELETE).accepts_data: A boolean indicating if the endpoint accepts data payloads.
wc_version: The version of WooCommerce running on the store.
{ "store": { "URL": "http://example.com", "description": "", "meta": { "currency": "USD", "timezone": "America/Sao_Paulo" // ... other meta fields }, "routes": { "/products": { "accepts_data": true, "meta": { "self": "http://example.com/wc-api/v2/products" }, "supports": ["HEAD", "GET", "POST"] } // ... other routes }, "wc_version": "2.3.13" } }