---
id: add-variant-from-image
title: "Add Variant From Image"
description: "Add a new variant to an app based on a Docker image."
sidebar_label: "Add Variant From Image"
hide_title: true
hide_table_of_contents: true
api: eJztVktv4zYQ/isETw7g2GnQk0514izW6GODxLuX2DAYaWRzI5EqSSVRBf/3zpCULcd1dosCPa0PiaR5fzPzkS13Ym158sAnVWX5csgzsKmRlZNa8YRPsowJpuCFPQsjhXLMaSYUE1XFHoWFjGl8YVOdPoFhshRrGC3UQk3M2iYLxfCHqiuZsYF15ixh8w2w2ZTpnDl8IjfkEKPQ6z7GKNhWoim0QGPM40sQfjC6nFGc2yCLPjvNVCsnpJJqzaTKtSkFVcLEo67dmxgUNsaxTj+BWlmwlrQH9+HhOjgDM2TaIyKKGK7TTDuNEZtCLurCWfI8hQpUZgfPYGTedH4HZ2cenDsh8UuE5+N8fnvzmoL3n7BZACYH4WqD/wuBhViM5zNeYHtKveBMI9hB02POMg2WKe3YRjwjrAy7ikUJ4wiIF+k2XtfAWmIbGqZECWyAhpj9uQWDeZ4d+ZTBY65rlfWENeq/jZemWCElGJsaygQsQXV1ZjJ1ATucpqIh8HF6YjdGfMh1BcY3a5bh4KF4FYWrHFu+8jmhWiUMJu/A0NS2nCohdT9kKJY0tZVwG3w28GctDaA7Z2oYcptuoBQ8ablrKrJCLBAf1HTSFfQBl4Bh+O12GazBuiudNWTy1hl1HuEjEQYvZOpzH3+1tDdtL1ZlqDInwdJbV1PI+3QmcdrZH6S3xbX0G0Y1vmMU15AqGMbFPq08Jznq0Rrv0hGq+ZR7YA/NtsPdF1UXBSeAOkdX6GCXJ8KSy/V/8nftXUSPVEjQ049fIXUHbX04hLOPUqy/X95hcr2Ap8kF41MGBmyllQ0dvLy4oH+HPHlf+xXI64LdRWX+/TMSovx8eXns+IsoZBY47MYYbf6F1zeTlwEyVUFP0kFpjxUKnR5Iv6N3EjNZg8H27fskjBFNb85+0yFBmo7Srt8byd8RQtrynbPTqh4MNifpt2aE6gqho96yv2YdvAHd02VMA3z/FKxTISo/chh6i4y10cRrlbbOsxgyVMLH2EA7bgN7bcdxmsdEeOcd4QV6DmxXG2wg3zhX2WQ8TgtdZ6PA4iMh0ZnkRwe4l7JrUvVbZiGtjXSN9ze5nf0KzUcQGTYxeVj2Fe5pjsJkHKrtmoLx8DOGjCQ8qbFII/8K7Y5cvAlWBAJN6N2eVW9eRVkVcMyK+273WK83Ap7Y9u89Att/POCh/eRyuhT4ErrdD/hcCQykiDYI6wDdxein0cUpQKMBQ2jiSorUr2SHhVdD0WHLds1CCW4p7SN3IMpf9gJCiqakFKrvD69I3ZlALMVmcTwOsmv35PDj6vbj6vZ/Xd0iHzh4deOqQFBp0/zgt5HpHuioouM42d3Uoj0+9egO+WdDDIkGbUtT+tkU2y19RtowRFrLaPlI64sUlklLz8gQuSgsvLMQg7t4KJyxUzl3xKYan2BR0xs+PiHN7S6Z/rDbdJzZRuF1iHPuj6S98dEJTadnsJikNDrv6i57J8ftp/s5sV28j5Y6IxsjXui4w78+0TDrnrT9NzzVhVrXBG3Cg0/6/Q3r4c5U
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 Image"}
>
</Heading>

<MethodEndpoint
  method={"post"}
  path={"/apps/{app_id}/variant/from-image"}
>
  
</MethodEndpoint>



Add a new variant to an app based on a Docker image.

Args:
    app_id (str): The ID of the app to add the variant to.
    payload (AddVariantFromImagePayload): The payload containing information about the variant to add.
    stoken_session (SessionContainer, optional): The session container. Defaults to Depends(verify_session()).

Raises:
    HTTPException: If the feature flag is set to "demo" or if the image does not have a tag starting with the registry name (agenta-server) or if the image is not found or if the user does not have access to the app.

Returns:
    dict: The newly added variant.

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

<details
  style={{"marginBottom":"1rem"}}
  className={"openapi-markdown__details"}
  data-collapsed={false}
  open={true}
>
  <summary
    style={{}}
  >
    <h3
      className={"openapi-markdown__details-summary-header-params"}
    >
      Path Parameters
    </h3>
  </summary><div>
    <ul>
      <ParamsItem
        className={"paramsItem"}
        param={{"name":"app_id","in":"path","required":true,"schema":{"type":"string","title":"App Id"}}}
      >
        
      </ParamsItem>
    </ul>
  </div>
</details><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={"variant_name"}
          required={true}
          schemaName={"Variant Name (string)"}
          qualifierMessage={undefined}
          schema={{"type":"string","title":"Variant Name"}}
        >
          
        </SchemaItem><SchemaItem
          collapsible={false}
          name={"docker_id"}
          required={true}
          schemaName={"Docker Id (string)"}
          qualifierMessage={undefined}
          schema={{"type":"string","title":"Docker Id"}}
        >
          
        </SchemaItem><SchemaItem
          collapsible={false}
          name={"tags"}
          required={true}
          schemaName={"Tags (string)"}
          qualifierMessage={undefined}
          schema={{"type":"string","title":"Tags"}}
        >
          
        </SchemaItem><SchemaItem
          collapsible={true}
          className={"schemaItem"}
        >
          <details
            style={{}}
            className={"openapi-markdown__details"}
          >
            <summary
              style={{}}
            >
              <strong>
                base_name
              </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={true}
          className={"schemaItem"}
        >
          <details
            style={{}}
            className={"openapi-markdown__details"}
          >
            <summary
              style={{}}
            >
              <strong>
                config_name
              </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>
      </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"}}
                    >
                      any
                    </ul>
                  </details>
                </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>
      