---
title: "Create Tool Version"
method: POST
path: "/api/public/v2/tool-registry/{identifier}/versions"
tags: ["tool-registry"]
---

# Create Tool Version

`POST /api/public/v2/tool-registry/{identifier}/versions`

## Path parameters

- `identifier` string, required — Tool ID (numeric) or name

## Headers

- `X-API-KEY` string, required

## Request body

- object
  - `tool_definition` object, required — Tool definition in OpenAI function-calling format
  - `execution` object, nullable — Optional sandbox-executable body. When set, PromptLayer auto-runs the body between LLM turns whenever a prompt uses this version. See Auto Tool Execution.
    - `type` 'code', required
    - `language` 'python' | 'javascript', required
    - `code` string, required — 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` string, nullable — Commit message for the new version

## Response `201`

Version created

- object
  - `success` boolean
  - `version` object

## Other responses

- `404` — Tool not found

---

[API](https://skmtc.dev/promptlayer/apis/promptlayer-api.md) · [All operations](https://skmtc.dev/promptlayer/apis/promptlayer-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/promptlayer/promptlayer-api/revisions/a23093a0a506/schema)
