> For the complete documentation index, see [llms.txt](https://developers.nilog.net/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developers.nilog.net/developers/wp-generate-rest-api-keys.md).

# WP Generate Rest API keys

Setting Up the Development Environment

## Website Config

Before we start, make sure you have installed **WordPress** and **WooCommerce** and your website is up and running. If you have not installed WordPress yet, start from here: <https://wordpress.org>

#### For WooCommerce Required Plugins

* [WooCommerce](https://wordpress.org/plugins/woocommerce/) *Free*
* **App Builder** *License Key*

### **Step 1: Configuration of your WordPress website**

If you’re using non-pretty permalinks in WooCommerce, the REST API will not work. Configure pretty permalinks in **Settings > Permalinks** so that the custom endpoints are supported.

![Config WordPress permalinks settings.](https://1203622060-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M5gbs4Rt-qUiBJUDBmv%2F-MeOwRo0S4_hs_AyVvQJ%2F-MeOwhYWfYB79m1lBwNW%2Fconfig-woocommerce-website.jpg?alt=media\&token=71e93b5f-afdb-422f-957a-b0639dc44b39)

### **Step 2: Configuring WooCommerce**

Pre-generated keys can be used to authenticate use of the REST API endpoints. New keys can be generated either through the WordPress admin interface or they can be auto-generated through an endpoint.

**Generating API keys in the WordPress admin interface**

Note: We not require WRITE permission READ is enough.

To create or manage keys for a specific WordPress user, go to **WooCommerce > Settings > Advanced => REST API>** Keys/Apps.

![Generating API keys.](https://1203622060-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M5gbs4Rt-qUiBJUDBmv%2F-MeOwRo0S4_hs_AyVvQJ%2F-MeOwzBW5rlD88swjkyy%2Fconfig-woocommerce-website02.jpg?alt=media\&token=a71715cd-f6a6-422f-a569-e3a04bcb5b8c)

Click the “**Add Key**” button. In the next screen, add a description and select the WordPress user you would like to generate the key for. Use of the REST API with the generated keys will confirm to that user’s WordPress roles and capabilities.

Choose the level of access for this REST API key, which can be Read access, Write access or Read/Write access. Then click the “Generate API Key” button and WooCommerce will generate REST API keys for the selected user.

Now that keys have been generated, you should see two new keys, a QRCode, and a Revoke API Key button.

## App Config

### Configure API

Unzip file `product.zip` located inside the **app** folder.

### **API Endpoint and Customer Secret & Key**

Open file `api.js` in `product/lib/constants/app.dart` and change it with your domain name, customer key and customer secret you generated from `Woocommerce -> Settings -> Advanced -> REST API`

1. **Open file in below path:**

```
product/lib/constants/app.dart
```

2\. And replace your Rest API keys and domain with below info in **app.dart** file:

<pre><code><strong>const String baseUrl = 'https://yourdomain.com/';
</strong>
<strong>const String consumerKey = 'ck_xxxxxxxxxxxxxxxxxx';
</strong>
<strong>const String consumerSecret = 'cs_xxxxxxxxxxxxxxx';
</strong></code></pre>
