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

# Create Tool Version

Create a new immutable version of an existing tool. Use this to update the schema or to attach an [auto-execution](/features/tool-registry/auto-execution) body.

The new version is assigned the next sequential version number. Pass a `commit_message` to leave an audit-trail note.

If you include `execution`, PromptLayer will run the body in a sandbox whenever a prompt referencing this version is invoked. The `code` field is the function **body only**. The signature is generated server-side.


## OpenAPI

````yaml POST /api/public/v2/tool-registry/{identifier}/versions
openapi: 3.1.0
info:
  title: FastAPI
  version: 0.1.0
servers: []
security:
  - ApiKeyAuth: []
paths:
  /api/public/v2/tool-registry/{identifier}/versions:
    post:
      tags:
        - tool-registry
      summary: Create Tool Version
      operationId: create_tool_version
      parameters:
        - required: true
          schema:
            type: string
            title: X-Api-Key
          name: X-API-KEY
          in: header
        - name: identifier
          in: path
          required: true
          schema:
            type: string
            description: Tool ID (numeric) or name
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - tool_definition
              properties:
                tool_definition:
                  type: object
                  description: Tool definition in OpenAI function-calling format
                execution:
                  type: object
                  description: >-
                    Optional sandbox-executable body. When set, PromptLayer
                    auto-runs the body between LLM turns whenever a prompt uses
                    this version. See Auto Tool Execution.
                  nullable: true
                  required:
                    - type
                    - language
                    - code
                  properties:
                    type:
                      type: string
                      enum:
                        - code
                    language:
                      type: string
                      enum:
                        - python
                        - javascript
                    code:
                      type: string
                      description: >-
                        The function BODY only — the signature `def
                        <name>(args):` (Python) or `function <name>(args) { ...
                        }` (JavaScript) is generated automatically. LLM
                        arguments arrive as a single `args` object.
                commit_message:
                  type: string
                  description: Commit message for the new version
                  nullable: true
      responses:
        '201':
          description: Version created
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  version:
                    type: object
        '404':
          description: Tool not found
components:
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-KEY

````