> ## Documentation Index
> Fetch the complete documentation index at: https://docs.gp.scale.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Create Application With Variant

> Create an application with a variant in a single transaction.



## OpenAPI

````yaml https://app.stainlessapi.com/api/spec/documented/sgp/openapi.yml post /v4/application-with-variant
openapi: 3.1.0
info:
  title: EGP API V4
  description: >-
    This is the parent API for all EGP APIs. If you are looking for the EGP API,
    please go to https://api.egp.scale.com/docs.
  contact:
    name: Scale Generative AI Platform
    url: https://scale.com/genai-platform
  version: 0.1.0
servers:
  - url: https://api.egp.scale.com
security: []
tags:
  - name: Models
    description: Model API.
paths:
  /v4/application-with-variant:
    post:
      tags:
        - Applications
      summary: Create Application With Variant
      description: Create an application with a variant in a single transaction.
      operationId: POST-V4-/application-with-variant
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateApplicationWithVariantRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApplicationVariantResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - APIKeyHeader: []
components:
  schemas:
    CreateApplicationWithVariantRequest:
      properties:
        application_spec_name:
          type: string
          title: Application Spec Name
        application_spec_description:
          type: string
          title: Application Spec Description
        variant:
          $ref: '#/components/schemas/ApplicationVariantRequestWithoutSpecId'
      type: object
      required:
        - application_spec_name
        - application_spec_description
        - variant
      title: CreateApplicationWithVariantRequest
    ApplicationVariantResponse:
      oneOf:
        - $ref: '#/components/schemas/ApplicationVariantV0Response'
        - $ref: '#/components/schemas/ApplicationVariantAgentsServiceResponse'
        - $ref: '#/components/schemas/OfflineApplicationVariantResponse'
      title: ApplicationVariantResponse
      discriminator:
        propertyName: version
        mapping:
          AGENTS_SERVICE:
            $ref: '#/components/schemas/ApplicationVariantAgentsServiceResponse'
          OFFLINE:
            $ref: '#/components/schemas/OfflineApplicationVariantResponse'
          V0:
            $ref: '#/components/schemas/ApplicationVariantV0Response'
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ApplicationVariantRequestWithoutSpecId:
      oneOf:
        - $ref: '#/components/schemas/ApplicationVariantV0RequestWithoutSpecId'
        - $ref: >-
            #/components/schemas/ApplicationVariantAgentsServiceRequestWithoutSpecId
        - $ref: '#/components/schemas/OfflineApplicationVariantRequestWithoutSpecId'
      title: ApplicationVariantRequestWithoutSpecId
      discriminator:
        propertyName: version
        mapping:
          AGENTS_SERVICE:
            $ref: >-
              #/components/schemas/ApplicationVariantAgentsServiceRequestWithoutSpecId
          OFFLINE:
            $ref: '#/components/schemas/OfflineApplicationVariantRequestWithoutSpecId'
          V0:
            $ref: '#/components/schemas/ApplicationVariantV0RequestWithoutSpecId'
    ApplicationVariantV0Response:
      properties:
        id:
          type: string
          title: Id
        name:
          type: string
          title: Name
        description:
          title: Description
          description: Optional description of the application variant
          type: string
        configuration:
          $ref: '#/components/schemas/ApplicationConfigurationV0'
        version:
          type: string
          const: V0
          title: Version
        application_spec_id:
          type: string
          title: Application Spec Id
        draft:
          title: Draft
          description: Boolean to indicate whether the variant is in draft mode
          optional_in_request: true
          type: boolean
        published_at:
          title: Published At
          description: The date and time that the variant was published.
          type: string
          format: date-time
        account_id:
          type: string
          title: Account Id
          description: The ID of the account that owns the given entity.
          can_patch: false
        created_by_user_id:
          type: string
          title: Created By User Id
          description: The user who originally created the entity.
        created_by_identity_type:
          $ref: '#/components/schemas/IdentifierTypeEnum'
          description: The type of identity that created the entity.
        created_at:
          type: string
          format: date-time
          title: Created At
          description: The date and time when the entity was created in ISO format.
        updated_at:
          type: string
          format: date-time
          title: Updated At
          description: The date and time when the entity was last updated in ISO format.
      type: object
      required:
        - id
        - name
        - configuration
        - version
        - application_spec_id
        - draft
        - account_id
        - created_at
        - updated_at
      title: ApplicationVariantV0Response
    ApplicationVariantAgentsServiceResponse:
      properties:
        id:
          type: string
          title: Id
        name:
          type: string
          title: Name
        description:
          title: Description
          description: Optional description of the application variant
          type: string
        configuration:
          $ref: '#/components/schemas/ApplicationAgentsServiceConfiguration'
        version:
          type: string
          const: AGENTS_SERVICE
          title: Version
        application_spec_id:
          type: string
          title: Application Spec Id
        draft:
          title: Draft
          description: Boolean to indicate whether the variant is in draft mode
          optional_in_request: true
          type: boolean
        published_at:
          title: Published At
          description: The date and time that the variant was published.
          type: string
          format: date-time
        account_id:
          type: string
          title: Account Id
          description: The ID of the account that owns the given entity.
          can_patch: false
        created_by_user_id:
          type: string
          title: Created By User Id
          description: The user who originally created the entity.
        created_by_identity_type:
          $ref: '#/components/schemas/IdentifierTypeEnum'
          description: The type of identity that created the entity.
        created_at:
          type: string
          format: date-time
          title: Created At
          description: The date and time when the entity was created in ISO format.
        updated_at:
          type: string
          format: date-time
          title: Updated At
          description: The date and time when the entity was last updated in ISO format.
      type: object
      required:
        - id
        - name
        - configuration
        - version
        - application_spec_id
        - draft
        - account_id
        - created_at
        - updated_at
      title: ApplicationVariantAgentsServiceResponse
    OfflineApplicationVariantResponse:
      properties:
        id:
          type: string
          title: Id
        name:
          type: string
          title: Name
        description:
          title: Description
          description: Optional description of the application variant
          type: string
        configuration:
          $ref: '#/components/schemas/OfflineApplicationConfiguration'
        version:
          type: string
          const: OFFLINE
          title: Version
        application_spec_id:
          type: string
          title: Application Spec Id
        draft:
          title: Draft
          description: Boolean to indicate whether the variant is in draft mode
          optional_in_request: true
          type: boolean
        published_at:
          title: Published At
          description: The date and time that the variant was published.
          type: string
          format: date-time
        account_id:
          type: string
          title: Account Id
          description: The ID of the account that owns the given entity.
          can_patch: false
        created_by_user_id:
          type: string
          title: Created By User Id
          description: The user who originally created the entity.
        created_by_identity_type:
          $ref: '#/components/schemas/IdentifierTypeEnum'
          description: The type of identity that created the entity.
        created_at:
          type: string
          format: date-time
          title: Created At
          description: The date and time when the entity was created in ISO format.
        updated_at:
          type: string
          format: date-time
          title: Updated At
          description: The date and time when the entity was last updated in ISO format.
      type: object
      required:
        - id
        - name
        - configuration
        - version
        - application_spec_id
        - draft
        - account_id
        - created_at
        - updated_at
      title: OfflineApplicationVariantResponse
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
          additionalProperties: true
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
    ApplicationVariantV0RequestWithoutSpecId:
      properties:
        name:
          type: string
          title: Name
        description:
          title: Description
          description: Optional description of the application variant
          type: string
        configuration:
          $ref: '#/components/schemas/ApplicationConfigurationV0'
        version:
          type: string
          const: V0
          title: Version
        application_spec_id:
          type: string
          title: Application Spec Id
        draft:
          title: Draft
          description: Boolean to indicate whether the variant is in draft mode
          optional_in_request: true
          type: boolean
        published_at:
          title: Published At
          description: The date and time that the variant was published.
          type: string
          format: date-time
        account_id:
          type: string
          title: Account Id
          description: The ID of the account that owns the given entity.
          can_patch: false
      type: object
      required:
        - name
        - configuration
        - version
        - account_id
      title: ApplicationVariantV0RequestWithoutSpecId
    ApplicationVariantAgentsServiceRequestWithoutSpecId:
      properties:
        name:
          type: string
          title: Name
        description:
          title: Description
          description: Optional description of the application variant
          type: string
        configuration:
          $ref: '#/components/schemas/ApplicationAgentsServiceConfiguration'
        version:
          type: string
          const: AGENTS_SERVICE
          title: Version
        application_spec_id:
          type: string
          title: Application Spec Id
        draft:
          title: Draft
          description: Boolean to indicate whether the variant is in draft mode
          optional_in_request: true
          type: boolean
        published_at:
          title: Published At
          description: The date and time that the variant was published.
          type: string
          format: date-time
        account_id:
          type: string
          title: Account Id
          description: The ID of the account that owns the given entity.
          can_patch: false
      type: object
      required:
        - name
        - configuration
        - version
        - account_id
      title: ApplicationVariantAgentsServiceRequestWithoutSpecId
    OfflineApplicationVariantRequestWithoutSpecId:
      properties:
        name:
          type: string
          title: Name
        description:
          title: Description
          description: Optional description of the application variant
          type: string
        configuration:
          $ref: '#/components/schemas/OfflineApplicationConfiguration'
        version:
          type: string
          const: OFFLINE
          title: Version
        application_spec_id:
          type: string
          title: Application Spec Id
        draft:
          title: Draft
          description: Boolean to indicate whether the variant is in draft mode
          optional_in_request: true
          type: boolean
        published_at:
          title: Published At
          description: The date and time that the variant was published.
          type: string
          format: date-time
        account_id:
          type: string
          title: Account Id
          description: The ID of the account that owns the given entity.
          can_patch: false
      type: object
      required:
        - name
        - configuration
        - version
        - account_id
      title: OfflineApplicationVariantRequestWithoutSpecId
    ApplicationConfigurationV0:
      properties:
        metadata:
          title: Metadata
          description: User defined metadata about the application
          additionalProperties: true
          type: object
        nodes:
          items:
            $ref: '#/components/schemas/ApplicationNode'
          type: array
          title: Nodes
        edges:
          items:
            $ref: '#/components/schemas/ApplicationEdge'
          type: array
          title: Edges
      type: object
      required:
        - nodes
        - edges
      title: ApplicationConfigurationV0
    IdentifierTypeEnum:
      type: string
      enum:
        - user
        - service_account
      title: IdentifierTypeEnum
    ApplicationAgentsServiceConfiguration:
      properties:
        metadata:
          title: Metadata
          description: User defined metadata about the application
          additionalProperties: true
          type: object
        type:
          type: string
          enum:
            - WORKFLOW
            - PLAN
            - STATE_MACHINE
          title: Type
        params:
          title: Params
        graph:
          $ref: '#/components/schemas/AgentsServiceGraphDescriptor'
          description: The graph of the agents service configuration
        inputs:
          title: Inputs
          description: The starting inputs that this agent configuration expects
          items:
            $ref: '#/components/schemas/ApplicationAgentGraphInput'
          type: array
        inputs_by_node:
          title: Inputs By Node
          description: The inputs that each node expects
          additionalProperties:
            items:
              $ref: '#/components/schemas/ApplicationAgentGraphInput'
            type: array
          type: object
        agent_service_errors:
          title: Agent Service Errors
          description: Errors that occurred when calling agent service
          items:
            type: string
          type: array
        raw_configuration:
          title: Raw Configuration
          description: >-
            Raw configuration entered by the user. May be invalid if variant is
            in draft mode.
          type: string
      type: object
      required:
        - type
        - params
      title: ApplicationAgentsServiceConfiguration
    OfflineApplicationConfiguration:
      properties:
        metadata:
          title: Metadata
          description: User defined metadata about the application
          additionalProperties: true
          type: object
      type: object
      title: OfflineApplicationConfiguration
    ApplicationNode:
      properties:
        id:
          type: string
          title: Id
        application_node_schema_id:
          $ref: '#/components/schemas/NodeSchemaId'
        configuration:
          additionalProperties:
            $ref: '#/components/schemas/ConfigurationFieldValue'
          type: object
          title: Configuration
      type: object
      required:
        - id
        - application_node_schema_id
      title: ApplicationNode
    ApplicationEdge:
      properties:
        from_node:
          type: string
          title: From Node
        to_node:
          type: string
          title: To Node
        from_field:
          type: string
          title: From Field
        to_field:
          type: string
          title: To Field
      type: object
      required:
        - from_node
        - to_node
        - from_field
        - to_field
      title: ApplicationEdge
    AgentsServiceGraphDescriptor:
      properties:
        nodes:
          items:
            $ref: '#/components/schemas/ApplicationAgentGraphNode'
          type: array
          title: Nodes
        edges:
          items:
            $ref: '#/components/schemas/ApplicationAgentGraphEdge'
          type: array
          title: Edges
      type: object
      required:
        - nodes
        - edges
      title: AgentsServiceGraphDescriptor
    ApplicationAgentGraphInput:
      properties:
        name:
          type: string
          title: Name
        required:
          type: boolean
          title: Required
          default: true
        title:
          type: string
          title: Title
        description:
          title: Description
          type: string
        type:
          $ref: '#/components/schemas/AgentUserInputType'
        examples:
          title: Examples
          items:
            type: string
          type: array
        default:
          title: Default
          type: string
        value_constraint:
          $ref: '#/components/schemas/ValueConstraint'
      type: object
      required:
        - name
        - type
      title: ApplicationAgentGraphInput
    NodeSchemaId:
      type: string
      enum:
        - text_input_schema
        - text_output_schema
        - knowledge_base_input_schema
        - knowledge_base_schema
        - multi_knowledge_base_input_schema
        - multi_knowledge_base_schema
        - reranker_schema
        - prompt_engineering_schema
        - completion_model_input_schema
        - completion_model_schema
        - external_endpoint_schema
        - document_input_schema
        - map_reduce_schema
        - document_search_schema
        - document_prompt_schema
      title: NodeSchemaId
    ConfigurationFieldValue:
      properties:
        value:
          title: Value
      type: object
      required:
        - value
      title: ConfigurationFieldValue
    ApplicationAgentGraphNode:
      properties:
        id:
          type: string
          title: Id
        name:
          type: string
          title: Name
        type:
          type: string
          title: Type
        operation_type:
          $ref: '#/components/schemas/ApplicationOperationType'
        config:
          title: Config
          additionalProperties: true
          type: object
        nodes:
          items:
            $ref: '#/components/schemas/ApplicationAgentGraphNode'
          type: array
          title: Nodes
        edges:
          items:
            $ref: '#/components/schemas/ApplicationAgentGraphEdge'
          type: array
          title: Edges
      type: object
      required:
        - id
        - name
        - type
      title: ApplicationAgentGraphNode
    ApplicationAgentGraphEdge:
      properties:
        from_node:
          type: string
          title: From Node
        to_node:
          type: string
          title: To Node
      type: object
      required:
        - from_node
        - to_node
      title: ApplicationAgentGraphEdge
    AgentUserInputType:
      type: string
      enum:
        - ShortText
        - SentenceText
        - ParagraphText
        - ArtifactId
        - ArtifactIds
        - KnowledgeBaseId
        - KnowledgeBaseIds
        - InputImageDir
        - Message
        - Messages
        - integer
        - number
        - string
        - boolean
        - array
        - object
        - unknown
      title: AgentUserInputType
    ValueConstraint:
      properties:
        selection_constraint_type:
          $ref: '#/components/schemas/SelectionConstraintType'
        potential_values:
          items:
            type: string
          type: array
          title: Potential Values
        value_type:
          $ref: '#/components/schemas/AgentUserInputType'
        min_items:
          title: Min Items
          type: integer
        max_items:
          title: Max Items
          type: integer
      type: object
      required:
        - selection_constraint_type
        - potential_values
        - value_type
      title: ValueConstraint
    ApplicationOperationType:
      type: string
      enum:
        - TEXT_INPUT
        - TEXT_OUTPUT
        - COMPLETION_INPUT
        - COMPLETION
        - KB_RETRIEVAL
        - KB_INPUT
        - RERANKING
        - EXTERNAL_ENDPOINT
        - PROMPT_ENGINEERING
        - DOCUMENT_INPUT
        - MAP_REDUCE
        - DOCUMENT_SEARCH
        - DOCUMENT_PROMPT
        - CUSTOM
        - CODE_EXECUTION
        - DATA_MANIPULATION
        - EVALUATION
        - FILE_RETRIEVAL
        - KB_ADD_CHUNK
        - KB_MANAGEMENT
        - GUARDRAIL
        - OUTPUT_GUARDRAIL
        - TRACER
        - AGENT_TRACER
        - AGENT_WORKFLOW
        - STANDALONE
      title: ApplicationOperationType
    SelectionConstraintType:
      type: string
      enum:
        - single
        - multi
      title: SelectionConstraintType
  securitySchemes:
    APIKeyHeader:
      type: apiKey
      in: header
      name: x-api-key

````