# 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.ideal-postcodes.co.uk/v1/keys/ak_test/configs/woocommerce?user_token=uk_secret
```

**curl**

```bash
curl -G 'https://api.ideal-postcodes.co.uk/v1/keys/ak_test/configs/woocommerce' \
  -d 'user_token=uk_secret'
```

**JavaScript**

```javascript
import { createIdpcClient, retrieveConfig } from '@ideal-postcodes/sdk';

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

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

**Python**

```python
# pip install ideal-postcodes
from ideal_postcodes import IdealPostcodes

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

**Ruby**

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

uri = URI("https://api.ideal-postcodes.co.uk/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
// composer require ideal-postcodes/sdk
use IdealPostcodes\IdealPostcodes;

$client = IdealPostcodes::client('ak_test');
$result = $client->retrieveConfig('ak_test', 'woocommerce')->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: `idpc-be`

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