> For the complete documentation index, see [llms.txt](https://api.shopwaive.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://api.shopwaive.com/quick-start.md).

# Quick Start

With this Quick Start guide, make your first request in just minutes

{% hint style="info" %}
**Tip:** Shopwaive's quick start guide helps developers setup their first request in minutes. Use this guide to create an API key and make your first request.
{% endhint %}

## Get your API keys

Every API request is authenticated with a Shopwaive API key, sent in the `X-Shopwaive-Access-Token` header. Any request that doesn't include a valid key will return an error.

To create a key:

1. In your Shopify admin, open the **Shopwaive** app.
2. Click **Settings**, then the **Develop** tab.
3. Under **Shopwaive API keys**, type a label (for example `ERP sync`) and click **Create key**.
4. Click **Copy** and keep the key somewhere safe. The full key is shown only once.

A key starts with `swak_`. One key is enough. You can create more, for example one for each developer or integration. To stop a key from working, select it in the list and click **Revoke**. Your other keys are not affected. A lost key cannot be shown again: revoke it and create a new one.

{% hint style="info" %}
**Already have an integration?** The access token it sends in the `X-Shopwaive-Access-Token` header keeps working. You don't need to change anything.
{% endhint %}

{% hint style="success" %}
**Good to know:** API keys should be handled with care and never exposed in unsecured environments. They should never be shared as they provide access to your store's data.
{% endhint %}

### If a key is refused

A `swak_` key that is refused returns HTTP `401`. The message names the reason:

```json
{"status": "failed", "message": "Invalid X-Shopwaive-Access-Token: key-revoked."}
```

| Reason                    | What it means                                                                                 |
| ------------------------- | --------------------------------------------------------------------------------------------- |
| `not-a-shopwaive-api-key` | The value starts with `swak_` but is not a complete key. Check that you pasted the whole key. |
| `key-not-recognised`      | No store has this key. It may have been deleted.                                              |
| `key-revoked`             | The key was revoked. Create a new one.                                                        |
| `store-not-installed`     | Shopwaive is not installed on the store.                                                      |
| `store-has-no-token`      | Contact <support@shopwaive.com>.                                                              |

HTTP `503` means the key could not be checked. Retry the request.

## Make your first request

To make your first request, send an authenticated request to the get customer endpoint. This will fetch a `customer` by email address. Ensure to include the `X-Shopwaive-Access-Token` and `X-Shopwaive-Platform` headers.

{% openapi src="/files/SxAe8b4pp5MX0TU3Y7gs" path="/api/customer/{customer\_email}" method="get" %}
[index.yaml](https://2430267771-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FR7BwDfJhPObShd4z9nqx%2Fuploads%2Fgit-blob-8e17f9051c5a3a064baca126e78e7291e3f6ec11%2Findex.yaml?alt=media)
{% endopenapi %}

Take a look at how you might call this method using our official libraries, or via `curl`. Replace `YOUR_API_KEY` with your key:

{% tabs %}
{% tab title="curl" %}

```curl
curl --location 'https://app.shopwaive.com/api/customer/example@gmail.com' \
--header 'X-Shopwaive-Access-Token: YOUR_API_KEY' \
--header 'X-Shopwaive-Platform: shopify' \
--header 'Content-Type: application/json' \
--data ''
```

{% endtab %}

{% tab title="Node Axios" %}

```javascript
var axios = require('axios');
var data = '';

var config = {
  method: 'get',
maxBodyLength: Infinity,
  url: 'https://app.shopwaive.com/api/customer/example@gmail.com',
  headers: { 
    'X-Shopwaive-Access-Token': 'YOUR_API_KEY', 
    'X-Shopwaive-Platform': 'shopify', 
    'Content-Type': 'application/json'
  },
  data : data
};

axios(config)
.then(function (response) {
  console.log(JSON.stringify(response.data));
})
.catch(function (error) {
  console.log(error);
});
```

{% endtab %}

{% tab title="NPM Package" %}

```javascript
var config = {
    headers: {
        "X-Shopwaive-Access-Token": "YOUR_API_KEY",
        "X-Shopwaive-Platform": "shopify",
        "Content-Type":"application/json"
    }
};

const Shopwaive = require('@shopwaive/credit');
const email = "support@shopwaive.com";

async function getCustomer() {
    return new Promise((resolve, reject) => {
        let data = Shopwaive.getCustomer(config, email);
        resolve(data)
    });
}

getCustomer().then(res => {
    let data = res.data;
    if (data) {
        console.log(res.data);
    }
    console.log(res.status)
    console.log(res.statusText)

})
```

{% endtab %}

{% tab title="Python" %}

```python
import http.client
import json

conn = http.client.HTTPSConnection("app.shopwaive.com")
payload = ''
headers = {
  'X-Shopwaive-Access-Token': 'YOUR_API_KEY',
  'X-Shopwaive-Platform': 'shopify',
  'Content-Type': 'application/json'
}
conn.request("GET", "/api/customer/example@gmail.com", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
```

{% endtab %}
{% endtabs %}
