# 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="coupons-v1-acfwp" %}
[coupons-v1-acfwp](https://rymera.gitbook.io/advanced-coupons-api/coupons-v1-acfwp)
{% endcontent-ref %}

{% content-ref url="loyalty-program-v1-lpfw" %}
[loyalty-program-v1-lpfw](https://rymera.gitbook.io/advanced-coupons-api/loyalty-program-v1-lpfw)
{% endcontent-ref %}

{% content-ref url="wc-store-credits-v1" %}
[wc-store-credits-v1](https://rymera.gitbook.io/advanced-coupons-api/wc-store-credits-v1)
{% 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.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://rymera.gitbook.io/advanced-coupons-api/master.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
