# Run Component

<Heading
  as={"h1"}
  className={"openapi__heading"}
  children={"Run Component"}
>
</Heading>

<MethodEndpoint
  method={"post"}
  path={"/api/v1/haystack/components/run"}
  context={"endpoint"}
>
  
</MethodEndpoint>

Runs a haystack component with the provided parameters.

This is useful for testing components or running them with specific input data.

<Heading
  id={"request"}
  as={"h2"}
  className={"openapi-tabs__heading"}
  children={"Request"}
>
</Heading>

<ParamsDetails
  parameters={[{"in":"query","name":"api_endpoint","required":false,"schema":{"default":"haystack_components_run","title":"Api Endpoint","type":"string"}}]}
>
  
</ParamsDetails>

<RequestSchema
  title={"Body"}
  body={{"content":{"application/json":{"schema":{"properties":{"component_type":{"description":"Type of the component.","title":"Component Type","type":"string"},"init_params":{"additionalProperties":true,"description":"Component init params as key-value pairs of param name and value.","title":"Init Params","type":"object"},"input":{"additionalProperties":true,"description":"Input data for the component run.","title":"Input","type":"object"},"input_types":{"anyOf":[{"additionalProperties":{"type":"string"},"type":"object"},{"type":"null"}],"description":"Optional input types used to deserialize data, defining how raw input is converted into usable Python objects before the component runs. If not provided, they're inferred from the component's input definitions.","title":"Input Types"}},"required":["component_type","init_params","input"],"title":"RunComponentRequest","type":"object"}}},"required":true}}
>
  
</RequestSchema>

<StatusCodes
  id={undefined}
  label={undefined}
  responses={{"200":{"content":{"application/json":{"schema":{"additionalProperties":true,"title":"RunComponentResponse","type":"object"}}},"description":"The output produced by running the component."},"400":{"description":"The component failed to run because of incorrect parameters or input, or it references a disabled index. Enable the index first before running the component."},"404":{"description":"The component doesn't exist or is missing. Make sure the component name is correct."},"422":{"content":{"application/json":{"schema":{"properties":{"detail":{"items":{"properties":{"ctx":{"title":"Context","type":"object"},"input":{"title":"Input"},"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"title":"Location","type":"array"},"msg":{"title":"Message","type":"string"},"type":{"title":"Error Type","type":"string"}},"required":["loc","msg","type"],"title":"ValidationError","type":"object"},"title":"Detail","type":"array"}},"title":"HTTPValidationError","type":"object"}}},"description":"Validation Error"}}}
>
  
</StatusCodes>
