---
id: create-app-and-variant-from-template
title: "Create App And Variant From Template"
description: "Create an app and variant from a template."
sidebar_label: "Create App And Variant From Template"
hide_title: true
hide_table_of_contents: true
api: eJztV1tT4zYU/isaP8EMTSjTpzw1ZOks025hINAHyGSELSdabMmV5IA3k//ec3SJ5UCSLZl96Ex5ACOf8537p+NlYuhMJ4OHZFhVOpmcJBnTqeKV4VIkg2SkGDWMUEFoVcGfjCyo4lQYkitZEkoMK6sCRHqP4lEM1UwPHgWBn4o2haQZOXIIgH7vFI8HZDxn6/epFIZywcWMGDjetMJFLlVJ0ZueA9ZGPjMx1UxrOCRHt+5h5HCYOiHSOk8LbylIpkGiRz6xnNaF0cRIeK6YyPTRgimeNwH36PjYRnRDOZz4mD6Px9cXrymz+ANymVuXa80UmVNNINB0zrJ1HAUvuSFSEZ6HBL5wM7fvNS0ZEfiLFqCXNYS9cm20M8pMrUSw2qbuhulKCs1cXLI2VQ34zovUpjmzVnzyeslJIiumbPYuM6imE5qCzBSSPPVyUyzlNBQSlBT7u2banMusSQbLBBPHhMFH0Cx4agH7XzV2yDLREHRJ8alSaM5wpr3sFCPEZ9NU8DfRRkGhwYLhpsADiI38iTIrOPMOTHm2S2XsxQhEBFpg8ytLjVeiornKoZs31Vcn6xNRF0WymrSA1w7B471I9awrmrIDEP8KGB6TiQXm2mUly7hrz+tOtjbRw4F8Quei+C/EgtwjGMhINaOCf7P1OMDfqwjGuvyOeewJrliGVLGubLdoUaAR+Ob8TwF+FeMZVTN74JrbZuPs9BT/dLnotk5TmM68LkiYBLB5QHfubjTsTVe/f9vJYa524/t8eBtBZ5+doBVsdft/m1a3xyuqQNsw35GbHeNrvnNmWgTAe6Ka7XX8HITWXluN3S5beecvlDjns70WRlZsbaNW/KMDcQeqtiUXXHPXR16UQ7PNmIqs3gQhdNSR8JSaj1oeeRofGhtClR2Id+cQPF4pM55zAHxqDqCLLx6FnDe+QD+Kh34EHX8Ht1kui0gumueNQe3MX2ew4qlo+73by65Hoz6bdPhk49a3xAne/3J29pYb72nBM5e4C6Wk+jgxZgy2pAKfOJC7fitQyLTz9jtKEqZmNWmzT5WiTTRHf0jnoO1TPds16F/gFqAz1t6S20VtMsgY3+6rPMblTHu5Scy6Ib0uu9vD+OTS956xIIJr5BtAV1tonrnETa2S2tiGMnP4rw8F1P19axvsoQvL6VCKWkEJk7kxlR70+2kh66wHKYMNuEc5IGHbdTtoaN+SEYra8dEshfY0jcUbXl/+zprPsKlCGQcPk1jgFjvJ9UZXbF0WsAfHYNJReDKsIUzlJx2OOTowd1qYBuzRm3YJvXilECTrLpVRrePFsT2Ob8b2tEso7Xm0o71HaNFihp8kNrYwqS5x5zSF7xLLEFAEl9PT3s+9022Z9goEcuanlaZ2WkOSrJglibiW6yqi06UdVcgALX9tX2AKsYFKKiI8/ymHi8oQzIZF4jf8jhu3XdTxNVr+//8U/I9/CvpZNOzV9KFOXLglyVK94xl7+2l/921nGhj9OdITyC+XeLPdqWK1wmOYWIV8MfHX5BMOyAOS/jwwxzJ5Biawyxr21U+WmlG8qB1TbNxUeIs4jWGK6d4pO4kY9Prqdow3r/+IhdUHdRR9QdqH34PEfh6jtqUuewa3GxWzGi+XQeIw8ecfFc3vGA==
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={"Create App And Variant From Template"}></Heading>

<MethodEndpoint method={"post"} path={"/apps/app_and_variant_from_template"}></MethodEndpoint>

Create an app and variant from a template.

Args:
payload (CreateAppVariant): The payload containing the app and variant information.
stoken_session (SessionContainer, optional): The session container. Defaults to Depends(verify_session()).

Raises:
HTTPException: If the user has reached the app limit or if an app with the same name already exists.

Returns:
AppVariantResponse: The output of the created app variant.

<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={"app_name"}
          required={true}
          schemaName={"App Name (string)"}
          qualifierMessage={undefined}
          schema={{ type: "string", title: "App Name" }}
        ></SchemaItem>
        <SchemaItem
          collapsible={false}
          name={"template_id"}
          required={true}
          schemaName={"Template Id (string)"}
          qualifierMessage={undefined}
          schema={{ type: "string", title: "Template Id" }}
        ></SchemaItem>
        <SchemaItem collapsible={true} className={"schemaItem"}>
          <details style={{}} className={"openapi-markdown__details"}>
            <summary style={{}}>
              <strong>project_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>
        <SchemaItem collapsible={true} className={"schemaItem"}>
          <details style={{}} className={"openapi-markdown__details"}>
            <summary style={{}}>
              <span className={"openapi-schema__container"}>
                <strong className={"openapi-schema__property"}>env_vars</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" }}>
              <SchemaItem
                name={"property name*"}
                required={false}
                schemaName={"string"}
                qualifierMessage={undefined}
                schema={{ type: "string" }}
                collapsible={false}
                discriminator={false}
              ></SchemaItem>
            </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>
      </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" }}>
                      <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>
                    </ul>
                  </details>
                </TabItem>
                <TabItem label={"Example (from schema)"} value={"Example (from schema)"}>
                  <ResponseSamples
                    responseExample={
                      '{\n  "app_id": "string",\n  "app_name": "string",\n  "variant_id": "string",\n  "variant_name": "string",\n  "project_id": "string",\n  "parameters": {},\n  "base_name": "string",\n  "base_id": "string",\n  "config_name": "string",\n  "uri": "string",\n  "revision": 0,\n  "created_at": "string",\n  "updated_at": "string",\n  "modified_by_id": "string",\n  "organization_id": "string",\n  "workspace_id": "string"\n}'
                    }
                    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>
