> For the complete documentation index, see [llms.txt](https://rymera.gitbook.io/advanced-coupons-api/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://rymera.gitbook.io/advanced-coupons-api/master.md).

# REST API

**Advanced Coupons** creates it own namespace and endpoints by extending the default [WordPress REST API](https://developer.wordpress.org/rest-api/).

## Namespaces

{% content-ref url="/pages/-MdFjhk156lz532hYAZH" %}
[coupons/v1](/advanced-coupons-api/coupons-v1-acfwp.md)
{% endcontent-ref %}

{% content-ref url="/pages/-MkpJkXNWcSwa-xncaE4" %}
[loyalty-program/v1](/advanced-coupons-api/loyalty-program-v1-lpfw.md)
{% endcontent-ref %}

{% content-ref url="/pages/8weiewtLm3sBps3F7zOn" %}
[wc-store-credits/v1](/advanced-coupons-api/wc-store-credits-v1.md)
{% endcontent-ref %}

## Authentication

The plugin uses WordPress REST API [cookie authentication](https://developer.wordpress.org/rest-api/using-the-rest-api/authentication/#cookie-authentication) in the admin app.

For remote applications (e.g Postman), you will need to authenticate using either of the following options:

* &#x20;[OAuth 1.0a Server](https://wordpress.org/plugins/rest-api-oauth1/)
* &#x20;[Application Passwords](https://wordpress.org/plugins/application-passwords/)
* &#x20;[JSON Web Tokens](https://wordpress.org/plugins/jwt-authentication-for-wp-rest-api/)
* &#x20;[Basic Authentication](https://github.com/WP-API/Basic-Auth) (this should only be used for testing purposes only, and should not be recommended for production)

## Permissions

Permissions are managed via [WordPress user roles and capabilities](https://wordpress.org/support/article/roles-and-capabilities/). Each endpoint and its respective method varies depending of the use case of said endpoint.

For endpoints which purpose is for the admin side may only be accessed by user roles that has the `manage_woocommerce` user capability. (Administrator, Shop Manager, etc.)

For endpoints which contains private data for the current user, it will at least require the user to have an authenticated logged in status. This is checked via [`is_user_logged_in`](https://developer.wordpress.org/reference/functions/is_user_logged_in/) function.

For endpoints that will need to be used globally (settings) will not require any authentication for reads, but will need to have the `manage_woocommerce` user capability for doing create, update and delete actions.
