# Retrieve Configuration

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

Returns a configuration by name. This request needs no `user_token`, so a browser integration can read its own configuration at runtime.

## Example request

**URL**

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

**curl**

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

**JavaScript**

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

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

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

**Python**

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

with AddressZen("ak_test") as client:
    result = client.retrieve_config("ak_test", "woocommerce")
```

**Ruby**

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

uri = URI("https://api.addresszen.com/v1/keys/ak_test/configs/woocommerce")
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/woocommerce?" .
  http_build_query([
    "user_token" => "uk_secret",
  ])
);
$result = json_decode($response, true)["result"];
```

## Example response

**200 OK**

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

## Path parameters

* `key` string

  **API Key**

  The API Key. Begins `ak_`.

  Example: `ak_test`

* `config` string

  **Configuration Name**

  User-provided configuration object name.

  Example: `checkout-form`

## Response

Returns the configuration object with its name, payload and timestamps.

* `result` Config

  | 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.
