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

# Create Procedure

> Create a new procedure for the agent on a branch.



## OpenAPI

````yaml /api-reference/openapi.json post /v1/convai/agents/{agent_id}/branches/{branch_id}/procedures
openapi: 3.1.0
info:
  title: Threetone API Documentation
  description: >-
    This is the documentation for the Threetone API. You can use this API to use
    our service programmatically with API keys sent in the x-api-key header. You
    can create and manage API keys in the dashboard at
    https://threetone.in/app/developers/api-keys.
  version: '1.0'
servers:
  - url: https://api.threetone.in
    description: Production
security: []
paths:
  /v1/convai/agents/{agent_id}/branches/{branch_id}/procedures:
    post:
      tags:
        - Agents Platform
      summary: Create Procedure
      description: Create a new procedure for the agent on a branch.
      operationId: create_procedure_route
      parameters:
        - name: agent_id
          in: path
          required: true
          schema:
            type: string
            description: Agent ID to get the procedure draft from
            examples:
              - agent_3701k3ttaq12ewp8b7qv5rfyszkz
            title: Agent Id
          description: Agent ID to get the procedure draft from
        - name: branch_id
          in: path
          required: true
          schema:
            type: string
            description: Branch ID to get the procedure draft from
            examples:
              - agtbranch_0901k4aafjxxfxt93gd841r7tv5t
            title: Branch Id
          description: Branch ID to get the procedure draft from
        - name: x-api-key
          in: header
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            description: >-
              Your API key for programmatic access. Send it in the x-api-key
              header; you can create and manage keys from the Developers page.
            title: X-Api-Key
          description: >-
            Your API key for programmatic access. Send it in the x-api-key
            header; you can create and manage keys from the Developers page.
      requestBody:
        content:
          application/json:
            schema:
              anyOf:
                - $ref: '#/components/schemas/CreateProcedureRequestModel'
                - type: 'null'
              title: Request
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateProcedureResponseModel'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    CreateProcedureRequestModel:
      properties:
        name:
          type: string
          maxLength: 200
          title: Name
          description: Procedure name
          default: ''
        content:
          type: string
          title: Content
          description: Initial procedure content
          default: ''
        type:
          $ref: '#/components/schemas/ProcedureType'
          description: Procedure type
          default: free_form
        trigger:
          anyOf:
            - type: string
            - type: 'null'
          title: Trigger
          description: >-
            When the agent should use this procedure. Empty string means this is
            a sub-procedure that should only start when another procedure
            references it. If omitted or null, the trigger is derived from the
            content instead. Also accepts `description` as an alias.
      type: object
      title: CreateProcedureRequestModel
    CreateProcedureResponseModel:
      properties:
        procedure_id:
          type: string
          title: Procedure Id
          description: ID of the created procedure
      type: object
      required:
        - procedure_id
      title: CreateProcedureResponseModel
      example:
        procedure_id: agtprc_6qbpwdq8n01bxhk44bgjy6f10ck3
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ProcedureType:
      type: string
      enum:
        - free_form
        - deterministic
      title: ProcedureType
      default: free_form
    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

````