---
id: add-variant-from-base-and-config
title: "Add Variant From Base And Config"
description: "Add a new variant based on an existing one."
sidebar_label: "Add Variant From Base And Config"
hide_title: true
hide_table_of_contents: true
api: eJztVktz2zYQ/isYnJwZRXI9PfFU+dGJp22isZxcZI0GJpYSEhJgAdCxqtF/zy4AiqQUO+m1Ux1sCPv+9tuFdtyLtePZgn8SVgntHV+OuASXW1V7ZTTP+FRKJpiGr+wp6rBH4UAyo5nQDJ6V80qv8SuMH/RcVMCEY7MP83s2yY0u1PpBP+ipXbvsQTP81GJbGiHZGTpOUX+3prpEp7MoepOxdGLowQulKQBFPaRwez0apKQx7gjzkeje4tmDdeMYz3nzBfTKgXNYEDubx8NV9Ax2xEwoVZQYNwnbuGDH7BoK0ZTeMW+YBYdHZgr2BFYV29br2ZsxVXknFF6kOt/d389unnMIzjMWZJKpgvlNV0dumlIybRBUxE1KwtUykefoF2R0Cr6xuvX6UaO3xbSuE3R34GqjHRY/1dtlxt73QJGANZSOPEKbyJiPuKnBCvpyK7G/GHWVLFYFNmJFQK8QylVsHxpY+LsB5y+N3PJsxwkc0J6Ooq5LlQdnk8+O+LLjLt9AJehUWwrlFTj6FvwqSUe/rQFDO2+xsxjAK1/SBZGAYVb7EcfuHtKi7r5mRkUnPNh70k32sYCfMr8KqgfrjkU9Q/P4GXLfM5x1Wns0OlYj2JQFSfPVFv+dwk5zHcRfdvFenBgMv+/H87aBcBHJEYq4OD+nf8PhnjeBakVTspZJGP2nGyz09kOB5Z1C1K8dfcTS6ZAKbBEI90dwIG3IS5T1kBhFFJNWh+gQusaqEP9J0WQO4DuZmhX2erfvqbQCRluvpRSBzQI1p7hgIlMIcUT414uLU1A/iVLJABm7sdbYf4PocGTiBNNJeajcqUJp8oH0pCGJ7Fhme6MwkzVYvl92lBXWim2P2H+amCCNQuXWrw3PX0gfsQ5DE1VeVg1gsHuS/mhcqK4YOun1etTBG9F9uYzrCN/3grUqtKVPHMbeIus2hjZkbZwPTPQb/DZJbHUT2pZviYYodGCfwrZA6BuLLeMb72uXTSZ5aRo5RojwRRkLNRE18fPojQ1SdkWqnPjoIEce+23wN53d/gHbdyAkti1bLPsKc2JO5MJQ7dAGjIfXtGXCGuTTBsuy6p/Y4BHygZKNVlQ2cfKuW/g3z6KqSxgs8K61p1t6KBts4E40WK8UVOnChJzbUY2AXIoc3+6wIlA3YnU+/mV8/hKCyYAhFmnqRB6mri0+qIUt0e/RoTsowUGkkeMeRPVbJ6AsiQiV0H1/P1oTR3n2Hs//f1j9535YpYnz8OwndYll0m4KTNul7bFo3zp6zbr9gQO9oSWD8t2Obj7acr+na5xDS1tgmV7JRxqPBa3uTbsPdvwLznfGryKz3oYFS+plE+f/6L2htyBaTHNK/lXdZW8PEvfo4U0/AysjycaKr7S88W/Gw49Lsg4LKdzhGyX0uqEnIuPRJ32+AXyLVmY=
sidebar_class_name: "post api-method"
info_path: reference/api/agenta-backend
custom_edit_url: null
---

import ApiTabs from "@theme/ApiTabs";
import DiscriminatorTabs from "@theme/DiscriminatorTabs";
import MethodEndpoint from "@theme/ApiExplorer/MethodEndpoint";
import SecuritySchemes from "@theme/ApiExplorer/SecuritySchemes";
import MimeTabs from "@theme/MimeTabs";
import ParamsItem from "@theme/ParamsItem";
import ResponseSamples from "@theme/ResponseSamples";
import SchemaItem from "@theme/SchemaItem";
import SchemaTabs from "@theme/SchemaTabs";
import Markdown from "@theme/Markdown";
import Heading from "@theme/Heading";
import OperationTabs from "@theme/OperationTabs";
import TabItem from "@theme/TabItem";

