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

# Create Agent



## OpenAPI

````yaml post /api/v1/agents
openapi: 3.1.0
info:
  title: AskUI Workspaces API
  version: 0.2.15
servers: []
security: []
paths:
  /api/v1/agents:
    post:
      tags:
        - agents
      summary: Create Agent
      operationId: create_agent_api_v1_agents_post
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AgentCreateCommand'
      responses:
        '201':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Agent'
        '409':
          description: Conflict
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
        '500':
          description: Internal server error
      security:
        - Bearer: []
        - Basic: []
components:
  schemas:
    AgentCreateCommand:
      properties:
        name:
          type: string
          pattern: ^[a-zA-Z0-9]([a-zA-Z0-9-_. ]{0,62}[a-zA-Z0-9])?$
          title: Name
          description: >-
            The name of the agent. The name must only contain the following
            characters: a-z, A-Z, 0-9, -, _, and space. The name must not be
            empty. The name must start and end with a letter or a number. The
            name must not be longer than 64 characters.
        description:
          type: string
          maxLength: 1024
          title: Description
          default: ''
        dataSchema:
          anyOf:
            - $ref: '#/components/schemas/JsonSchema'
            - type: 'null'
          description: >-
            The JSON schema of the data that the agent is going to extract from
            documents uploaded. The schema must comply with Draft 2020-12. The
            schema (root) must be an object with at least one property. The size
            of the schema must not exceed 15 MB.
        autoConfirm:
          type: boolean
          title: Autoconfirm
          description: >-
            If true, the agent will automatically confirm the data extracted,
            i.e., no review is necessary.
          default: false
        dataDestinations:
          items:
            oneOf:
              - $ref: '#/components/schemas/DataDestinationAskUiWorkflowCreate'
              - $ref: '#/components/schemas/DataDestinationWebhookCreate'
            discriminator:
              propertyName: type
              mapping:
                ASKUI_WORKFLOW:
                  $ref: '#/components/schemas/DataDestinationAskUiWorkflowCreate'
                WEBHOOK:
                  $ref: '#/components/schemas/DataDestinationWebhookCreate'
          type: array
          title: Datadestinations
        parentId:
          anyOf:
            - type: string
              format: uuid4
            - type: 'null'
          title: Parentid
          description: >-
            The ID of an agent that this agent is created from, i.e., of the
            previous version of this agent. Parent is going to be archived as
            part of the creation of the new (active) agent.
        emailTrigger:
          $ref: '#/components/schemas/EmailAgentTriggerCreate'
        workspaceId:
          type: string
          format: uuid4
          title: Workspaceid
        templateId:
          type: string
          pattern: ^[a-zA-Z0-9-_.]{1,64}$
          title: Templateid
          description: The ID of the template to copy files from.
      type: object
      required:
        - name
        - workspaceId
        - templateId
      title: AgentCreateCommand
    Agent:
      properties:
        id:
          type: string
          format: uuid4
          title: Id
        createdAt:
          type: string
          format: date-time
          title: Createdat
        updatedAt:
          type: string
          format: date-time
          title: Updatedat
        name:
          type: string
          pattern: ^[a-zA-Z0-9]([a-zA-Z0-9-_. ]{0,62}[a-zA-Z0-9])?$
          title: Name
          description: >-
            The name of the agent. The name must only contain the following
            characters: a-z, A-Z, 0-9, -, _, and space. The name must not be
            empty. The name must start and end with a letter or a number. The
            name must not be longer than 64 characters.
        status:
          type: string
          enum:
            - ACTIVE
            - ARCHIVED
          title: Status
        autoConfirm:
          type: boolean
          title: Autoconfirm
          description: >-
            If true, the agent will automatically confirm the data extracted,
            i.e., no review is necessary.
        description:
          type: string
          maxLength: 1024
          title: Description
          default: ''
        emailTrigger:
          $ref: '#/components/schemas/EmailAgentTrigger'
        dataSchema:
          anyOf:
            - $ref: '#/components/schemas/JsonSchema'
            - type: 'null'
          description: |2-

                        The data schema describes the data to extract in form of a [JSON schema draft 2020-12](https://json-schema.org/draft/2020-12/release-notes). Use the ["description" keyword](https://json-schema.org/understanding-json-schema/reference/annotations) of each property to provide additional information about the field, e.g., the prompt for extraction from sources. 
                    
        dataDestinations:
          items:
            oneOf:
              - $ref: '#/components/schemas/DataDestinationAskUiWorkflow'
              - $ref: '#/components/schemas/DataDestinationWebhook'
            discriminator:
              propertyName: type
              mapping:
                ASKUI_WORKFLOW:
                  $ref: '#/components/schemas/DataDestinationAskUiWorkflow'
                WEBHOOK:
                  $ref: '#/components/schemas/DataDestinationWebhook'
          type: array
          title: Datadestinations
        workspaceId:
          type: string
          format: uuid4
          title: Workspaceid
        folderPath:
          anyOf:
            - type: string
            - type: 'null'
          title: Folderpath
      type: object
      required:
        - name
        - status
        - autoConfirm
        - emailTrigger
        - dataDestinations
        - workspaceId
      title: Agent
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    JsonSchema:
      properties:
        title:
          type: string
          pattern: ^[a-zA-Z0-9_-]+$
          title: Title
          default: DataToExtract
        description:
          type: string
          title: Description
          default: ''
        type:
          type: string
          const: object
          title: Type
          default: object
        properties:
          additionalProperties:
            additionalProperties: true
            type: object
          type: object
          minProperties: 1
          title: Properties
        required:
          items:
            type: string
          type: array
          title: Required
      type: object
      required:
        - properties
      title: JsonSchema
    DataDestinationAskUiWorkflowCreate:
      properties:
        type:
          type: string
          const: ASKUI_WORKFLOW
          title: Type
          default: ASKUI_WORKFLOW
        host:
          $ref: '#/components/schemas/AskUiRunnerHost'
          default: ASKUI
        runnerTags:
          items:
            type: string
          type: array
          title: Runnertags
        workflows:
          items:
            type: string
          type: array
          minItems: 1
          title: Workflows
      type: object
      title: DataDestinationAskUiWorkflowCreate
    DataDestinationWebhookCreate:
      properties:
        type:
          type: string
          const: WEBHOOK
          title: Type
          default: WEBHOOK
        url:
          type: string
          maxLength: 2083
          minLength: 1
          format: uri
          title: Url
        headers:
          additionalProperties:
            type: string
          type: object
          title: Headers
      type: object
      required:
        - url
      title: DataDestinationWebhookCreate
    EmailAgentTriggerCreate:
      properties:
        active:
          type: boolean
          title: Active
          description: If false, no emails can be send to trigger agent.
          default: true
        allowedSenders:
          items:
            type: string
          type: array
          uniqueItems: true
          title: Allowedsenders
          description: >-
            The email addresses that are allowed to send emails to trigger the
            agent. If empty, no emails can be send to trigger agent.
        localPart:
          anyOf:
            - type: string
              pattern: ^[a-zA-Z0-9-_.+]+$
            - type: 'null'
          title: Localpart
          description: Defaults to a unique email string if not provided.
      type: object
      title: EmailAgentTriggerCreate
    EmailAgentTrigger:
      properties:
        active:
          type: boolean
          title: Active
          description: If false, no emails can be send to trigger agent.
          default: true
        allowedSenders:
          items:
            type: string
          type: array
          uniqueItems: true
          title: Allowedsenders
          description: >-
            The email addresses that are allowed to send emails to trigger the
            agent. If empty, no emails can be send to trigger agent.
        email:
          type: string
          pattern: ^[a-zA-Z0-9-_.+]+@.*$
          title: Email
          description: >-
            The email address of the agent to send emails to to trigger the
            agent. The email address must be unique for each agent. The domain
            of the email address is fixed. The local part of the email address
            must be between 1 and 64 characters long and can only contain the
            following characters: a-z, A-Z, 0-9, -, _, . and +.
      type: object
      required:
        - email
      title: EmailAgentTrigger
    DataDestinationAskUiWorkflow:
      properties:
        type:
          type: string
          const: ASKUI_WORKFLOW
          title: Type
          default: ASKUI_WORKFLOW
        host:
          $ref: '#/components/schemas/AskUiRunnerHost'
        runnerTags:
          items:
            type: string
          type: array
          title: Runnertags
        workflows:
          items:
            type: string
          type: array
          minItems: 1
          title: Workflows
      type: object
      required:
        - host
        - runnerTags
        - workflows
      title: DataDestinationAskUiWorkflow
    DataDestinationWebhook:
      properties:
        type:
          type: string
          const: WEBHOOK
          title: Type
          default: WEBHOOK
        url:
          type: string
          maxLength: 2083
          minLength: 1
          format: uri
          title: Url
        headers:
          additionalProperties:
            type: string
          type: object
          title: Headers
      type: object
      required:
        - url
        - headers
      title: DataDestinationWebhook
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
    AskUiRunnerHost:
      type: string
      enum:
        - SELF
        - ASKUI
      title: AskUiRunnerHost
  securitySchemes:
    Bearer:
      type: http
      scheme: bearer
    Basic:
      type: apiKey
      in: header
      name: Authorization

````