---
title: "Create Tool Registry"
method: POST
path: "/api/public/v2/tool-registry"
tags: ["tool-registry"]
---

# Create Tool Registry

`POST /api/public/v2/tool-registry`

## Request body

- object
  - `name` string, required — Tool name (unique per workspace)
  - `tool_definition` object, required — Tool definition in OpenAI function-calling format
  - `description` string, nullable — Optional human-readable description of the tool
  - `folder_id` integer, nullable — Folder ID to place tool in
  - `commit_message` string, nullable — Commit message for the initial version
  - `external_ids` ExternalId[] — Identifiers from other systems.
    - `source` string, required — The external system or namespace that owns the ID.
    - `external_id` string, required — The identifier for this entity in the external system.
  - `execution` object, nullable — Optional sandbox-executable body for the tool. When set, PromptLayer auto-runs the body between LLM turns. See the Auto Tool Execution feature page.
    - `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. The LLM's arguments arrive as a single `args` object.

## Response `201`

Tool created

- object
  - `success` boolean
  - `tool_registry` object
  - `version` object
  - `external_ids` ExternalId[], required — External ID mappings for the tool.
    - `source` string, required — The external system or namespace that owns the ID.
    - `external_id` string, required — The identifier for this entity in the external system.

## Other responses

- `401` — Unauthorized - missing or invalid API key.
- `409` — External ID conflict
- `422` — Validation error - request parameters or body are invalid.

---

[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)
