> ## 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 Registry

Create a new tool in the Tool Registry with an initial version. The tool definition should be in OpenAI function-calling format.

Tool names must be unique within a workspace. The initial version is created with version number 1.


## OpenAPI

````yaml POST /api/public/v2/tool-registry
openapi: 3.1.0
info:
  title: FastAPI
  version: 0.1.0
servers: []
security:
  - ApiKeyAuth: []
paths:
  /api/public/v2/tool-registry:
    post:
      tags:
        - tool-registry
      summary: Create Tool Registry
      operationId: create_tool_registry
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - name
                - tool_definition
              properties:
                name:
                  type: string
                  description: Tool name (unique per workspace)
                tool_definition:
                  type: object
                  description: Tool definition in OpenAI function-calling format
                folder_id:
                  type: integer
                  description: Folder ID to place tool in
                  nullable: true
                commit_message:
                  type: string
                  description: Commit message for the initial version
                  nullable: true
                external_ids:
                  type: array
                  items:
                    $ref: '#/components/schemas/ExternalId'
                  description: Identifiers from other systems.
      responses:
        '201':
          description: Tool created
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  tool_registry:
                    type: object
                  version:
                    type: object
                  external_ids:
                    type: array
                    items:
                      $ref: '#/components/schemas/ExternalId'
                    description: External ID mappings for the tool.
                required:
                  - external_ids
        '401':
          $ref: '#/components/responses/UnauthorizedError'
        '409':
          description: External ID conflict
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ExternalIdErrorResponse'
        '422':
          $ref: '#/components/responses/ValidationError'
components:
  schemas:
    ExternalId:
      properties:
        source:
          type: string
          maxLength: 128
          minLength: 1
          title: Source
          description: The external system or namespace that owns the ID.
        external_id:
          type: string
          maxLength: 512
          minLength: 1
          title: External Id
          description: The identifier for this entity in the external system.
      type: object
      required:
        - source
        - external_id
      additionalProperties: false
      title: ExternalId
      description: >-
        Customer-defined mapping between a PromptLayer entity and an external
        system identifier.
    ExternalIdErrorResponse:
      properties:
        success:
          type: boolean
          const: false
          default: false
          title: Success
        message:
          type: string
          title: Message
      type: object
      required:
        - message
      title: ExternalIdErrorResponse
    ErrorResponse:
      type: object
      properties:
        success:
          type: boolean
          default: false
          description: Indicates that the request failed.
        message:
          type: string
          description: Human-readable error message.
        error:
          type: string
          description: Machine-readable or fallback error message.
      additionalProperties: true
      description: >-
        Standard error response. Some legacy endpoints may return either message
        or error.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    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
  responses:
    UnauthorizedError:
      description: Unauthorized - missing or invalid API key.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    ValidationError:
      description: Validation error - request parameters or body are invalid.
      content:
        application/json:
          schema:
            oneOf:
              - $ref: '#/components/schemas/HTTPValidationError'
              - $ref: '#/components/schemas/ErrorResponse'
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-KEY

````