# Authentication

Source: https://developers.swell.is/backend-api/authentication

Before using the API, you will need to create a Swell account.

Your account provides access to your store ID and API key which are necessary for API access. To get your API keys, navigate to the **Developer** section in the dashboard's left-hand nav and select **API keys**.

- Your store ID is located at the top of the API keys page.
- Click on the eye icon to reveal a Secret key in order to copy it.

> **Note:** You can add or revoke secret keys if the security of any key is compromised.

API authentication differs depending on which library is being used when accessing the API. Refer to the authentication example below when using any of the official API libraries.

> **Tip:** While the HTTP protocol is supported, official libraries use a custom wire protocol that improves performance and caching. When using these libraries, your server must be able to connect to the API on port **8443**. If you have trouble connecting, have a system administrator check your firewall settings.

When calling the API directly over HTTP, authenticate with basic auth using your store ID as the username and a secret key as the password:

```txt
curl https://api.swell.store/products \
  -u your-store-id:your-secret-key
```

Keys are environment-specific: secret keys prefixed `sk_test_` route requests to your store's test environment, while `sk_live_` keys target live data.

## Example request

**Authentication example**

**cURL** `Curl authentication example`

```bash
$ curl https://client_id:client_key@api.swell.store/products
```

**Node** `Node authentication example`

```javascript
const { swell } = require('swell-node');
swell.init('store-id', 'secret-key');
```

**PHP** `PHP authentication example`

```php
<?php $swell = new \Swell\Client('store-id', 'secret-key');
```