<Heading as={"h1"} className={"openapi__heading"} children={"Add Variant From Base And Config"}></Heading>

<MethodEndpoint method={"post"} path={"/variants/from-base"}></MethodEndpoint>

Add a new variant based on an existing one.
Same as POST /config

Args:
payload (AddVariantFromBasePayload): Payload containing base variant ID, new variant name, and parameters.
stoken_session (SessionContainer, optional): Session container. Defaults to result of verify_session().

Raises:
HTTPException: Raised if the variant could not be added or accessed.

Returns:
Union[AppVariantResponse, Any]: New variant details or exception.

<Heading id={"request"} as={"h2"} className={"openapi-tabs__heading"} children={"Request"}></Heading>

<MimeTabs className={"openapi-tabs__mime"}>
  <TabItem label={"application/json"} value={"application/json-schema"}>
    <details style={{}} className={"openapi-markdown__details mime"} data-collapsed={false} open={true}>
      <summary style={{}} className={"openapi-markdown__details-summary-mime"}>
        <h3 className={"openapi-markdown__details-summary-header-body"}>Body</h3>
        <strong className={"openapi-schema__required"}>required</strong>
      </summary>
      <div style={{ textAlign: "left", marginLeft: "1rem" }}></div>
      <ul style={{ marginLeft: "1rem" }}>
        <SchemaItem
          collapsible={false}
          name={"base_id"}
          required={true}
          schemaName={"Base Id (string)"}
          qualifierMessage={undefined}
          schema={{ type: "string", title: "Base Id" }}
        ></SchemaItem>
        <SchemaItem
          collapsible={false}
          name={"new_variant_name"}
          required={true}
          schemaName={"New Variant Name (string)"}
          qualifierMessage={undefined}
          schema={{ type: "string", title: "New Variant Name" }}
        ></SchemaItem>
        <SchemaItem
          collapsible={false}
          name={"new_config_name"}
          required={true}
          schemaName={"New Config Name (string)"}
          qualifierMessage={undefined}
          schema={{ type: "string", title: "New Config Name" }}
        ></SchemaItem>
        <SchemaItem
          collapsible={false}
          name={"parameters"}
          required={true}
          schemaName={"object"}
          qualifierMessage={undefined}
          schema={{ type: "object", title: "Parameters" }}
        ></SchemaItem>
      </ul>
    </details>
  </TabItem>
