Skip to main content

createConfig

Create

Creates a named configuration on a key and returns it.

Endpoint​

POST /keys/{key}/configs

See the API reference for this endpoint.

This operation needs a Management Key. Set it as userToken on the client, which sends it in the Authorization header. See setup.

Import​

import { createConfig } from "@addresszen/sdk";

Path Parameters​

NameTypeRequiredDescription
keystringyesAPI Key The API Key to retrieve. Begins ak_.

Query Parameters​

None.

Request Body​

ConfigNewParam

Response Type​

import type { CreateConfigResponse } from "@addresszen/sdk";

Errors​

HTTP errors throw an ApiError with the HTTP status and the API error code and message. Network failures and aborts reject with the runtime's native error. Pass throwOnError: false to get { data, error } instead. See error handling.

Example​

create-config.tsts
import { createZenClient, createConfig } from "@addresszen/sdk";

export const example = async () => {
const client = createZenClient({
apiKey: "ak_test",
userToken: "uk_example",
});
const { data } = await createConfig({
client,
path: { key: "ak_test" },
body: { name: "checkout", payload: JSON.stringify({ enabled: true }) },
});
return data;
};