Skip to main content
For the complete documentation index for agents and LLMs, see llms.txt.

Upload a Custom Component with the REST API

Upload a custom component to Haystack Enterprise Platform using an API endpoint so that you can use it in your pipelines.


About This Task​

Permissions

You must be an organization Admin to upload custom components to Haystack Enterprise Platform.

When you upload a component, we verify the structure and version of the uploaded ZIP file.

Prerequisites​

  • An API Key to connect to Haystack Enterprise Platform.
  • A tested custom component that follows the linting and formatting conventions. You can use the hatch run code-quality:all command to check the linting.

Upload the Component​

  1. Zip the repository from the template folder. The zipped repository should contain the same files in the same hierarchy as the dc-custom-component-template repository.
    This command creates a ZIP file called custom_component.zip in the parent directory:
    zip -r ../custom_component.zip ./*
  2. Upload the ZIP file to Haystack Platform using the Import Custom Components endpoint. Here's a sample code you can use as a starting point for your request:
    import requests

    url = "https://api.cloud.deepset.ai/api/v2/custom_components"

    files = { "file": ("custom_component.zip", open("path/to/custom_component.zip", "rb"), "application/x-zip-compressed") }
    headers = {
    "accept": "application/json",
    "authorization": "Bearer <YOUR_API_KEY>"
    }

    response = requests.post(url, files=files, headers=headers)

    print(response.text)