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

OpenAPIConnector

Invoke REST endpoints defined in an OpenAPI specification. Use this component to call any REST API that follows the OpenAPI standard directly from a Haystack pipeline.

Key Features

  • Dynamically interprets an OpenAPI specification and exposes its operations.
  • Invokes endpoints by operation_id with query, path, or body parameters.
  • Supports optional API credentials for authenticated services.
  • Accepts additional client configuration through service_kwargs.

Configuration

Add Workspace-Level Integration

  1. Click your profile icon and choose Settings.
  2. Go to Workspace>Integrations.
  3. Find the provider you want to connect and click Connect next to them.
  4. Enter the API key and any other required details.
  5. Click Connect. You can use this integration in pipelines and indexes in the current workspace.

Add Organization-Level Integration

  1. Click your profile icon and choose Settings.
  2. Go to Organization>Integrations.
  3. Find the provider you want to connect and click Connect next to them.
  4. Enter the API key and any other required details.
  5. Click Connect. You can use this integration in pipelines and indexes in all workspaces in the current organization.
  1. Drag the OpenAPIConnector component onto the canvas from the Component Library.
  2. Click on the component to open the configuration panel.
  3. On the General tab:
    • Set openapi_spec to a URL, file path, or raw OpenAPI specification string.
    • Set credentials if the API requires authentication.
  4. Go to the Advanced tab to configure service_kwargs for additional OpenAPI client options.

Connections

OpenAPIConnector receives an operation_id and optional arguments as inputs. It outputs a response dictionary with the service response. Connect it to components that supply operation parameters or process API results.

Source Code

To check this component's source code, open openapi.py in the Haystack Core Integrations repository.

Usage Examples

Basic Configuration

  OpenAPIConnector:
type: haystack_integrations.components.connectors.openapi.openapi.OpenAPIConnector
init_parameters:
openapi_spec: https://bit.ly/serperdev_openapi
credentials:
type: env_var
env_vars:
- SERPERDEV_API_KEY
strict: false

Pass the operation_id and arguments at query time:

# haystack-pipeline
components:
api_connector:
type: haystack_integrations.components.connectors.openapi.openapi.OpenAPIConnector
init_parameters:
openapi_spec: https://bit.ly/serperdev_openapi
credentials:
type: env_var
env_vars:
- SERPERDEV_API_KEY
strict: false

inputs:
operation_id:
- api_connector.operation_id
arguments:
- api_connector.arguments

outputs:
response: api_connector.response

Parameters

Inputs

ParameterTypeDescription
operation_idstrThe operationId from the OpenAPI spec to invoke.
argumentsDict[str, Any] | NoneParameters for the endpoint (query, path, or body parameters).

Outputs

ParameterTypeDescription
responseDict[str, Any]The service response.

Init Parameters

These are the parameters you can configure in Pipeline Builder:

ParameterTypeDefaultDescription
openapi_specstrURL, file path, or raw string of the OpenAPI specification.
credentialsSecret | NoneNoneAPI key or credentials for the service.
service_kwargsDict[str, Any] | NoneNoneAdditional keyword arguments passed to the OpenAPI client.

Run Method Parameters

These are the parameters you can configure for the component's run() method. This means you can pass these parameters at query time through the API, in Playground, or when running a job. For details, see Modify Pipeline Parameters at Query Time.

ParameterTypeDefaultDescription
operation_idstrThe operationId from the OpenAPI spec to invoke.
argumentsDict[str, Any] | NoneNoneParameters for the endpoint.