</MimeTabs>
<div>
  <div>
    <ApiTabs label={undefined} id={undefined}>
      <TabItem label={"200"} value={"200"}>
        <div>Successful Response</div>
        <div>
          <MimeTabs className={"openapi-tabs__mime"} schemaType={"response"}>
            <TabItem label={"application/json"} value={"application/json"}>
              <SchemaTabs className={"openapi-tabs__schema"}>
                <TabItem label={"Schema"} value={"Schema"}>
                  <details
                    style={{}}
                    className={"openapi-markdown__details response"}
                    data-collapsed={false}
                    open={true}
                  >
                    <summary style={{}} className={"openapi-markdown__details-summary-response"}>
                      <strong>Schema</strong>
                    </summary>
                    <div style={{ textAlign: "left", marginLeft: "1rem" }}></div>
                    <ul style={{ marginLeft: "1rem" }}>
                      <div>
                        <span className={"badge badge--info"}>anyOf</span>
                        <SchemaTabs>
                          <TabItem label={"AppVariantResponse_"} value={"0-item-properties"}>
                            <SchemaItem
                              collapsible={false}
                              name={"app_id"}
                              required={true}
                              schemaName={"App Id (string)"}
                              qualifierMessage={undefined}
                              schema={{ type: "string", title: "App Id" }}
                            ></SchemaItem>
                            <SchemaItem
                              collapsible={false}
                              name={"app_name"}
                              required={true}
                              schemaName={"App Name (string)"}
                              qualifierMessage={undefined}
                              schema={{ type: "string", title: "App Name" }}
                            ></SchemaItem>
                            <SchemaItem
                              collapsible={false}
                              name={"variant_id"}
                              required={true}
                              schemaName={"Variant Id (string)"}
                              qualifierMessage={undefined}
                              schema={{ type: "string", title: "Variant Id" }}
                            ></SchemaItem>
                            <SchemaItem
                              collapsible={false}
                              name={"variant_name"}
                              required={true}
                              schemaName={"Variant Name (string)"}
                              qualifierMessage={undefined}
                              schema={{ type: "string", title: "Variant Name" }}
                            ></SchemaItem>
                            <SchemaItem
                              collapsible={false}
                              name={"project_id"}
                              required={true}
                              schemaName={"Project Id (string)"}
                              qualifierMessage={undefined}
                              schema={{ type: "string", title: "Project Id" }}
                            ></SchemaItem>
                            <SchemaItem collapsible={true} className={"schemaItem"}>
                              <details style={{}} className={"openapi-markdown__details"}>
                                <summary style={{}}>
                                  <strong>parameters</strong>
                                  <span style={{ opacity: "0.6" }}>object</span>
                                  <strong
                                    style={{ fontSize: "var(--ifm-code-font-size)", color: "var(--openapi-required)" }}
                                  >
                                    required
                                  </strong>
                                </summary>
                                <div style={{ marginLeft: "1rem" }}></div>
                                <div>
                                  <span className={"badge badge--info"}>anyOf</span>
                                </div>
                              </details>
                            </SchemaItem>
                            <SchemaItem
                              collapsible={false}
                              name={"base_name"}
                              required={true}
                              schemaName={"Base Name (string)"}
                              qualifierMessage={undefined}
                              schema={{ type: "string", title: "Base Name" }}
                            ></SchemaItem>
                            <SchemaItem
                              collapsible={false}
                              name={"base_id"}
                              required={true}
                              schemaName={"Base Id (string)"}
                              qualifierMessage={undefined}
                              schema={{ type: "string", title: "Base Id" }}
                            ></SchemaItem>
                            <SchemaItem
                              collapsible={false}
                              name={"config_name"}
                              required={true}
                              schemaName={"Config Name (string)"}
                              qualifierMessage={undefined}
                              schema={{ type: "string", title: "Config Name" }}
                            ></SchemaItem>
                            <SchemaItem collapsible={true} className={"schemaItem"}>
                              <details style={{}} className={"openapi-markdown__details"}>
                                <summary style={{}}>
                                  <strong>uri</strong>
                                  <span style={{ opacity: "0.6" }}>object</span>
                                  <strong
                                    style={{ fontSize: "var(--ifm-code-font-size)", color: "var(--openapi-required)" }}
                                  >
                                    required
                                  </strong>
                                </summary>
                                <div style={{ marginLeft: "1rem" }}></div>
                                <div>
                                  <span className={"badge badge--info"}>anyOf</span>
                                  <SchemaTabs>
                                    <TabItem label={"MOD1"} value={"0-item-properties"}>
                                      <div style={{ marginTop: ".5rem", marginBottom: ".5rem" }}>string</div>
                                    </TabItem>
                                  </SchemaTabs>
                                </div>
                              </details>
                            </SchemaItem>
                            <SchemaItem
                              collapsible={false}
                              name={"revision"}
                              required={true}
                              schemaName={"Revision (integer)"}
                              qualifierMessage={undefined}
                              schema={{ type: "integer", title: "Revision" }}
                            ></SchemaItem>
                            <SchemaItem collapsible={true} className={"schemaItem"}>
                              <details style={{}} className={"openapi-markdown__details"}>
                                <summary style={{}}>
                                  <strong>created_at</strong>
                                  <span style={{ opacity: "0.6" }}>object</span>
                                </summary>
                                <div style={{ marginLeft: "1rem" }}></div>
                                <div>
                                  <span className={"badge badge--info"}>anyOf</span>
                                  <SchemaTabs>
                                    <TabItem label={"MOD1"} value={"0-item-properties"}>
                                      <div style={{ marginTop: ".5rem", marginBottom: ".5rem" }}>string</div>
                                    </TabItem>
                                  </SchemaTabs>
                                </div>
                              </details>
                            </SchemaItem>
                            <SchemaItem collapsible={true} className={"schemaItem"}>
                              <details style={{}} className={"openapi-markdown__details"}>
                                <summary style={{}}>
                                  <strong>updated_at</strong>
                                  <span style={{ opacity: "0.6" }}>object</span>
                                </summary>
                                <div style={{ marginLeft: "1rem" }}></div>
                                <div>
                                  <span className={"badge badge--info"}>anyOf</span>
                                  <SchemaTabs>
                                    <TabItem label={"MOD1"} value={"0-item-properties"}>
                                      <div style={{ marginTop: ".5rem", marginBottom: ".5rem" }}>string</div>
                                    </TabItem>
                                  </SchemaTabs>
                                </div>
                              </details>
                            </SchemaItem>
                            <SchemaItem collapsible={true} className={"schemaItem"}>
                              <details style={{}} className={"openapi-markdown__details"}>
                                <summary style={{}}>
                                  <strong>modified_by_id</strong>
                                  <span style={{ opacity: "0.6" }}>object</span>
                                </summary>
                                <div style={{ marginLeft: "1rem" }}></div>
                                <div>
                                  <span className={"badge badge--info"}>anyOf</span>
                                  <SchemaTabs>
                                    <TabItem label={"MOD1"} value={"0-item-properties"}>
                                      <div style={{ marginTop: ".5rem", marginBottom: ".5rem" }}>string</div>
                                    </TabItem>
                                  </SchemaTabs>
                                </div>
                              </details>
                            </SchemaItem>
                            <SchemaItem collapsible={true} className={"schemaItem"}>
                              <details style={{}} className={"openapi-markdown__details"}>
                                <summary style={{}}>
                                  <strong>organization_id</strong>
                                  <span style={{ opacity: "0.6" }}>object</span>
                                </summary>
                                <div style={{ marginLeft: "1rem" }}></div>
                                <div>
                                  <span className={"badge badge--info"}>anyOf</span>
                                  <SchemaTabs>
                                    <TabItem label={"MOD1"} value={"0-item-properties"}>
                                      <div style={{ marginTop: ".5rem", marginBottom: ".5rem" }}>string</div>
                                    </TabItem>
                                  </SchemaTabs>
                                </div>
                              </details>
                            </SchemaItem>
                            <SchemaItem collapsible={true} className={"schemaItem"}>
                              <details style={{}} className={"openapi-markdown__details"}>
                                <summary style={{}}>
                                  <strong>workspace_id</strong>
                                  <span style={{ opacity: "0.6" }}>object</span>
                                </summary>
                                <div style={{ marginLeft: "1rem" }}></div>
                                <div>
                                  <span className={"badge badge--info"}>anyOf</span>
                                  <SchemaTabs>
                                    <TabItem label={"MOD1"} value={"0-item-properties"}>
                                      <div style={{ marginTop: ".5rem", marginBottom: ".5rem" }}>string</div>
                                    </TabItem>
                                  </SchemaTabs>
                                </div>
                              </details>
                            </SchemaItem>
                          </TabItem>
                        </SchemaTabs>
                      </div>
                    </ul>
                  </details>
                </TabItem>
                <TabItem label={"Example (from schema)"} value={"Example (from schema)"}>
                  <ResponseSamples responseExample={"{}"} language={"json"}></ResponseSamples>
                </TabItem>
              </SchemaTabs>
            </TabItem>
          </MimeTabs>
        </div>
      </TabItem>
      <TabItem label={"422"} value={"422"}>
        <div>Validation Error</div>
        <div>
          <MimeTabs className={"openapi-tabs__mime"} schemaType={"response"}>
            <TabItem label={"application/json"} value={"application/json"}>
              <SchemaTabs className={"openapi-tabs__schema"}>
                <TabItem label={"Schema"} value={"Schema"}>
                  <details
                    style={{}}
                    className={"openapi-markdown__details response"}
                    data-collapsed={false}
                    open={true}
                  >
                    <summary style={{}} className={"openapi-markdown__details-summary-response"}>
                      <strong>Schema</strong>
                    </summary>
                    <div style={{ textAlign: "left", marginLeft: "1rem" }}></div>
                    <ul style={{ marginLeft: "1rem" }}>
                      <SchemaItem collapsible={true} className={"schemaItem"}>
                        <details style={{}} className={"openapi-markdown__details"}>
                          <summary style={{}}>
                            <span className={"openapi-schema__container"}>
                              <strong className={"openapi-schema__property"}>detail</strong>
                              <span className={"openapi-schema__name"}>object[]</span>
                            </span>
                          </summary>
                          <div style={{ marginLeft: "1rem" }}>
                            <li>
                              <div
                                style={{
                                  fontSize: "var(--ifm-code-font-size)",
                                  opacity: "0.6",
                                  marginLeft: "-.5rem",
                                  paddingBottom: ".5rem",
                                }}
                              >
                                Array [
                              </div>
                            </li>
                            <SchemaItem collapsible={true} className={"schemaItem"}>
                              <details style={{}} className={"openapi-markdown__details"}>
                                <summary style={{}}>
                                  <span className={"openapi-schema__container"}>
                                    <strong className={"openapi-schema__property"}>loc</strong>
                                    <span className={"openapi-schema__name"}>object[]</span>
                                    <span className={"openapi-schema__divider"}></span>
                                    <span className={"openapi-schema__required"}>required</span>
                                  </span>
                                </summary>
                                <div style={{ marginLeft: "1rem" }}>
                                  <li>
                                    <div
                                      style={{
                                        fontSize: "var(--ifm-code-font-size)",
                                        opacity: "0.6",
                                        marginLeft: "-.5rem",
                                        paddingBottom: ".5rem",
                                      }}
                                    >
                                      Array [
                                    </div>
                                  </li>
                                  <div>
                                    <span className={"badge badge--info"}>anyOf</span>
                                    <SchemaTabs>
                                      <TabItem label={"MOD1"} value={"0-item-properties"}>
                                        <div style={{ marginTop: ".5rem", marginBottom: ".5rem" }}>string</div>
                                      </TabItem>
                                      <TabItem label={"MOD2"} value={"1-item-properties"}>
                                        <div style={{ marginTop: ".5rem", marginBottom: ".5rem" }}>integer</div>
                                      </TabItem>
                                    </SchemaTabs>
                                  </div>
                                  <li>
                                    <div
                                      style={{
                                        fontSize: "var(--ifm-code-font-size)",
                                        opacity: "0.6",
                                        marginLeft: "-.5rem",
                                      }}
                                    >
                                      ]
                                    </div>
                                  </li>
                                </div>
                              </details>
                            </SchemaItem>
                            <SchemaItem
                              collapsible={false}
                              name={"msg"}
                              required={true}
                              schemaName={"Message (string)"}
                              qualifierMessage={undefined}
                              schema={{ type: "string", title: "Message" }}
                            ></SchemaItem>
                            <SchemaItem
                              collapsible={false}
                              name={"type"}
                              required={true}
                              schemaName={"Error Type (string)"}
                              qualifierMessage={undefined}
                              schema={{ type: "string", title: "Error Type" }}
                            ></SchemaItem>
                            <li>
                              <div
                                style={{ fontSize: "var(--ifm-code-font-size)", opacity: "0.6", marginLeft: "-.5rem" }}
                              >
                                ]
                              </div>
                            </li>
                          </div>
                        </details>
                      </SchemaItem>
                    </ul>
                  </details>
                </TabItem>
                <TabItem label={"Example (from schema)"} value={"Example (from schema)"}>
                  <ResponseSamples
                    responseExample={
                      '{\n  "detail": [\n    {\n      "loc": [\n        "string",\n        0\n      ],\n      "msg": "string",\n      "type": "string"\n    }\n  ]\n}'
                    }
                    language={"json"}
                  ></ResponseSamples>
                </TabItem>
              </SchemaTabs>
            </TabItem>
          </MimeTabs>
        </div>
      </TabItem>
    </ApiTabs>
  </div>
</div>
