# List Configurations

**GET** `/v1/keys/{key}/configs`

Returns every configuration stored against a key, oldest first.

## Example request

**URL**

```http
https://api.addresszen.com/v1/keys/ak_test/configs?user_token=uk_secret
```

**curl**

```bash
curl -G 'https://api.addresszen.com/v1/keys/ak_test/configs' \
  -d 'user_token=uk_secret'
```

**JavaScript**

```javascript
import { createZenClient, listConfigs } from '@addresszen/sdk';

const client = createZenClient({ apiKey: 'ak_test', userToken: 'uk_secret' });

const { data } = await listConfigs({
  client,
  path: { key: 'ak_test' },
});
```

**Python**

```python
# pip install addresszen
from addresszen import AddressZen

with AddressZen("ak_test") as client:
    result = client.list_configs("ak_test", user_token="uk_secret")
```

**Ruby**

```ruby
require "net/http"
require "json"

uri = URI("https://api.addresszen.com/v1/keys/ak_test/configs")
uri.query = URI.encode_www_form(user_token: "uk_secret")
result = JSON.parse(Net::HTTP.get(uri))["result"]
```

**PHP**

```php
<?php
$response = file_get_contents(
  "https://api.addresszen.com/v1/keys/ak_test/configs?" .
  http_build_query([
    "user_token" => "uk_secret",
  ])
);
$result = json_decode($response, true)["result"];
```

## Example response

**200 OK**

```json
{
  "result": {
    "configs": [
      {
        "updatedAt": "2016-01-21T17:14:49.971Z",
        "createdAt": "2016-01-21T17:14:49.971Z",
        "name": "woocommerce",
        "payload": "{\n  \"removeOrganisation\": false\n}\n"
      }
    ]
  },
  "message": "Success",
  "code": 2000
}
```

## Path parameters

* `key` string

  **API Key**

  The API Key. Begins `ak_`.

  Example: `ak_test`

## Query parameters

* `user_token` string optional

  **Management Key**

  A secret key used to manage your account and API Keys. It was previously called the user token.

  Your management key can be retrieved and managed from your [accounts page](https://addresszen.com/account).

  Typically begins `uk_`. Prefer sending it in the `Authorization` header as `Bearer uk_...` instead of this query parameter. The `Authorization: user_token="uk_..."` header also works.

  Example: `uk_B59ScW1p1HHouf1VqclEPZUx`

## Response

`result` contains a `configs` array of configuration objects. Each config has a unique name, timestamps and the serialized payload.

* `result` object

  List of configurations

  * `configs` object\[]

    | Field       | Type   | Description                                                                                  |
    | ----------- | ------ | -------------------------------------------------------------------------------------------- |
    | `updatedAt` | string | Timestamp for when the config was last updated. Example: `2016-01-21T17:14:49.971Z`          |
    | `createdAt` | string | Timestamp for when the config was created. Example: `2016-01-21T17:14:49.971Z`               |
    | `name`      | string | A unique name to identify the configuration payload. Example: `woocommerce`                  |
    | `payload`   | string | A serialised payload of up to `65536` characters. Example: `{ "removeOrganisation": false }` |

The `result` sits inside the standard `{ result, code, message }` envelope. See the [API reference](/docs/api/api-reference.md) for the wrapper format.
