# `create_config`

Create

Creates a named configuration on a key and returns it.

## Endpoint

`POST /keys/{key}/configs`

See the [API reference](/docs/api/create-config.md) for this endpoint.

This operation needs a Management Key. Pass it as the required `user_token` keyword argument; the client sends it in the `Authorization` header. See [setup](/docs/sdks/python/setup.md).

## Import

```python
from addresszen import AddressZen
```

Call `create_config` on the `AddressZen` client. Path parameters are positional; query and body parameters are keyword-only.

## Path Parameters

| Name  | Type  | Required | Description                                        |
| ----- | ----- | -------- | -------------------------------------------------- |
| `key` | `str` | yes      | **API Key** The API Key to retrieve. Begins `ak_`. |

## Query Parameters

*None.*

## Request Body

| Name      | Type  | Required | Description                                         |
| --------- | ----- | -------- | --------------------------------------------------- |
| `name`    | `str` | yes      | A unique name to identify the configuration payload |
| `payload` | `str` | yes      | A serialized payload of up to `65536` characters    |

## Response Type

```python
from addresszen.types import CreateConfigResult
```

## Errors

Unsuccessful HTTP responses raise `APIError` or a subclass, with the HTTP `status` and the API error `code` and `message`. Connection failures and timeouts raise `TransportError`. Unexpected responses raise `ProtocolError`. All derive from `ClientError`. See [error handling](/docs/sdks/python/errors.md).

## Example

create\_config.pypython

```python
import json

from addresszen import AddressZen

with AddressZen("ak_test") as client:
    config = client.create_config(
        "ak_test", user_token="uk_example", name="checkout", payload=json.dumps({"enabled": True})
    )
```
